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

Local build error for translated-content (macro parsing / h2m macro calls conversion incl. JSON / arrays) #4744

Closed
Tracked by #5127 ...
SphinxKnight opened this issue Oct 4, 2021 · 9 comments
Labels
🐛 bug Something isn't working, or isn't working as expected p4 Not urgent, only if time allows 🚉 platform keeping the platform healthy

Comments

@SphinxKnight
Copy link
Member

Steps to reproduce

  1. Fetch yari or mdn/content
  2. yarn install / yarn start
  3. Try to navigate to localhost:5000/fr/docs/Web/HTML/Element

Actual result

Build error / cf https://github.com/mdn/translated-content/runs/3787142211

Expected result

Build is OK as per production: https://developer.mozilla.org/fr/docs/Web/HTML/Element

Notes

@SphinxKnight
Copy link
Member Author

When trying to minimize the case, I can see that this is not due to the French/locale content on the side but rather the presence of

{{HTMLRefTable({"include":\["HTML embedded content"], "exclude":\["multimedia"]})}}

cf. https://github.com/mdn/content/blob/main/files/en-us/web/html/element/index.md?plain=1#L63

@SphinxKnight
Copy link
Member Author

SphinxKnight commented Oct 4, 2021

When looking for this form of macro call, I'm seeing it only for this doc (over the whole docset which is mdn/content). I'm going to submit a PR to remove the escape which breaks the parser.

Note to self: I used this regexp \{\{.*?\\\[.*?\}\}

@escattone
Copy link
Contributor

@SphinxKnight Thank you so much for digging into this, much appreciated! ❤️

@SphinxKnight
Copy link
Member Author

Well, now I think the parser did its job and it's more a "html2md" conversion side effect. I'll try to figure out a PR here to fix the root cause. I would that the probability of this happening again is quite small given the major sections of mdn/content have been converted to markdown and I could find only one occurrence.

💀 to old KS macros

@SphinxKnight SphinxKnight changed the title Local build error for translated-content (macro parsing) Local build error for translated-content (macro parsing / h2m macro calls conversion incl. JSON / arrays) Oct 4, 2021
SphinxKnight added a commit to SphinxKnight/translated-content that referenced this issue Oct 13, 2021
SphinxKnight added a commit to mdn/translated-content that referenced this issue Nov 7, 2021
@schalkneethling
Copy link

Well, now I think the parser did its job and it's more a "html2md" conversion side effect. I'll try to figure out a PR here to fix the root cause. I would that the probability of this happening again is quite small given the major sections of mdn/content have been converted to markdown and I could find only one occurrence.

💀 to old KS macros

I am wondering though, would this be worth digging into for other localization communities? We are probably going to activate es soon and if there is a bug in the html2md tool then they are bound to run into it. Perhaps I misunderstand though so, let me know if this is actually not a problem anymore. Thanks!

@schalkneethling schalkneethling added 🐛 bug Something isn't working, or isn't working as expected 🚉 platform keeping the platform healthy labels Dec 31, 2021
@SphinxKnight
Copy link
Member Author

@schalkneethling as far as I can tell, this issue is still valid. I'll (try to) reproduce in the day and will update here.

@schalkneethling
Copy link

@schalkneethling as far as I can tell, this issue is still valid. I'll (try to) reproduce in the day and will update here.

Great! Thanks, @SphinxKnight

@SphinxKnight
Copy link
Member Author

@schalkneethling here is the status of local checks with fresh repos (2cb8c53 for mdn/content and 8748d8c for mdn/translated-content, ae33b02 for mdn/yari)

  • Build errors

    • (reproduced) Build error for localized content based on English content, the latter having incorrectly escaped content : When adding {{HTMLRefTable({"include":\["HTML embedded content"], "exclude":\["multimedia"]})}} in ./content/files/en-us/web/html/element/index.md and after running node build/cli.js -l fr /web/html/element/index.md, I get an error (namely error: Expected "-", "0", "[", "\"", "false", "null", "true", "{", [ \t\n\r;], or [1-9] but "\\" found.).

    • (reproduced) Build error for localized content when incl. bad escape sequences: when introducing {{HTMLRefTable({"include":\["HTML embedded content"], "exclude":\["multimedia"]})}} in ./translated-content/files/fr/web/html/element/index.md it fails as well

  • Converter behavior

Hope this helps :)

@schalkneethling
Copy link

Hey @SphinxKnight,

Thank you again for all of the information you provided here. This is indeed an issue that needs to be addressed but, we do not currently have the availability to dissect and address this properly. Seeing that so much of the content has already been converted, this always seems like something that is not going to come up a lot. As such, we are going to close this for now but, should someone in the community want to take on this issue, please let us know and we will happily reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or isn't working as expected p4 Not urgent, only if time allows 🚉 platform keeping the platform healthy
Projects
Development

No branches or pull requests

3 participants