asciidoctor / asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
MIT License
50 stars 45 forks source link

Problem with latexmath within table #90

Closed tkx68 closed 3 years ago

tkx68 commented 3 years ago

When rendering the following table I get the below error. When I remove the lines with the latexmath the remaining document is rendered correctly.

[cols=",,,,",options="header",]
|============================================================================================
|Entity |Field |Data type |Article CRR |Notes
|Split exposure |Asset-ID |Text | |
| |CA-ID |Text | |
| |Guarantee-ID |Text | |
| |Portion number |Nat | |
| |Exposure-ID |Text | |
| |Maturity haircut latexmath:[H_M] |Double | |
| |Currency haircut latexmath:[H_{FX}] |Double |224, 227 |
| |Liquidation period |Double |225 (2) b |
| |Collateral volatility adjustment latexmath:[H_C] |Double |224, 227 |
| |Volatility adjustment latexmath:[H_E] |Double |223 (6) – (7), 224 table 1-3 |
| |Volatility adjusted exposure latexmath:[E_{VA}] |Double |223 (3) |
| |Volatility adjusted collateral value latexmath:[C_{VA}] |Double |223 (2), 193 (5) – (6), 231 |Separately calculated for parts of an exposure accordint to Art. 193 (5) and (6) for the CSA and Art. 231 for the IRBA.
| |Volatility and maturity adjusted collateral value (aka “the collateral value”) latexmath:[C_{VAM}] |Double |223 (2), 193 (5) – (6), 231, 239 |Separately calculated for parts of an exposure accordint to Art. 193 (5) and (6) for the CSA and Art. 231 for the IRBA.
| |Fully adjusted exposure value E* |Double |223 (5) |
| |Required minimum collateralization level of the exposure C* |Double |230 table 5 |
| |Upper bound to collateralization C** |Double |230 table 5 |
| |Effective LGD* |Double |228 (2) |
|============================================================================================
tkx@ubuntu:/media/psf/Home/devel/hcob-collateral$ asciidoctor -r asciidoctor-diagram -r asciidoctor-mathematical -o docs/README.html README.adoc && firefox docs/README.html 
asciidoctor: FAILED: /media/psf/Home/devel/hcob-collateral/README.adoc: Failed to load AsciiDoc document - undefined method `lines=' for #<Asciidoctor::Table::Cell:0x00005590a2560760>
Did you mean?  lines
               lineno
  Use --trace for backtrace

The trace gives the following:

tkx@ubuntu:/media/psf/Home/devel/hcob-collateral$ asciidoctor --trace -r asciidoctor-diagram -r asciidoctor-mathematical -o docs/README.html README.adoc && firefox docs/README.html 
Traceback (most recent call last):
        18: from /usr/local/bin/asciidoctor:23:in `<main>'
        17: from /usr/local/bin/asciidoctor:23:in `load'
        16: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        15: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        14: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        13: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        12: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        11: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        10: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
         9: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
         8: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
         7: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
         6: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
         5: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
         4: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
         3: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:42:in `process'
         2: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:42:in `each'
         1: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:43:in `block in process'
/var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:115:in `handle_prose_block': undefined method `lines=' for #<Asciidoctor::Table::Cell:0x0000556dfa8dc800> (NoMethodError)
Did you mean?  lines
               lineno
        18: from /usr/local/bin/asciidoctor:23:in `<main>'
        17: from /usr/local/bin/asciidoctor:23:in `load'
        16: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/bin/asciidoctor:15:in `<top (required)>'
        15: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `invoke!'
        14: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:111:in `each'
        13: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/cli/invoker.rb:128:in `block in invoke!'
        12: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `convert_file'
        11: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `open'
        10: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:183:in `block in convert_file'
         9: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/convert.rb:78:in `convert'
         8: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/load.rb:83:in `load'
         7: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `parse'
         6: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:555:in `each'
         5: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `block in parse'
         4: from /var/lib/gems/2.7.0/gems/asciidoctor-2.0.10/lib/asciidoctor/document.rb:556:in `[]'
         3: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:42:in `process'
         2: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:42:in `each'
         1: from /var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:43:in `block in process'
/var/lib/gems/2.7.0/gems/asciidoctor-mathematical-0.3.4/lib/asciidoctor-mathematical/extension.rb:115:in `handle_prose_block': asciidoctor: FAILED: /media/psf/Home/devel/hcob-collateral/README.adoc: Failed to load AsciiDoc document - undefined method `lines=' for #<Asciidoctor::Table::Cell:0x0000556dfa8dc800> (NoMethodError)
Did you mean?  lines
               lineno

I use asciidoctor version 2.0.10:

tkx@ubuntu:/media/psf/Home/devel/hcob-collateral$ asciidoctor --version
Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

I use Ubuntu 20.04.

fniu commented 3 years ago

I have exactly the same issue. Strangely it works on my old machine Ubuntu 18.04, with:

Asciidoctor 2.0.10 [https://asciidoctor.org]
Runtime Environment (ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)
ProgramFan commented 3 years ago

I think we need a refactor to this extension to resolve all these issues. Who will volunteer time for it?

mojavelinux commented 3 years ago

It appears this extension was relying on an internal API that was removed. I'll have look.

mojavelinux commented 3 years ago

This is a duplicate of #61. It also happens for asciimath in a table cell.