CatalaLang/catleg

Spurious '\' characters in diff

Closed this issue · 4 comments

In the Catala-IR project, some articles of the Code général des impôts have a problem when comparing the material in the Catala file with LegiFrance. More specifically, two \ signs are added after dates corresponding to references to law in two different articles : https://gitlab.adullact.net/dgfip/ir-catala/-/jobs/246240. If you try adding an extra \ in the Catala file, the diff now says that there isn't any \ in LégiFrance.

This is annoying because it pollutes the diff, but not critical.

Hi @denismerigoux , after looking a little bit into it, I would argue that this behavior may be correct.

We are using CommonMark as our Markdown flavor in catleg, and it states that punctuation characters may be backslash-escaped.

In this instance, mdformat escaped a dot after a number literal at the beginning of a line, because otherwise it may be interpreted as a numbered list item.

So, a solution would be to either escape the dot in the catala source (for instance catleg article LEGIARTI000044983201 will output an article with the final dot escaped, as "2023." is on its own line), or slightly reformat the article in the catala source if it is deemed more legible by users? (for instance if we reformat cgi_revenus.catala_fr to put "1er janvier 2023." instead of "2023." on line 277, the spurious diff disappears)

What do you think?

Ooooh, interesting. Yes definitely we should simply reformat cgi_revenus.catala_fr to put "1er janvier 2023." instead of "2023." on line 277, and similar edits, that's the simplest solution.

Great, I'm closing this issue then.