Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categorise messages sent to the console output #495

Closed
ghobona opened this issue Feb 10, 2023 · 10 comments
Closed

Categorise messages sent to the console output #495

ghobona opened this issue Feb 10, 2023 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@ghobona
Copy link

ghobona commented Feb 10, 2023

The message log should tag messages according to different categories, for example:

  • Informative notices (e.g. [relaton-iso] ("ISO 19101-1:2014") Found exact match.)
  • Warnings for Developers (e.g. Calling 'DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call 'DidYouMean.correct_error(error_name, spell_checker)' instead.)
  • Warnings for Editors (e.g. Metanorma XML Style Warning: (XML Line 000265): Hanging paragraph in clause)
  • Fatal Errors (i.e. those that cause compilation to abruptly end)
@opoudjis opoudjis self-assigned this Mar 5, 2023
@opoudjis opoudjis added the enhancement New feature or request label Mar 5, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Metanorma Mar 5, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Mar 5, 2023

Warnings for Developers

That particular one, I likely won't be able to intercept, it is straight out of Ruby proper.

All messages are categorised in the log that is generated, and I am wary of outputting too much to the screen; if anything, the syntax validation errors should probably go to log-only. But one-word categorisation is doable, although a big project, given the number of gems and that at least three developers are involved.

@opoudjis opoudjis moved this from 🆕 New to 🏕 Med priority in Metanorma Mar 5, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Sep 4, 2023

hyperlinked HTML rendering of log

@opoudjis opoudjis moved this from 🏕 Med priority to 🏔 High priority in Metanorma Sep 4, 2023
@ghobona
Copy link
Author

ghobona commented Sep 4, 2023

@opoudjis @ronaldtse Here is an example of a zip file containing example compliance test results.

The file ./result/index.html is created by parsing the xml file testlist.xml.

The HTML file, when rendered, presents a human friendly display of the results, whereas the XML file is aimed at applications.

A similar approach could be taken for the metanorma err file.

@opoudjis opoudjis moved this from 🏔 High priority to 🏗 In progress in Metanorma Sep 8, 2023
@opoudjis opoudjis moved this from 🏗 In progress to 🏔 High priority in Metanorma Sep 14, 2023
@opoudjis opoudjis moved this from 🏔 High priority to 🏗 In progress in Metanorma Oct 2, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Oct 2, 2023

Log errors can be reported, depending on where they are caught in processing, as:

  • Asciidoctor line, for errors caught before Asciidoctor is converted to XML
  • Asciidoctor section, for errors caught before Asciidoctor is converted to XML, where we cannot recover the line number
  • XML line, for schema errors
  • node ID, for errors caught after Asciidoctor is converted to XML

What we want for hyperlinked errors is node IDs: they convert readily to anchors.

We need to be able to convert XML line numbers to the preceding node ID.

We need to convert Asciidoctor Section titles to their corresponding node ID.

If at all possible, we also need to convert Asciidoctor line numbers to node IDs.

If we cannot generate HTML, we also need to have recourse to a log file incorporating Asciidoctor snippets.

@opoudjis
Copy link
Contributor

opoudjis commented Oct 2, 2023

There are 213 instances of errors being logged in Metanorma. (All of them are in the generation of Semantic XML, the downstream processing of Presentation XML does not generate much in the way of errors.)

94 of those errors are not associated with a location. Many of them could be, but it wasn't a priority with text files.

One error is the XML schema validation, referencing the XML line.

4 operate on raw Asciidoctor.

The rest are generated from XML, and invoke node ids.

So only five log entries need to be modified to generate linkable anchors.

@opoudjis
Copy link
Contributor

opoudjis commented Oct 3, 2023

XML schema validation: adding to log message the XML line where the error is, and the nearest node id for hyperlinking in the HTML. (Nil, if the error occurs before any node anchors, e.g. in bibdata.)

@opoudjis
Copy link
Contributor

opoudjis commented Oct 3, 2023

New problem: now that we are using IDs to link to errors, if we then process the text to get rid of the anchor, the link breaks. This happens in missing terms.

@opoudjis
Copy link
Contributor

opoudjis commented Oct 3, 2023

Ah, what's actually happening is that the content hash-based IDs for anchors are overwriting the IDs against which errors were reported. We need to pass the before and after anchors for all such cases to the log module, for mapping.

opoudjis added a commit to metanorma/metanorma-utils that referenced this issue Oct 3, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Oct 4, 2023

Edge case: huge long IDs need to be broken up, as we already do in tables in isodoc. Moving the relevant code from isodoc to metanorma-utils.

opoudjis added a commit to metanorma/metanorma-utils that referenced this issue Oct 4, 2023
opoudjis added a commit to metanorma/isodoc that referenced this issue Oct 4, 2023
@opoudjis
Copy link
Contributor

opoudjis commented Oct 4, 2023

I'm satisfied with where this has got to. @ghobona you might want to discuss the formatting in a new ticket, but I'm attaching a pair of the new, HTML-based error output and the HTML file it hyperlinks to.

Archive.zip

@opoudjis opoudjis closed this as completed Oct 4, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Metanorma Oct 4, 2023
opoudjis added a commit to metanorma/isodoc that referenced this issue Oct 9, 2023
opoudjis added a commit to metanorma/metanorma-standoc that referenced this issue Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants