git.iko.soy/typeable/pandoc
on master help sign in
Docbook writer: Use programlisting for code blocks.

Instead of screen, as before.

commita3327835be6caf6f09941c1317b224d34d241c29 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 24 Jul 2011, 23:36 (15 years ago) parent07c7cd1
2 files changed+25−25
src/Text/Pandoc/Writers/Docbook.hs+3−3 tests/writer.docbook+22−22
src/Text/Pandoc/Writers/Docbook.hs+3−3
@@ -147,9 +147,9 @@ blockToDocbook opts (Para lst) =
147147 inTagsIndented "para" $ inlinesToDocbook opts lst
148148blockToDocbook opts (BlockQuote blocks) =
149149 inTagsIndented "blockquote" $ blocksToDocbook opts blocks
150−blockToDocbook _ (CodeBlock (_,classes,_) str) =
151− text ("<screen" ++ lang ++ ">") <> cr <>
152− flush (text (escapeStringForXML str) <> cr <> text "</screen>")
150+blockToDocbook _ (CodeBlock (_,classes,_) str) =
151+ text ("<programlisting" ++ lang ++ ">") <> cr <>
152+ flush (text (escapeStringForXML str) <> cr <> text "</programlisting>")
153153 where lang = if null langs
154154 then ""
155155 else " language=\"" ++ escapeStringForXML (head langs) ++
tests/writer.docbook+22−22
@@ -84,11 +84,11 @@
8484 <para>
8585 Code in a block quote:
8686 </para>
87− <screen>
87+ <programlisting>
8888sub status {
8989 print &quot;working&quot;;
9090}
91−</screen>
91+</programlisting>
9292 <para>
9393 A list:
9494 </para>
@@ -130,7 +130,7 @@ sub status {
130130 <para>
131131 Code:
132132 </para>
133− <screen>
133+ <programlisting>
134134---- (should be four hyphens)
135135
136136sub status {
@@ -138,15 +138,15 @@ sub status {
138138}
139139
140140this code block is indented by one tab
141−</screen>
141+</programlisting>
142142 <para>
143143 And:
144144 </para>
145− <screen>
145+ <programlisting>
146146 this code block is indented by two tabs
147147
148148These should not be escaped: \$ \\ \&gt; \[ \{
149−</screen>
149+</programlisting>
150150</section>
151151<section id="lists">
152152 <title>Lists</title>
@@ -742,9 +742,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
742742 <para>
743743 orange fruit
744744 </para>
745− <screen>
745+ <programlisting>
746746{ orange code block }
747−</screen>
747+</programlisting>
748748 <blockquote>
749749 <para>
750750 orange block quote
@@ -902,17 +902,17 @@ These should not be escaped: \$ \\ \&gt; \[ \{
902902 <para>
903903 This should be a code block, though:
904904 </para>
905− <screen>
905+ <programlisting>
906906&lt;div&gt;
907907 foo
908908&lt;/div&gt;
909−</screen>
909+</programlisting>
910910 <para>
911911 As should this:
912912 </para>
913− <screen>
913+ <programlisting>
914914&lt;div&gt;foo&lt;/div&gt;
915−</screen>
915+</programlisting>
916916 <para>
917917 Now, nested:
918918 </para>
@@ -942,9 +942,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
942942 <para>
943943 Code block:
944944 </para>
945− <screen>
945+ <programlisting>
946946&lt;!-- Comment --&gt;
947−</screen>
947+</programlisting>
948948 <para>
949949 Just plain comment, with trailing spaces on the line:
950950 </para>
@@ -952,9 +952,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
952952 <para>
953953 Code:
954954 </para>
955− <screen>
955+ <programlisting>
956956&lt;hr /&gt;
957−</screen>
957+</programlisting>
958958 <para>
959959 Hr's:
960960 </para>
@@ -1291,9 +1291,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
12911291 <para>
12921292 This should [not][] be a link.
12931293 </para>
1294− <screen>
1294+ <programlisting>
12951295[not]: /url
1296−</screen>
1296+</programlisting>
12971297 <para>
12981298 Foo <ulink url="/url/">bar</ulink>.
12991299 </para>
@@ -1355,9 +1355,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
13551355 Auto-links should not occur here:
13561356 <literal>&lt;http://example.com/&gt;</literal>
13571357 </para>
1358− <screen>
1358+ <programlisting>
13591359or here: &lt;http://example.com/&gt;
1360−</screen>
1360+</programlisting>
13611361 </section>
13621362</section>
13631363<section id="images">
@@ -1398,9 +1398,9 @@ or here: &lt;http://example.com/&gt;
13981398 Subsequent blocks are indented to show that they belong to the
13991399 footnote (as with list items).
14001400 </para>
1401− <screen>
1401+ <programlisting>
14021402 { &lt;code&gt; }
1403−</screen>
1403+</programlisting>
14041404 <para>
14051405 If you want, you can indent every line, but you can also be lazy and
14061406 just indent the first line of each block.