aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-04-23 20:22:05 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-04-23 20:40:23 -0700
commit031686bd358ea7c26142217aa5fd4ca3448cffbe (patch)
treee19d1899139237f4e495bb6dd94999917857a13e
parentfb237a8b15caa900fa5bf07e0ce8abb7820fcaac (diff)
downloadpandoc-031686bd358ea7c26142217aa5fd4ca3448cffbe.tar.gz
Markdown reader: Implemented `Ext_ascii_identifiers`.
Closes #807.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs10
1 files 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{