git.iko.soy/typeable/pandoc
on master help sign in
Use 'fig:' instead of '\SOH' in title to indicate figure.

Revises 1a4b47e93368bfbd31daccdfedbd9527ee740201

commit7bc37e4414fc34574e5c0dbbef86d165405f9cff authorJohn MacFarlane <jgm@berkeley.edu> dateTue 15 Jan 2013, 08:45 (14 years ago) parent1a4b47e
16 files changed+29−29
src/Text/Pandoc/Readers/Markdown.hs+2−2 src/Text/Pandoc/Writers/AsciiDoc.hs+1−1 src/Text/Pandoc/Writers/ConTeXt.hs+2−2 src/Text/Pandoc/Writers/Docbook.hs+2−2 src/Text/Pandoc/Writers/Docx.hs+2−2 src/Text/Pandoc/Writers/FB2.hs+2−2 src/Text/Pandoc/Writers/HTML.hs+2−2 src/Text/Pandoc/Writers/LaTeX.hs+2−2 src/Text/Pandoc/Writers/Markdown.hs+2−2 src/Text/Pandoc/Writers/MediaWiki.hs+2−2 src/Text/Pandoc/Writers/Org.hs+2−2 src/Text/Pandoc/Writers/RST.hs+2−2 src/Text/Pandoc/Writers/Texinfo.hs+2−2 src/Text/Pandoc/Writers/Textile.hs+2−2 tests/testsuite.native+1−1 tests/writer.native+1−1
src/Text/Pandoc/Readers/Markdown.hs+2−2
@@ -783,9 +783,9 @@ para = try $ do
783783 case B.toList result' of
784784 [Image alt (src,tit)]
785785 | Ext_implicit_figures `Set.member` exts ->
786− -- the \1 at beginning of title indicates a figure
786+ -- the fig: at beginning of title indicates a figure
787787 return $ B.para $ B.singleton
788− $ Image alt (src,'\1':tit)
788+ $ Image alt (src,'f':'i':'g':':':tit)
789789 _ -> return $ B.para result'
790790
791791plain :: MarkdownParser (F Blocks)
src/Text/Pandoc/Writers/AsciiDoc.hs+1−1
@@ -116,7 +116,7 @@ blockToAsciiDoc _ Null = return empty
116116blockToAsciiDoc opts (Plain inlines) = do
117117 contents <- inlineListToAsciiDoc opts inlines
118118 return $ contents <> cr
119−blockToAsciiDoc opts (Para [Image alt (src,'\1':tit)]) =
119+blockToAsciiDoc opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
120120 blockToAsciiDoc opts (Para [Image alt (src,tit)])
121121blockToAsciiDoc opts (Para inlines) = do
122122 contents <- inlineListToAsciiDoc opts inlines
src/Text/Pandoc/Writers/ConTeXt.hs+2−2
@@ -131,8 +131,8 @@ blockToConTeXt :: Block
131131 -> State WriterState Doc
132132blockToConTeXt Null = return empty
133133blockToConTeXt (Plain lst) = inlineListToConTeXt lst
134−-- title beginning with \1 indicates that the image is a figure
135−blockToConTeXt (Para [Image txt (src,'\1':_)]) = do
134+-- title beginning with fig: indicates that the image is a figure
135+blockToConTeXt (Para [Image txt (src,'f':'i':'g':':':_)]) = do
136136 capt <- inlineListToConTeXt txt
137137 return $ blankline $$ "\\placefigure[here,nonumber]" <> braces capt <>
138138 braces ("\\externalfigure" <> brackets (text src)) <> blankline
src/Text/Pandoc/Writers/Docbook.hs+2−2
@@ -144,8 +144,8 @@ blockToDocbook :: WriterOptions -> Block -> Doc
144144blockToDocbook _ Null = empty
145145blockToDocbook _ (Header _ _ _) = empty -- should not occur after hierarchicalize
146146blockToDocbook opts (Plain lst) = inlinesToDocbook opts lst
147−-- title beginning with \1 indicates that the image is a figure
148−blockToDocbook opts (Para [Image txt (src,'\1':_)]) =
147+-- title beginning with fig: indicates that the image is a figure
148+blockToDocbook opts (Para [Image txt (src,'f':'i':'g':':':_)]) =
149149 let alt = inlinesToDocbook opts txt
150150 capt = if null txt
151151 then empty
src/Text/Pandoc/Writers/Docx.hs+2−2
@@ -347,8 +347,8 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do
347347 let bookmarkEnd = mknode "w:bookmarkEnd" [("w:id", id')] ()
348348 return $ [bookmarkStart] ++ contents ++ [bookmarkEnd]
349349blockToOpenXML opts (Plain lst) = blockToOpenXML opts (Para lst)
350−-- title beginning with \1 indicates that the image is a figure
351−blockToOpenXML opts (Para [Image alt (src,'\1':tit)]) = do
350+-- title beginning with fig: indicates that the image is a figure
351+blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
352352 paraProps <- getParaProps
353353 contents <- inlinesToOpenXML opts [Image alt (src,tit)]
354354 captionNode <- withParaProp (pStyle "ImageCaption")
src/Text/Pandoc/Writers/FB2.hs+2−2
@@ -316,8 +316,8 @@ linkID i = "l" ++ (show i)
316316blockToXml :: Block -> FBM [Content]
317317blockToXml (Plain ss) = cMapM toXml ss -- FIXME: can lead to malformed FB2
318318blockToXml (Para [Math DisplayMath formula]) = insertMath NormalImage formula
319−-- title beginning with \1 indicates that the image is a figure
320−blockToXml (Para [Image alt (src,'\1':tit)]) =
319+-- title beginning with fig: indicates that the image is a figure
320+blockToXml (Para [Image alt (src,'f':'i':'g':':':tit)]) =
321321 insertImage NormalImage (Image alt (src,tit))
322322blockToXml (Para ss) = liftM (list . el "p") $ cMapM toXml ss
323323blockToXml (CodeBlock _ s) = return . spaceBeforeAfter .
src/Text/Pandoc/Writers/HTML.hs+2−2
@@ -392,8 +392,8 @@ treatAsImage fp =
392392blockToHtml :: WriterOptions -> Block -> State WriterState Html
393393blockToHtml _ Null = return mempty
394394blockToHtml opts (Plain lst) = inlineListToHtml opts lst
395−-- title beginning with \1 indicates that the image is a figure
396−blockToHtml opts (Para [Image txt (s,'\1':tit)]) = do
395+-- title beginning with fig: indicates that the image is a figure
396+blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
397397 img <- inlineToHtml opts (Image txt (s,tit))
398398 let tocapt = if writerHtml5 opts
399399 then H5.figcaption
src/Text/Pandoc/Writers/LaTeX.hs+2−2
@@ -277,8 +277,8 @@ blockToLaTeX :: Block -- ^ Block to convert
277277 -> State WriterState Doc
278278blockToLaTeX Null = return empty
279279blockToLaTeX (Plain lst) = inlineListToLaTeX lst
280−-- title beginning with \1 indicates that the image is a figure
281−blockToLaTeX (Para [Image txt (src,'\1':tit)]) = do
280+-- title beginning with fig: indicates that the image is a figure
281+blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
282282 capt <- if null txt
283283 then return empty
284284 else (\c -> "\\caption" <> braces c) `fmap` inlineListToLaTeX txt
src/Text/Pandoc/Writers/Markdown.hs+2−2
@@ -246,8 +246,8 @@ blockToMarkdown _ Null = return empty
246246blockToMarkdown opts (Plain inlines) = do
247247 contents <- inlineListToMarkdown opts inlines
248248 return $ contents <> cr
249−-- title beginning with \1 indicates figure
250−blockToMarkdown opts (Para [Image alt (src,'\1':tit)]) =
249+-- title beginning with fig: indicates figure
250+blockToMarkdown opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
251251 blockToMarkdown opts (Para [Image alt (src,tit)])
252252blockToMarkdown opts (Para inlines) = do
253253 contents <- inlineListToMarkdown opts inlines
src/Text/Pandoc/Writers/MediaWiki.hs+2−2
@@ -81,8 +81,8 @@ blockToMediaWiki _ Null = return ""
8181blockToMediaWiki opts (Plain inlines) =
8282 inlineListToMediaWiki opts inlines
8383
84−-- title beginning with \1 indicates that the image is a figure
85−blockToMediaWiki opts (Para [Image txt (src,'\1':tit)]) = do
84+-- title beginning with fig: indicates that the image is a figure
85+blockToMediaWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
8686 capt <- if null txt
8787 then return ""
8888 else ("|caption " ++) `fmap` inlineListToMediaWiki opts txt
src/Text/Pandoc/Writers/Org.hs+2−2
@@ -114,8 +114,8 @@ blockToOrg :: Block -- ^ Block element
114114 -> State WriterState Doc
115115blockToOrg Null = return empty
116116blockToOrg (Plain inlines) = inlineListToOrg inlines
117−-- title beginning with \1 indicates that the image is a figure
118−blockToOrg (Para [Image txt (src,'\1':tit)]) = do
117+-- title beginning with fig: indicates that the image is a figure
118+blockToOrg (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
119119 capt <- if null txt
120120 then return empty
121121 else (\c -> "#+CAPTION: " <> c <> blankline) `fmap`
src/Text/Pandoc/Writers/RST.hs+2−2
@@ -148,8 +148,8 @@ blockToRST :: Block -- ^ Block element
148148 -> State WriterState Doc
149149blockToRST Null = return empty
150150blockToRST (Plain inlines) = inlineListToRST inlines
151−-- title beginning with \1 indicates that the image is a figure
152−blockToRST (Para [Image txt (src,'\1':tit)]) = do
151+-- title beginning with fig: indicates that the image is a figure
152+blockToRST (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
153153 capt <- inlineListToRST txt
154154 let fig = "figure:: " <> text src
155155 let alt = ":alt: " <> if null tit then capt else text tit
src/Text/Pandoc/Writers/Texinfo.hs+2−2
@@ -126,8 +126,8 @@ blockToTexinfo Null = return empty
126126blockToTexinfo (Plain lst) =
127127 inlineListToTexinfo lst
128128
129−-- title beginning with \1 indicates that the image is a figure
130−blockToTexinfo (Para [Image txt (src,'\1':tit)]) = do
129+-- title beginning with fig: indicates that the image is a figure
130+blockToTexinfo (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
131131 capt <- if null txt
132132 then return empty
133133 else (\c -> text "@caption" <> braces c) `fmap`
src/Text/Pandoc/Writers/Textile.hs+2−2
@@ -101,8 +101,8 @@ blockToTextile _ Null = return ""
101101blockToTextile opts (Plain inlines) =
102102 inlineListToTextile opts inlines
103103
104−-- title beginning with \1 indicates that the image is a figure
105−blockToTextile opts (Para [Image txt (src,'\1':tit)]) = do
104+-- title beginning with fig: indicates that the image is a figure
105+blockToTextile opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
106106 capt <- blockToTextile opts (Para txt)
107107 im <- inlineToTextile opts (Image txt (src,tit))
108108 return $ im ++ "\n" ++ capt
tests/testsuite.native+1−1
@@ -384,7 +384,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
384384,HorizontalRule
385385,Header 1 ("images",[],[]) [Str "Images"]
386386,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
387−,Para [Image [Str "lalune"] ("lalune.jpg","\SOHVoyage dans la Lune")]
387+,Para [Image [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
388388,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
389389,HorizontalRule
390390,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
tests/writer.native+1−1
@@ -384,7 +384,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
384384,HorizontalRule
385385,Header 1 ("images",[],[]) [Str "Images"]
386386,Para [Str "From",Space,Quoted DoubleQuote [Str "Voyage",Space,Str "dans",Space,Str "la",Space,Str "Lune"],Space,Str "by",Space,Str "Georges",Space,Str "Melies",Space,Str "(1902):"]
387−,Para [Image [Str "lalune"] ("lalune.jpg","\SOHVoyage dans la Lune")]
387+,Para [Image [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
388388,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
389389,HorizontalRule
390390,Header 1 ("footnotes",[],[]) [Str "Footnotes"]