metanorma / stepmod-utils

Tools for working on the STEPmod repository.
1 stars 0 forks source link

Add logging for equations containing bold and italics #229

Closed HassanAkbar closed 9 months ago

HassanAkbar commented 9 months ago

@HassanAkbar , I am concerned that if we remove the bold and italics in equations during translation, the maintainers of the standard will not be able to put them back in if they want to.

It is also the case that some current equations will work when translated to AsciiMath and MathML, and some will not; I think we would be adding value to ISO-10303 if we track them.

It also needs to be said that Metanorma follows the MathML default of italics for variables, and additional settings will be needed to default to plain instead of italics for variables, as seems to be implied in the current formulas. This is feasible as a setting, but it will not happen out of the box.

I propose the following course of action, @HassanAkbar ; @ronaldtse has already approved it (at least in principle):

  1. Log all equations encountered containing boldface and italics, during translation of Express to Asciidoc, in a file that maintainers can access, with the following content:

To do that validation, you will do what I am already doing in https://github.com/metanorma/metanorma-standoc/blob/f25f7d10f2c42c0772207a9104e02aa90a17648c/lib/metanorma/standoc/validate.rb#L34 ; I've changed the code to match what you will be doing.

     def math_validate(expr)
          Plurimath::Math.parse(expr, "asciimath").to_mathml
        rescue StandardError => e
          math_validate_error(math, m, e)
      end

So we take the asciimath, parse it into Plurimath's internal representation, and then generate MathML (as Metanorma eventually will). If something blows up in either stage, we want to know about it, because it points to a problem in the formula.

Originally posted by @opoudjis in https://github.com/metanorma/stepmod-utils/issues/191#issuecomment-1817464353

opoudjis commented 9 months ago

The request to strip hyperlinks inside equations in #227 makes this even more necessary.

TRThurman commented 9 months ago

If we put the link in the where clause, italics for variables seems ok to me.