aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2017-11-13 18:41:30 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2017-11-13 18:41:49 +0300
commit3a83b3843db6434e9806558ea1e912055d5baf04 (patch)
treeba8ae5cdcedf55e752f9325705f739ee3f48421d
parente5e8350fcb3ea321efc28aaf88413677b3c97613 (diff)
downloadpandoc-3a83b3843db6434e9806558ea1e912055d5baf04.tar.gz
Replace "emacs" extension with "amuse" extension
It makes clear that extension is related to Muse markup.
-rw-r--r--src/Text/Pandoc/Extensions.hs5
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs2
-rw-r--r--test/Tests/Readers/Muse.hs12
-rw-r--r--test/Tests/Writers/Muse.hs4
4 files changed, 12 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index ef05a597e..b7227860a 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -153,7 +153,7 @@ data Extension =
| Ext_smart -- ^ "Smart" quotes, apostrophes, ellipses, dashes
| Ext_old_dashes -- ^ -- = em, - before number = en
| Ext_spaced_reference_links -- ^ Allow space between two parts of ref link
- | Ext_emacs -- ^ Try to emulate Emacs Muse instead of Amusewiki
+ | Ext_amuse -- ^ Enable Text::Amuse extensions to Emacs Muse markup
deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
instance ToJSON Extension where
@@ -315,6 +315,9 @@ getDefaultExtensions "markdown_phpextra" = phpMarkdownExtraExtensions
getDefaultExtensions "markdown_mmd" = multimarkdownExtensions
getDefaultExtensions "markdown_github" = githubMarkdownExtensions
getDefaultExtensions "markdown" = pandocExtensions
+getDefaultExtensions "muse" = extensionsFromList
+ [Ext_amuse,
+ Ext_auto_identifiers]
getDefaultExtensions "plain" = plainExtensions
getDefaultExtensions "gfm" = githubMarkdownExtensions
getDefaultExtensions "org" = extensionsFromList
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index 6739bc41f..13b517d09 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -423,7 +423,7 @@ definitionListItem = try $ do
pure $ do lineContent' <- lineContent
pure (B.text term, [lineContent'])
where
- termParser = (guardEnabled Ext_emacs <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse
+ termParser = (guardDisabled Ext_amuse <|> void spaceChar) >> -- Initial space is required by Amusewiki, but not Emacs Muse
many spaceChar >>
many1Till anyChar (lookAhead (void (try (spaceChar >> string "::")) <|> void newline))
endOfInput = try $ skipMany blankline >> skipSpaces >> eof
diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs
index 29cef09ca..b4e5dd05e 100644
--- a/test/Tests/Readers/Muse.hs
+++ b/test/Tests/Readers/Muse.hs
@@ -10,20 +10,16 @@ import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
-muse :: Text -> Pandoc
-muse = purely $ \s -> do
- setInputFiles ["in"]
- setOutputFile (Just "out")
- readMuse def s
+amuse :: Text -> Pandoc
+amuse = purely $ readMuse def { readerExtensions = extensionsFromList [Ext_amuse]}
emacsMuse :: Text -> Pandoc
-emacsMuse = purely $ readMuse def { readerExtensions =
- enableExtension Ext_emacs pandocExtensions }
+emacsMuse = purely $ readMuse def { readerExtensions = emptyExtensions }
infix 4 =:
(=:) :: ToString c
=> String -> (Text, c) -> TestTree
-(=:) = test muse
+(=:) = test amuse
spcSep :: [Inlines] -> Inlines
spcSep = mconcat . intersperse space
diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs
index e5c19c7bc..a6c1edc3b 100644
--- a/test/Tests/Writers/Muse.hs
+++ b/test/Tests/Writers/Muse.hs
@@ -8,7 +8,9 @@ import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
muse :: (ToPandoc a) => a -> String
-muse = museWithOpts def{ writerWrapText = WrapNone }
+muse = museWithOpts def{ writerWrapText = WrapNone,
+ writerExtensions = extensionsFromList [Ext_amuse,
+ Ext_auto_identifiers] }
museWithOpts :: (ToPandoc a) => WriterOptions -> a -> String
museWithOpts opts = unpack . purely (writeMuse opts) . toPandoc