-
Notifications
You must be signed in to change notification settings - Fork 128
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
[[:Category:Foo]] syntax #308
Comments
ah interesting. Thanks for the heads-up @Istador . I think we should support this. |
Updated code for wtf('pre [[Category:Foo]] post').sentences()[0].html()
wtf('pre [[:Category:Foo]] post').sentences()[0].html()
wtf('pre [[Category:Foo|Bar]] post').sentences()[0].html()
wtf('pre [[:Category:Foo|Bar]] post').sentences()[0].html() Actual result: <span class="sentence">pre post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre post</span> Expected result: <span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./Category:Foo">Category:Foo</a> post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./Category:Foo">Bar</a> post</span>
wtf('pre [[File:Foo.png]] post').sentences()[0].html()
wtf('pre [[:File:Foo.png]] post').sentences()[0].html()
wtf('pre [[File:Foo.png|Bar]] post').sentences()[0].html()
wtf('pre [[:File:Foo.png|Bar]] post').sentences()[0].html() Actual result: <span class="sentence">pre post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre post</span> Expected result: <span class="sentence">pre <a class="link" href="./File:Foo.png">File:Foo.png</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">File:Foo.png</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">Bar</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">Bar</a> post</span> File syntax within tables also seems broken: wtf('{|\n|-\n|pre [[File:Foo.png]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[:File:Foo.png]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[File:Foo.png|Bar]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[:File:Foo.png|Bar]] post\n|}').tables()[0].data[0].col1.data.text Actual result: "pre [[File:Foo.png]] post"
"pre [[:File:Foo.png]] post"
"pre Foo.png post"
"Bar]] post" Expected result: "pre File:Foo.png post"
"pre File:Foo.png post"
"pre Bar post"
"pre Bar post" |
Thanks, I’ll check this out over the next few days |
hey Robin, thanks for the heads-up. bit of a rats-nest these interwiki links are. You're right - the parser changed slightly in 10.0.3 you can check the wikipedia sandbox to see how it behaves: yeah, the file syntax must have some special check in the wp parser. I'll check it out. |
oh wait, i'm wrong. You're correct. |
think I got this fixed in 10.1.0 - let me know? |
wtf('pre [[Category:Foo]] post').sentences()[0].html()
wtf('pre [[:Category:Foo]] post').sentences()[0].html()
wtf('pre [[Category:Foo|Bar]] post').sentences()[0].html()
wtf('pre [[:Category:Foo|Bar]] post').sentences()[0].html()
wtf('pre [[File:Foo.png]] post').sentences()[0].html()
wtf('pre [[:File:Foo.png]] post').sentences()[0].html()
wtf('pre [[File:Foo.png|Bar]] post').sentences()[0].html()
wtf('pre [[:File:Foo.png|Bar]] post').sentences()[0].html()
wtf('{|\n|-\n|pre [[File:Foo.png]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[:File:Foo.png]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[File:Foo.png|Bar]] post\n|}').tables()[0].data[0].col1.data.text
wtf('{|\n|-\n|pre [[:File:Foo.png|Bar]] post\n|}').tables()[0].data[0].col1.data.text Actual result: <span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./:Category:Foo">Category:Foo</a> post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./:Category:Foo">Bar</a> post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./:File:Foo.png">File:Foo.png</a> post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./:File:Foo.png">Bar</a> post</span>
pre [[File:Foo.png]] post
pre File:Foo.png post
pre Foo.png post
pre Bar post Expected result: <span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./Category:Foo">Category:Foo</a> post</span>
<span class="sentence">pre post</span>
<span class="sentence">pre <a class="link" href="./Category:Foo">Bar</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">File:Foo.png</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">File:Foo.png</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">Bar</a> post</span>
<span class="sentence">pre <a class="link" href="./File:Foo.png">Bar</a> post</span>
pre File:Foo.png post
pre File:Foo.png post
pre Bar post
pre Bar post For reference the wiki preview: Based on this wikitext: pre [[Category:Foo]] post
pre [[:Category:Foo]] post
pre [[Category:Foo|Bar]] post
pre [[:Category:Foo|Bar]] post
pre [[File:Foo.png]] post
pre [[:File:Foo.png]] post
pre [[File:Foo.png|Bar]] post
pre [[:File:Foo.png|Bar]] post The I think it's subjectible what |
When using the normal link syntax for category pages inside an article
[[Category:Foo]]
, it doesn't add a link to the text, but adds the page to the category. Therefore it's okay to not parse them as part of the text.But there is a special special syntax with a colon in front that allows linking to category pages:
[[:Category:Foo]]
It can also be piped to change the visual text on the page:
[[:Category:Foo|Bar]]
.https://en.wikipedia.org/wiki/Help:Category#Linking_to_category_pages
wtf_wikipedia
doesn't support this syntax.Code:
Actual result:
Expected result:
The text was updated successfully, but these errors were encountered: