summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-05 17:56:02 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2009-12-05 17:56:02 +0000
commit78475498b4d9ffc1677eff55667eb87108333544 (patch)
tree66435308e9fdede1407c36d7bac6205a9c533cef /src/pandoc.hs
parent61f7a4f8698e9d9eb7a8af6ab8253815415156e7 (diff)
Added --id-prefix option.
This adds a prefix to all automatically generated HTML identifiers, which helps prevent duplicate identifiers when you're generating a fragment (say a blog post). Added writerIdentifierPrefix to WriterOptions. Resolves Issue #41. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1650 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index e24d621bf..c2cc9b75e 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -153,6 +153,7 @@ data Opt = Opt
, optSanitizeHTML :: Bool -- ^ Sanitize HTML
, optPlugins :: [Pandoc -> IO Pandoc] -- ^ Plugins to apply
, optEmailObfuscation :: ObfuscationMethod
+ , optIdentifierPrefix :: String
, optIndentedCodeClasses :: [String] -- ^ Default classes for indented code blocks
#ifdef _CITEPROC
, optBiblioFile :: String
@@ -190,6 +191,7 @@ defaultOpts = Opt
, optSanitizeHTML = False
, optPlugins = []
, optEmailObfuscation = JavascriptObfuscation
+ , optIdentifierPrefix = ""
, optIndentedCodeClasses = []
#ifdef _CITEPROC
, optBiblioFile = []
@@ -314,6 +316,12 @@ options =
"none|javascript|references")
"" -- "Method for obfuscating email in HTML"
+ , Option "" ["id-prefix"]
+ (ReqArg
+ (\arg opt -> return opt { optIdentifierPrefix = arg })
+ "STRING")
+ "" -- "Prefix to add to automatically generated HTML identifiers"
+
, Option "" ["indented-code-classes"]
(ReqArg
(\arg opt -> return opt { optIndentedCodeClasses = words $
@@ -540,6 +548,7 @@ main = do
, optWrapText = wrap
, optSanitizeHTML = sanitize
, optEmailObfuscation = obfuscationMethod
+ , optIdentifierPrefix = idPrefix
, optIndentedCodeClasses = codeBlockClasses
#ifdef _CITEPROC
, optBiblioFile = biblioFile
@@ -627,7 +636,8 @@ main = do
lhsExtension [outputFile],
writerEmailObfuscation = if strict
then ReferenceObfuscation
- else obfuscationMethod }
+ else obfuscationMethod,
+ writerIdentifierPrefix = idPrefix }
when (isNonTextOutput writerName' && outputFile == "-") $
do hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++