require "spec_helper" RSpec.describe Asciidoctor::Standoc do it "handles spacing around markup" do expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} This is a paragraph with <> markup _for_ text, including **__nest__**ed markup. INPUT Document title en published #{Date.today.year} article

This is a paragraph with markup for text, including nested markup.

OUTPUT end it "processes inline_quoted formatting" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{DUMBQUOTE_BLANK_HDR} _Physical noise sources_ *strong* `monospace` "double quote" 'single quote' super^script^ sub~script~ sub~__scr__ipt~ stem:[ F Α ] [alt]#alt# [deprecated]#deprecated# [domain]#domain# [strike]#strike# [smallcap]#smallcap# [keyword]#keyword# INPUT #{BLANK_HDR} Physical noise sources strong monospace "double quote" 'single quote' superscript subscript subscript F Α alt deprecated domain strike smallcap keyword OUTPUT end it "properly handles inline substitution" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{DUMBQUOTE_BLANK_HDR} stem:[n < 1] + latexmath:[n < 1] INPUT #{BLANK_HDR}

n<1
n < 1

OUTPUT end it "normalises inline stem" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{DUMBQUOTE_BLANK_HDR} stem:[n < 1] latexmath:[n < 1] INPUT #{BLANK_HDR}

n<1 n < 1

OUTPUT end it "generates desired smart quotes for 'dd'" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} '99'. INPUT #{BLANK_HDR}

‘99’.

OUTPUT end it "processes breaks" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Line break + line break ''' <<< [%landscape] <<< [%portrait] <<< INPUT #{BLANK_HDR}

Line break
line break


OUTPUT end it "processes links" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} mailto:fred@example.com http://example.com[] http://example.com[Link] http://example.com[Link,title="tip"] INPUT #{BLANK_HDR}

mailto:fred@example.com Link Link

OUTPUT end it "processes bookmarks" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Text [[bookmark]] Text INPUT #{BLANK_HDR}

Text Text

OUTPUT end it "processes crossreferences" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [[reference]] == Section Inline Reference to <> Footnoted Reference to <> Inline Reference with Text to <> Footnoted Reference with Text to <> Anchored Crossreference to other document <> INPUT #{BLANK_HDR} Section

Inline Reference to Footnoted Reference to Inline Reference with Text to text Footnoted Reference with Text to text Anchored Crossreference to other document

OUTPUT end it "processes bibliographic anchors" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} [bibliography] == Normative References * [[[ISO712,x]]] Reference * [[[ISO713]]] Reference INPUT #{BLANK_HDR} Normative References

The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Reference x Reference ISO713 713
OUTPUT end it "processes footnotes" do expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} Hello!footnote:[Footnote text] == Title footnote:[Footnote text 2] Hello.footnote:abc[This is a repeated footnote] Repetition.footnote:abc[] INPUT #{BLANK_HDR} Foreword

Hello!

Footnote text

Title<fn reference="2"> <p id="_">Footnote text 2</p> </fn>

Hello.

This is a repeated footnote

Repetition.

This is a repeated footnote

OUTPUT end it "processes index terms" do expect((strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to (<<~"OUTPUT") #{ASCIIDOC_BLANK_HDR} ((See)) Index ((_term_)) and(((A, B, C))). INPUT #{BLANK_HDR}

See Index term and.

OUTPUT end end