git.iko.soy/typeable/pandoc
on master help sign in
asciidoc writer: don't include `+` in code blocks for regular asciidoc.

This is asciidoctor-specific. Amends 98ee6ca289ad7117b7336a57bcfc6f4b54463f4e.

commit0e31483d4358a6d2b4ba96c71237e3f7b32979a1 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 4 Sep 2019, 14:56 (7 years ago) parente7b8728
2 files changed+13−8
src/Text/Pandoc/Writers/AsciiDoc.hs+7−2 test/writer.asciidoc+6−6
src/Text/Pandoc/Writers/AsciiDoc.hs+7−2
@@ -457,8 +457,13 @@ inlineToAsciiDoc opts (Quoted qt lst) = do
457457 DoubleQuote
458458 | isAsciidoctor -> [Str "\"`"] ++ lst ++ [Str "`\""]
459459 | otherwise -> [Str "``"] ++ lst ++ [Str "''"]
460−inlineToAsciiDoc _ (Code _ str) = return $
461− text "`+" <> text (escapeStringUsing (backslashEscapes "`") str) <> "+`"
460+inlineToAsciiDoc _ (Code _ str) = do
461+ isAsciidoctor <- gets asciidoctorVariant
462+ let contents = text (escapeStringUsing (backslashEscapes "`") str)
463+ return $
464+ if isAsciidoctor
465+ then text "`+" <> contents <> "+`"
466+ else text "`" <> contents <> "`"
462467inlineToAsciiDoc _ (Str str) = return $ text $ escapeString str
463468inlineToAsciiDoc _ (Math InlineMath str) = do
464469 isAsciidoctor <- gets asciidoctorVariant
test/writer.asciidoc+6−6
@@ -423,7 +423,7 @@ So is *_this_* word.
423423
424424So is *_this_* word.
425425
426−This is code: `+>+`, `+$+`, `+\+`, `+\$+`, `+<html>+`.
426+This is code: `>`, `$`, `\`, `\$`, `<html>`.
427427
428428[line-through]*This is _strikeout_.*
429429
@@ -446,7 +446,7 @@ spaces: a^b c^d, a~b c~d.
446446
447447`He said, ``I want to go.''' Were you alive in the 70’s?
448448
449−Here is some quoted ``+code+`' and a ``http://example.com/?foo=1&bar=2[quoted
449+Here is some quoted ``code`' and a ``http://example.com/?foo=1&bar=2[quoted
450450link]''.
451451
452452Some dashes: one—two — three—four — five.
@@ -476,11 +476,11 @@ latexmath:[$\alpha + \omega \times x^2$].
476476
477477These shouldn’t be math:
478478
479−* To get the famous equation, write `+$e = mc^2$+`.
479+* To get the famous equation, write `$e = mc^2$`.
480480* $22,000 is a _lot_ of money. So is $34,000. (It worked if ``lot'' is
481481emphasized.)
482482* Shoes ($20) and socks ($5).
483−* Escaped `+$+`: $73 _this should be emphasized_ 23$.
483+* Escaped `$`: $73 _this should be emphasized_ 23$.
484484
485485Here’s a LaTeX table:
486486
@@ -610,7 +610,7 @@ ____
610610Blockquoted: http://example.com/
611611____
612612
613−Auto-links should not occur here: `+<http://example.com/>+`
613+Auto-links should not occur here: `<http://example.com/>`
614614
615615....
616616or here: <http://example.com/>
@@ -635,7 +635,7 @@ anywhere after the footnote reference. It need not be placed at the end of the
635635document.] and another.[multiblock footnote omitted] This should _not_ be a
636636footnote reference, because it contains a space.[^my note] Here is an inline
637637note.footnote:[This is _easier_ to type. Inline notes may contain
638−http://google.com[links] and `+]+` verbatim characters, as well as [bracketed
638+http://google.com[links] and `]` verbatim characters, as well as [bracketed
639639text].]
640640
641641____