Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves w3c/wai-website#481 (and also addresses w3c/wai-std-gl-overview#21)
Description of the problem
When link text is enclosed in double square brackets,
[[link_text]](/url/), we want the plugin to replace it with the title of the target resource, in the same language as the current page. When the target page has not been translated yet, we want the plugin to keep the link text that is between brackets.That is generally working, but sometimes, translators prefer to keep part of the link text in English. In this case, they add
<span lang="en"></span>markup in the link text.The plugin does not handle this case correctly.
Example raised in w3c/wai-website#481
[[Χρησιμοποιώντας Υλικά του <span lang='en'>WAI</span>: Άδεια Χρήσης με Απόδοση (<span lang='en'>Attribution</span>)]](/about/using-wai-material/)is rendered as:
Μπορείτε να χρησιμοποιήσετε αυτό το βίντεο εάν συμπεριλάβετε έναν σύνδεσμο προς αυτήν τη σελίδα. Περισσότερες πληροφορίες διατίθενται στο «Χρησιμοποιώντας Υλικά του WAI: Άδεια Χρήσης με Απόδοση (Attribution) (στα Αγγλικά)»(/WAI/about/using-wai-material/){: hreflang=”en”}.Instead of:
Χρησιμοποιώντας Υλικά του WAI: Άδεια Χρήσης με Απόδοση (Attribution) (στα Αγγλικά)
Technical side of the problem
Double brackets links are currently processed in 2 steps:
Step 1:
[[link_text]](/url/#fragment)is turned into
<<link_text ("in English" in the target language)>>(/WAI/url/#fragment){: hreflang="en"}wai-website-plugin/lib/wai-website-plugin.rb
Lines 31 to 39 in 4392f43
Step 2:
<<link_text ("in English" in the target language)>>(/WAI/url/#fragment){: hreflang="en"}is expected to be turned into
[link_text ("in English" in the target language)](/WAI/url/#fragment){: hreflang="en"}wai-website-plugin/lib/wai-website-plugin.rb
Lines 68 to 70 in 4392f43
Problem: the regular expression
/<<([^>>]+?)>>/itries to extract the link text but stops at first>character (the second>is superfluous). Including at first HTML tag.Solution
[In Progress]