From 031686bd358ea7c26142217aa5fd4ca3448cffbe Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 23 Apr 2013 20:22:05 -0700 Subject: Markdown reader: Implemented `Ext_ascii_identifiers`. Closes #807. --- src/Text/Pandoc/Readers/Markdown.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 84d93afdb..dcf7f1b1a 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -42,6 +42,7 @@ import Text.Pandoc.Builder (Inlines, Blocks, trimInlines, (<>)) import Text.Pandoc.Options import Text.Pandoc.Shared import Text.Pandoc.XML (fromEntities) +import Text.Pandoc.Asciify (toAsciiChar) import Text.Pandoc.Parsing hiding (tableWith) import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXBlock ) import Text.Pandoc.Readers.HTML ( htmlTag, htmlInBalanced, isInlineTag, isBlockTag, @@ -397,10 +398,15 @@ addToHeaderList (ident,classes,kvs) text = do then do ids <- stateIdentifiers `fmap` getState let id' = uniqueIdent (B.toList header') ids + let id'' = if Ext_ascii_identifiers `Set.member` exts + then catMaybes $ map toAsciiChar id' + else id' updateState $ \st -> st{ - stateIdentifiers = id' : ids, + stateIdentifiers = if id' == id'' + then id' : ids + else id' : id'' : ids, stateHeaders = insert' header' id' $ stateHeaders st } - return (id',classes,kvs) + return (id'',classes,kvs) else do unless (null ident) $ updateState $ \st -> st{ -- cgit v1.2.3