summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-01-15 08:45:46 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-01-15 08:46:09 -0800
commit7bc37e4414fc34574e5c0dbbef86d165405f9cff (patch)
tree8a7c323385a44066f983df9bf2474fed6f0a6010
parent1a4b47e93368bfbd31daccdfedbd9527ee740201 (diff)
Use 'fig:' instead of '\SOH' in title to indicate figure.
Revises 1a4b47e93368bfbd31daccdfedbd9527ee740201
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs4
-rw-r--r--src/Text/Pandoc/Writers/AsciiDoc.hs2
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs4
-rw-r--r--src/Text/Pandoc/Writers/Docbook.hs4
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs4
-rw-r--r--src/Text/Pandoc/Writers/FB2.hs4
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs4
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs4
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs4
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs4
-rw-r--r--src/Text/Pandoc/Writers/Org.hs4
-rw-r--r--src/Text/Pandoc/Writers/RST.hs4
-rw-r--r--src/Text/Pandoc/Writers/Texinfo.hs4
-rw-r--r--src/Text/Pandoc/Writers/Textile.hs4
-rw-r--r--tests/testsuite.native2
-rw-r--r--tests/writer.native2
16 files changed, 29 insertions, 29 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 1fb361585..156062099 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -783,9 +783,9 @@ para = try $ do
case B.toList result' of
[Image alt (src,tit)]
| Ext_implicit_figures `Set.member` exts ->
- -- the \1 at beginning of title indicates a figure
+ -- the fig: at beginning of title indicates a figure
return $ B.para $ B.singleton
- $ Image alt (src,'\1':tit)
+ $ Image alt (src,'f':'i':'g':':':tit)
_ -> return $ B.para result'
plain :: MarkdownParser (F Blocks)
diff --git a/src/Text/Pandoc/Writers/AsciiDoc.hs b/src/Text/Pandoc/Writers/AsciiDoc.hs
index 93d18eff8..3718431e2 100644
--- a/src/Text/Pandoc/Writers/AsciiDoc.hs
+++ b/src/Text/Pandoc/Writers/AsciiDoc.hs
@@ -116,7 +116,7 @@ blockToAsciiDoc _ Null = return empty
blockToAsciiDoc opts (Plain inlines) = do
contents <- inlineListToAsciiDoc opts inlines
return $ contents <> cr
-blockToAsciiDoc opts (Para [Image alt (src,'\1':tit)]) =
+blockToAsciiDoc opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
blockToAsciiDoc opts (Para [Image alt (src,tit)])
blockToAsciiDoc opts (Para inlines) = do
contents <- inlineListToAsciiDoc opts inlines
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 8f3a9b5cc..dd9979290 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -131,8 +131,8 @@ blockToConTeXt :: Block
-> State WriterState Doc
blockToConTeXt Null = return empty
blockToConTeXt (Plain lst) = inlineListToConTeXt lst
--- title beginning with \1 indicates that the image is a figure
-blockToConTeXt (Para [Image txt (src,'\1':_)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToConTeXt (Para [Image txt (src,'f':'i':'g':':':_)]) = do
capt <- inlineListToConTeXt txt
return $ blankline $$ "\\placefigure[here,nonumber]" <> braces capt <>
braces ("\\externalfigure" <> brackets (text src)) <> blankline
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs
index 9f0597722..f11338590 100644
--- a/src/Text/Pandoc/Writers/Docbook.hs
+++ b/src/Text/Pandoc/Writers/Docbook.hs
@@ -144,8 +144,8 @@ blockToDocbook :: WriterOptions -> Block -> Doc
blockToDocbook _ Null = empty
blockToDocbook _ (Header _ _ _) = empty -- should not occur after hierarchicalize
blockToDocbook opts (Plain lst) = inlinesToDocbook opts lst
--- title beginning with \1 indicates that the image is a figure
-blockToDocbook opts (Para [Image txt (src,'\1':_)]) =
+-- title beginning with fig: indicates that the image is a figure
+blockToDocbook opts (Para [Image txt (src,'f':'i':'g':':':_)]) =
let alt = inlinesToDocbook opts txt
capt = if null txt
then empty
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 5f0c01c42..9028acfde 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -347,8 +347,8 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do
let bookmarkEnd = mknode "w:bookmarkEnd" [("w:id", id')] ()
return $ [bookmarkStart] ++ contents ++ [bookmarkEnd]
blockToOpenXML opts (Plain lst) = blockToOpenXML opts (Para lst)
--- title beginning with \1 indicates that the image is a figure
-blockToOpenXML opts (Para [Image alt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
paraProps <- getParaProps
contents <- inlinesToOpenXML opts [Image alt (src,tit)]
captionNode <- withParaProp (pStyle "ImageCaption")
diff --git a/src/Text/Pandoc/Writers/FB2.hs b/src/Text/Pandoc/Writers/FB2.hs
index c19390d85..27f0c8305 100644
--- a/src/Text/Pandoc/Writers/FB2.hs
+++ b/src/Text/Pandoc/Writers/FB2.hs
@@ -316,8 +316,8 @@ linkID i = "l" ++ (show i)
blockToXml :: Block -> FBM [Content]
blockToXml (Plain ss) = cMapM toXml ss -- FIXME: can lead to malformed FB2
blockToXml (Para [Math DisplayMath formula]) = insertMath NormalImage formula
--- title beginning with \1 indicates that the image is a figure
-blockToXml (Para [Image alt (src,'\1':tit)]) =
+-- title beginning with fig: indicates that the image is a figure
+blockToXml (Para [Image alt (src,'f':'i':'g':':':tit)]) =
insertImage NormalImage (Image alt (src,tit))
blockToXml (Para ss) = liftM (list . el "p") $ cMapM toXml ss
blockToXml (CodeBlock _ s) = return . spaceBeforeAfter .
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index f683e7b62..3b9a1eae6 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -392,8 +392,8 @@ treatAsImage fp =
blockToHtml :: WriterOptions -> Block -> State WriterState Html
blockToHtml _ Null = return mempty
blockToHtml opts (Plain lst) = inlineListToHtml opts lst
--- title beginning with \1 indicates that the image is a figure
-blockToHtml opts (Para [Image txt (s,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
img <- inlineToHtml opts (Image txt (s,tit))
let tocapt = if writerHtml5 opts
then H5.figcaption
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 96549feae..3c0726b3d 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -277,8 +277,8 @@ blockToLaTeX :: Block -- ^ Block to convert
-> State WriterState Doc
blockToLaTeX Null = return empty
blockToLaTeX (Plain lst) = inlineListToLaTeX lst
--- title beginning with \1 indicates that the image is a figure
-blockToLaTeX (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- if null txt
then return empty
else (\c -> "\\caption" <> braces c) `fmap` inlineListToLaTeX txt
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index 8cc185010..54948a959 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -246,8 +246,8 @@ blockToMarkdown _ Null = return empty
blockToMarkdown opts (Plain inlines) = do
contents <- inlineListToMarkdown opts inlines
return $ contents <> cr
--- title beginning with \1 indicates figure
-blockToMarkdown opts (Para [Image alt (src,'\1':tit)]) =
+-- title beginning with fig: indicates figure
+blockToMarkdown opts (Para [Image alt (src,'f':'i':'g':':':tit)]) =
blockToMarkdown opts (Para [Image alt (src,tit)])
blockToMarkdown opts (Para inlines) = do
contents <- inlineListToMarkdown opts inlines
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 38dd969a4..4cec2d648 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -81,8 +81,8 @@ blockToMediaWiki _ Null = return ""
blockToMediaWiki opts (Plain inlines) =
inlineListToMediaWiki opts inlines
--- title beginning with \1 indicates that the image is a figure
-blockToMediaWiki opts (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToMediaWiki opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- if null txt
then return ""
else ("|caption " ++) `fmap` inlineListToMediaWiki opts txt
diff --git a/src/Text/Pandoc/Writers/Org.hs b/src/Text/Pandoc/Writers/Org.hs
index 8aa4a7885..4e7b21e35 100644
--- a/src/Text/Pandoc/Writers/Org.hs
+++ b/src/Text/Pandoc/Writers/Org.hs
@@ -114,8 +114,8 @@ blockToOrg :: Block -- ^ Block element
-> State WriterState Doc
blockToOrg Null = return empty
blockToOrg (Plain inlines) = inlineListToOrg inlines
--- title beginning with \1 indicates that the image is a figure
-blockToOrg (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToOrg (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- if null txt
then return empty
else (\c -> "#+CAPTION: " <> c <> blankline) `fmap`
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index f347f0188..89acd2ef5 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -148,8 +148,8 @@ blockToRST :: Block -- ^ Block element
-> State WriterState Doc
blockToRST Null = return empty
blockToRST (Plain inlines) = inlineListToRST inlines
--- title beginning with \1 indicates that the image is a figure
-blockToRST (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToRST (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- inlineListToRST txt
let fig = "figure:: " <> text src
let alt = ":alt: " <> if null tit then capt else text tit
diff --git a/src/Text/Pandoc/Writers/Texinfo.hs b/src/Text/Pandoc/Writers/Texinfo.hs
index 736c77a21..502a91967 100644
--- a/src/Text/Pandoc/Writers/Texinfo.hs
+++ b/src/Text/Pandoc/Writers/Texinfo.hs
@@ -126,8 +126,8 @@ blockToTexinfo Null = return empty
blockToTexinfo (Plain lst) =
inlineListToTexinfo lst
--- title beginning with \1 indicates that the image is a figure
-blockToTexinfo (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToTexinfo (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- if null txt
then return empty
else (\c -> text "@caption" <> braces c) `fmap`
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index 0f0b477a1..0a071c1f8 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -101,8 +101,8 @@ blockToTextile _ Null = return ""
blockToTextile opts (Plain inlines) =
inlineListToTextile opts inlines
--- title beginning with \1 indicates that the image is a figure
-blockToTextile opts (Para [Image txt (src,'\1':tit)]) = do
+-- title beginning with fig: indicates that the image is a figure
+blockToTextile opts (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
capt <- blockToTextile opts (Para txt)
im <- inlineToTextile opts (Image txt (src,tit))
return $ im ++ "\n" ++ capt
diff --git a/tests/testsuite.native b/tests/testsuite.native
index cbd77f2f9..90727a660 100644
--- a/tests/testsuite.native
+++ b/tests/testsuite.native
@@ -384,7 +384,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
,HorizontalRule
,Header 1 ("images",[],[]) [Str "Images"]
,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):"]
-,Para [Image [Str "lalune"] ("lalune.jpg","\SOHVoyage dans la Lune")]
+,Para [Image [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
,HorizontalRule
,Header 1 ("footnotes",[],[]) [Str "Footnotes"]
diff --git a/tests/writer.native b/tests/writer.native
index cbd77f2f9..90727a660 100644
--- a/tests/writer.native
+++ b/tests/writer.native
@@ -384,7 +384,7 @@ Pandoc (Meta {docTitle = [Str "Pandoc",Space,Str "Test",Space,Str "Suite"], docA
,HorizontalRule
,Header 1 ("images",[],[]) [Str "Images"]
,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):"]
-,Para [Image [Str "lalune"] ("lalune.jpg","\SOHVoyage dans la Lune")]
+,Para [Image [Str "lalune"] ("lalune.jpg","fig:Voyage dans la Lune")]
,Para [Str "Here",Space,Str "is",Space,Str "a",Space,Str "movie",Space,Image [Str "movie"] ("movie.jpg",""),Space,Str "icon."]
,HorizontalRule
,Header 1 ("footnotes",[],[]) [Str "Footnotes"]