summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-09-17 12:49:15 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-09-17 13:01:27 -0700
commitb1ee747a249e0c1b1840222ef77607218157f099 (patch)
treed3dae4803ee2585ba3d44fca9c42a2a31e5cdb6f /src/Text/Pandoc/App.hs
parentce05814372b5a9d3d8f90dcd0e7c56df77d966a0 (diff)
Added `--strip-comments` option, `readerStripComments` in `ReaderOptions`.
* Options: Added readerStripComments to ReaderOptions. * Added `--strip-comments` command-line option. * Made `htmlTag` from the HTML reader sensitive to this feature. This affects Markdown and Textile input. Closes #2552.
Diffstat (limited to 'src/Text/Pandoc/App.hs')
-rw-r--r--src/Text/Pandoc/App.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index f8e23b10c..e5be7e620 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -483,6 +483,7 @@ convertWithOpts opts = do
, readerTrackChanges = optTrackChanges opts
, readerAbbreviations = abbrevs
, readerExtensions = readerExts
+ , readerStripComments = optStripComments opts
}
let transforms = (case optBaseHeaderLevel opts of
@@ -666,6 +667,7 @@ data Opt = Opt
, optIncludeInHeader :: [FilePath] -- ^ Files to include in header
, optResourcePath :: [FilePath] -- ^ Path to search for images etc
, optEol :: LineEnding -- ^ Style of line-endings to use
+ , optStripComments :: Bool -- ^ Skip HTML comments
} deriving (Generic, Show)
instance ToJSON Opt where
@@ -742,6 +744,7 @@ defaultOpts = Opt
, optIncludeInHeader = []
, optResourcePath = ["."]
, optEol = Native
+ , optStripComments = False
}
addMetadata :: (String, String) -> Pandoc -> Pandoc
@@ -1114,6 +1117,11 @@ options =
"NUMBER")
"" -- "Length of line in characters"
+ , Option "" ["strip-comments"]
+ (NoArg
+ (\opt -> return opt { optStripComments = True }))
+ "" -- "Strip HTML comments"
+
, Option "" ["toc", "table-of-contents"]
(NoArg
(\opt -> return opt { optTableOfContents = True }))