diff options
| author | Marat Radchenko <marat@slonopotamus.org> | 2020-07-03 18:38:38 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-03 18:38:38 +0300 |
| commit | dd39e5e34c455262f568424084b199142973127c (patch) | |
| tree | 2e1e4f2203a08b04a5dcbfb800c5dd9a3fe55be7 /spec | |
| parent | 79ea7e7d8b1ca01b0d93fe307b0b1fd2b5aa22f0 (diff) | |
resolves #10 add support for MathML via AsciiMath (#346)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/fixtures/inline-stem.adoc (renamed from spec/fixtures/inline-stem/chapter.adoc) | 3 | ||||
| -rw-r--r-- | spec/fixtures/inline-stem/book.adoc | 4 | ||||
| -rw-r--r-- | spec/fixtures/stem.adoc | 6 | ||||
| -rw-r--r-- | spec/fixtures/stem/book.adoc | 4 | ||||
| -rw-r--r-- | spec/fixtures/stem/chapter.adoc | 6 | ||||
| -rw-r--r-- | spec/inline_quoted_spec.rb | 8 | ||||
| -rw-r--r-- | spec/stem_spec.rb | 20 |
7 files changed, 20 insertions, 31 deletions
diff --git a/spec/fixtures/inline-stem/chapter.adoc b/spec/fixtures/inline-stem.adoc index e09a718..9855599 100644 --- a/spec/fixtures/inline-stem/chapter.adoc +++ b/spec/fixtures/inline-stem.adoc @@ -1,3 +1,4 @@ -= Chapter += Article +:stem: asciimath Inline stem: stem:[y=x^2 sqrt(4)] diff --git a/spec/fixtures/inline-stem/book.adoc b/spec/fixtures/inline-stem/book.adoc deleted file mode 100644 index 4a03ba9..0000000 --- a/spec/fixtures/inline-stem/book.adoc +++ /dev/null @@ -1,4 +0,0 @@ -= Inline stem book -:doctype: book - -include::chapter.adoc[leveloffset=+1] diff --git a/spec/fixtures/stem.adoc b/spec/fixtures/stem.adoc new file mode 100644 index 0000000..8eeebd3 --- /dev/null +++ b/spec/fixtures/stem.adoc @@ -0,0 +1,6 @@ += Article + +[asciimath,title=Math] +++++ +y=x^2 sqrt(4) +++++ diff --git a/spec/fixtures/stem/book.adoc b/spec/fixtures/stem/book.adoc deleted file mode 100644 index 7aef7f5..0000000 --- a/spec/fixtures/stem/book.adoc +++ /dev/null @@ -1,4 +0,0 @@ -= Stem book -:doctype: book - -include::chapter.adoc[leveloffset=+1] diff --git a/spec/fixtures/stem/chapter.adoc b/spec/fixtures/stem/chapter.adoc deleted file mode 100644 index 8b4949c..0000000 --- a/spec/fixtures/stem/chapter.adoc +++ /dev/null @@ -1,6 +0,0 @@ -= Chapter - -[latexmath] -++++ -\sqrt(4) = 2 -++++ diff --git a/spec/inline_quoted_spec.rb b/spec/inline_quoted_spec.rb index 68e500b..a292bc5 100644 --- a/spec/inline_quoted_spec.rb +++ b/spec/inline_quoted_spec.rb @@ -52,14 +52,6 @@ describe 'Asciidoctor::Epub3::Converter - Inline Quoted' do end end - context 'asciimath' do - let(:type) { :asciimath } - - it 'renders as code element' do - expect(subject).to eq('<code class="literal">text</code>') - end - end - context 'latexmath' do let(:type) { :latexmath } diff --git a/spec/stem_spec.rb b/spec/stem_spec.rb index 33d2637..a5e3348 100644 --- a/spec/stem_spec.rb +++ b/spec/stem_spec.rb @@ -3,17 +3,21 @@ require_relative 'spec_helper' describe 'Asciidoctor::Epub3::Converter - Stem' do - it 'converts stem block to <pre>' do - book, = to_epub fixture_file('stem/book.adoc') - chapter = book.item_by_href '_chapter.xhtml' + it 'supports mathml stem blocks' do + book, = to_epub fixture_file('stem.adoc') + chapter = book.item_by_href 'stem.xhtml' expect(chapter).not_to be_nil - expect(chapter.content).to include '<pre>\sqrt(4) = 2</pre>' + expect(chapter.content).to include '<figcaption>Math</figcaption> +<div class="content"> +<mml:math><mml:mi>y</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup><mml:msqrt><mml:mn>4</mml:mn></mml:msqrt></mml:math> +</div> +</figure>' end - it 'converts inline stem to <code>' do - book, = to_epub fixture_file('inline-stem/book.adoc') - chapter = book.item_by_href '_chapter.xhtml' + it 'supports inline mathml' do + book, = to_epub fixture_file('inline-stem.adoc') + chapter = book.item_by_href 'inline-stem.xhtml' expect(chapter).not_to be_nil - expect(chapter.content).to include '<code class="literal">y=x^2 sqrt(4)</code>' + expect(chapter.content).to include 'Inline stem: <code class="literal"><mml:math><mml:mi>y</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mn>2</mml:mn></mml:msup><mml:msqrt><mml:mn>4</mml:mn></mml:msqrt></mml:math></code>' end end |
