diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2016-06-26 20:19:18 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2016-06-26 20:42:22 +0200 |
commit | 0f3f5ce1a1569d02dcb858b45dca55cb5d488358 (patch) | |
tree | 3f39a2dce21a5a3b6ae86eb6adf2607c6d9cd03d /tests | |
parent | 7f4ee830c985b94cafe594c8cdfe02cf418f95eb (diff) | |
download | pandoc-0f3f5ce1a1569d02dcb858b45dca55cb5d488358.tar.gz |
Org reader: support figure labels
Figure labels given as `#+LABEL: thelabel` are used as the ID of the
respective image. This allows e.g. the LaTeX to add proper `\label`
markup.
This fixes half of #2496 and #2999.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Tests/Readers/Org.hs | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index 56dedee55..348b5a6aa 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -767,37 +767,47 @@ tests = , "#+END_COMMENT"] =?> (mempty::Blocks) - , "Figure" =: - unlines [ "#+caption: A very courageous man." - , "#+name: goodguy" - , "[[edward.jpg]]" - ] =?> - para (image "edward.jpg" "fig:goodguy" "A very courageous man.") - - , "Figure with no name" =: - unlines [ "#+caption: I've been through the desert on this" - , "[[horse.png]]" - ] =?> - para (image "horse.png" "fig:" "I've been through the desert on this") - - , "Figure with `fig:` prefix in name" =: - unlines [ "#+caption: Used as a metapher in evolutionary biology." - , "#+name: fig:redqueen" - , "[[the-red-queen.jpg]]" - ] =?> - para (image "the-red-queen.jpg" "fig:redqueen" - "Used as a metapher in evolutionary biology.") - - , "Figure with HTML attributes" =: - unlines [ "#+CAPTION: mah brain just explodid" - , "#+NAME: lambdacat" - , "#+ATTR_HTML: :style color: blue :role button" - , "[[lambdacat.jpg]]" - ] =?> - let kv = [("style", "color: blue"), ("role", "button")] - name = "fig:lambdacat" - caption = "mah brain just explodid" - in para (imageWith (mempty, mempty, kv) "lambdacat.jpg" name caption) + , testGroup "Figures" $ + [ "Figure" =: + unlines [ "#+caption: A very courageous man." + , "#+name: goodguy" + , "[[edward.jpg]]" + ] =?> + para (image "edward.jpg" "fig:goodguy" "A very courageous man.") + + , "Figure with no name" =: + unlines [ "#+caption: I've been through the desert on this" + , "[[horse.png]]" + ] =?> + para (image "horse.png" "fig:" "I've been through the desert on this") + + , "Figure with `fig:` prefix in name" =: + unlines [ "#+caption: Used as a metapher in evolutionary biology." + , "#+name: fig:redqueen" + , "[[the-red-queen.jpg]]" + ] =?> + para (image "the-red-queen.jpg" "fig:redqueen" + "Used as a metapher in evolutionary biology.") + + , "Figure with HTML attributes" =: + unlines [ "#+CAPTION: mah brain just explodid" + , "#+NAME: lambdacat" + , "#+ATTR_HTML: :style color: blue :role button" + , "[[lambdacat.jpg]]" + ] =?> + let kv = [("style", "color: blue"), ("role", "button")] + name = "fig:lambdacat" + caption = "mah brain just explodid" + in para (imageWith (mempty, mempty, kv) "lambdacat.jpg" name caption) + + , "Labelled figure" =: + unlines [ "#+CAPTION: My figure" + , "#+LABEL: fig:myfig" + , "[[blub.png]]" + ] =?> + let attr = ("fig:myfig", mempty, mempty) + in para (imageWith attr "blub.png" "fig:" "My figure") + ] , "Footnote" =: unlines [ "A footnote[1]" |