require "spec_helper"
describe Asciidoctor::RFC::V3::Converter do
it "renders a table" do
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
== Section 1
[[id]]
[options="footer"]
.Table Title
|===
|[[id]] head | head
h|header cell | body cell
| | body cell
2+| colspan of 2
.2+|rowspan of 2 | cell
|cell
^|centre aligned cell | cell
<|left aligned cell | cell
>|right aligned cell | cell
|foot | foot
|===
INPUT
Section 1
Table Title
head |
head |
header cell |
body cell |
|
body cell |
colspan of 2 |
rowspan of 2 |
cell |
cell |
centre aligned cell |
cell |
left aligned cell |
cell |
right aligned cell |
cell |
foot |
foot |
OUTPUT
end
it "ignores cell anchors in a table" do
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
== Section 1
[[id]]
.Table Title
|===
|[[id]] head | head
h|header cell | body cell
| | [[id]] body cell
2+| colspan of 2
.2+|rowspan of 2 | cell
|cell
^|centre aligned cell | cell
<|left aligned cell | cell
>|right aligned cell | cell
|foot | foot
|===
INPUT
Section 1
Table Title
head |
head |
header cell |
body cell |
|
body cell |
colspan of 2 |
rowspan of 2 |
cell |
cell |
centre aligned cell |
cell |
left aligned cell |
cell |
right aligned cell |
cell |
foot |
foot |
OUTPUT
end
it "renders inline formatting within a table" do
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
== Section 1
.Table Title
|===
|head | head
h|header cell | *body* _cell_
| | body cell<>
^|centre aligned cell | cell
<|left aligned cell | cell
>|right aligned cell | cell
|foot | foot
|===
INPUT
Section 1
Table Title
head |
head |
header cell |
body cell |
|
body cell |
centre aligned cell |
cell |
left aligned cell |
cell |
right aligned cell |
cell |
foot |
foot |
OUTPUT
end
it "renders block formatting within a table" do
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
= Document title
:docName:
Author
== Section 1
[cols="2"]
.Table Title
|===
|head | head
h|header cell
a|
* List 1
* List 2
| | body cell<>
^|centre aligned cell | cell
<|left aligned cell | cell
>|right aligned cell | cell
|foot | foot
|===
INPUT
Section 1
Table Title
head |
head |
header cell |
|
|
body cell |
centre aligned cell |
cell |
left aligned cell |
cell |
right aligned cell |
cell |
foot |
foot |
OUTPUT
end
it "renders a table with no header row" do
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
= Document title
Author
== Section 1
[[id]]
.Table Title
|===
h|header cell | body cell
| | body cell
2+| colspan of 2
.2+|rowspan of 2 | cell
|cell
^|centre aligned cell | cell
<|left aligned cell | cell
>|right aligned cell | cell
|foot | foot
|===
INPUT
Section 1
Table Title
header cell |
body cell |
|
body cell |
colspan of 2 |
rowspan of 2 |
cell |
cell |
centre aligned cell |
cell |
left aligned cell |
cell |
right aligned cell |
cell |
foot |
foot |
OUTPUT
end
end