git.iko.soy/typeable/pandoc
on master help sign in
Docbook writer: Use programlisting for code blocks.
a332783John MacFarlane
src/Text/Pandoc/Writers/Docbook.hs+3−3
@@ -147,9 +147,9 @@ blockToDocbook opts (Para lst) =
147 inTagsIndented "para" $ inlinesToDocbook opts lst
147 inTagsIndented "para" $ inlinesToDocbook opts lst
148blockToDocbook opts (BlockQuote blocks) =
148blockToDocbook opts (BlockQuote blocks) =
149 inTagsIndented "blockquote" $ blocksToDocbook opts blocks
149 inTagsIndented "blockquote" $ blocksToDocbook opts blocks
150−blockToDocbook _ (CodeBlock (_,classes,_) str) =
150+blockToDocbook _ (CodeBlock (_,classes,_) str) =
151− text ("<screen" ++ lang ++ ">") <> cr <>
151+ text ("<programlisting" ++ lang ++ ">") <> cr <>
152− flush (text (escapeStringForXML str) <> cr <> text "</screen>")
152+ flush (text (escapeStringForXML str) <> cr <> text "</programlisting>")
153 where lang = if null langs
153 where lang = if null langs
154 then ""
154 then ""
155 else " language=\"" ++ escapeStringForXML (head langs) ++
155 else " language=\"" ++ escapeStringForXML (head langs) ++
tests/writer.docbook+22−22
@@ -84,11 +84,11 @@
84 <para>
84 <para>
85 Code in a block quote:
85 Code in a block quote:
86 </para>
86 </para>
87− <screen>
87+ <programlisting>
88sub status {
88sub status {
89 print &quot;working&quot;;
89 print &quot;working&quot;;
90}
90}
91−</screen>
91+</programlisting>
92 <para>
92 <para>
93 A list:
93 A list:
94 </para>
94 </para>
@@ -130,7 +130,7 @@ sub status {
130 <para>
130 <para>
131 Code:
131 Code:
132 </para>
132 </para>
133− <screen>
133+ <programlisting>
134---- (should be four hyphens)
134---- (should be four hyphens)
135
135
136sub status {
136sub status {
@@ -138,15 +138,15 @@ sub status {
138}
138}
139
139
140this code block is indented by one tab
140this code block is indented by one tab
141−</screen>
141+</programlisting>
142 <para>
142 <para>
143 And:
143 And:
144 </para>
144 </para>
145− <screen>
145+ <programlisting>
146 this code block is indented by two tabs
146 this code block is indented by two tabs
147
147
148These should not be escaped: \$ \\ \&gt; \[ \{
148These should not be escaped: \$ \\ \&gt; \[ \{
149−</screen>
149+</programlisting>
150</section>
150</section>
151<section id="lists">
151<section id="lists">
152 <title>Lists</title>
152 <title>Lists</title>
@@ -742,9 +742,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
742 <para>
742 <para>
743 orange fruit
743 orange fruit
744 </para>
744 </para>
745− <screen>
745+ <programlisting>
746{ orange code block }
746{ orange code block }
747−</screen>
747+</programlisting>
748 <blockquote>
748 <blockquote>
749 <para>
749 <para>
750 orange block quote
750 orange block quote
@@ -902,17 +902,17 @@ These should not be escaped: \$ \\ \&gt; \[ \{
902 <para>
902 <para>
903 This should be a code block, though:
903 This should be a code block, though:
904 </para>
904 </para>
905− <screen>
905+ <programlisting>
906&lt;div&gt;
906&lt;div&gt;
907 foo
907 foo
908&lt;/div&gt;
908&lt;/div&gt;
909−</screen>
909+</programlisting>
910 <para>
910 <para>
911 As should this:
911 As should this:
912 </para>
912 </para>
913− <screen>
913+ <programlisting>
914&lt;div&gt;foo&lt;/div&gt;
914&lt;div&gt;foo&lt;/div&gt;
915−</screen>
915+</programlisting>
916 <para>
916 <para>
917 Now, nested:
917 Now, nested:
918 </para>
918 </para>
@@ -942,9 +942,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
942 <para>
942 <para>
943 Code block:
943 Code block:
944 </para>
944 </para>
945− <screen>
945+ <programlisting>
946&lt;!-- Comment --&gt;
946&lt;!-- Comment --&gt;
947−</screen>
947+</programlisting>
948 <para>
948 <para>
949 Just plain comment, with trailing spaces on the line:
949 Just plain comment, with trailing spaces on the line:
950 </para>
950 </para>
@@ -952,9 +952,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
952 <para>
952 <para>
953 Code:
953 Code:
954 </para>
954 </para>
955− <screen>
955+ <programlisting>
956&lt;hr /&gt;
956&lt;hr /&gt;
957−</screen>
957+</programlisting>
958 <para>
958 <para>
959 Hr's:
959 Hr's:
960 </para>
960 </para>
@@ -1291,9 +1291,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
1291 <para>
1291 <para>
1292 This should [not][] be a link.
1292 This should [not][] be a link.
1293 </para>
1293 </para>
1294− <screen>
1294+ <programlisting>
1295[not]: /url
1295[not]: /url
1296−</screen>
1296+</programlisting>
1297 <para>
1297 <para>
1298 Foo <ulink url="/url/">bar</ulink>.
1298 Foo <ulink url="/url/">bar</ulink>.
1299 </para>
1299 </para>
@@ -1355,9 +1355,9 @@ These should not be escaped: \$ \\ \&gt; \[ \{
1355 Auto-links should not occur here:
1355 Auto-links should not occur here:
1356 <literal>&lt;http://example.com/&gt;</literal>
1356 <literal>&lt;http://example.com/&gt;</literal>
1357 </para>
1357 </para>
1358− <screen>
1358+ <programlisting>
1359or here: &lt;http://example.com/&gt;
1359or here: &lt;http://example.com/&gt;
1360−</screen>
1360+</programlisting>
1361 </section>
1361 </section>
1362</section>
1362</section>
1363<section id="images">
1363<section id="images">
@@ -1398,9 +1398,9 @@ or here: &lt;http://example.com/&gt;
1398 Subsequent blocks are indented to show that they belong to the
1398 Subsequent blocks are indented to show that they belong to the
1399 footnote (as with list items).
1399 footnote (as with list items).
1400 </para>
1400 </para>
1401− <screen>
1401+ <programlisting>
1402 { &lt;code&gt; }
1402 { &lt;code&gt; }
1403−</screen>
1403+</programlisting>
1404 <para>
1404 <para>
1405 If you want, you can indent every line, but you can also be lazy and
1405 If you want, you can indent every line, but you can also be lazy and
1406 just indent the first line of each block.
1406 just indent the first line of each block.