Last modified: 2013-06-26 23:34:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T52209, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50209 - MediaWiki API's parse module not fully expanding a link
MediaWiki API's parse module not fully expanding a link
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.22.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-26 05:18 UTC by MZMcBride
Modified: 2013-06-26 23:34 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MZMcBride 2013-06-26 05:18:38 UTC
https://en.wikipedia.org/w/api.php?action=parse&text={{Wikipedia:Selected%20anniversaries/June%2026}}&disablepp=1&format=jsonfm

You are looking at the HTML representation of the JSON format.
HTML is good for debugging, but is unsuitable for application use.
Specify the format parameter to change the output format.
To see the non HTML representation of the JSON format, set format=json.
See the complete documentation, or API help for more information.
{
    "parse": {
        "title": "API",
        "text": {
            "*": "<p><b><a href=\"/wiki/June_26\" title=\"June 26\">June 26</a></b>: <b><a href=\"/wiki/International_Day_in_Support_of_Victims_of_Torture\" title=\"International Day in Support of Victims of Torture\">International Day in Support of Victims of Torture</a></b>; <a href=\"/wiki/List_of_national_independence_days\" title=\"List of national independence days\">Independence Day</a> in <b><a href=\"/wiki/Madagascar\" title=\"Madagascar\">Madagascar</a></b> (<a href=\"/wiki/1960\" title=\"1960\">1960</a>); <b><a href=\"/wiki/Flag_of_Romania\" title=\"Flag of Romania\">Flag Day</a></b> in Romania</p>\n<div style=\"float:right;margin-left:0.5em\">\n<div id=\"mwe_player_0\" class=\"PopUpMediaTransform\" style=\"width:100px;height:75px\" data-videopayload=\"&lt;div class=&quot;mediaContainer&quot; style=&quot;position:relative;display:block;width:320px&quot;&gt;&lt;video id=&quot;mwe_player_1&quot; style=&quot;width:320px;height:240px&quot; poster=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv/320px--Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv.jpg&quot; controls=&quot;&quot; preload=&quot;none&quot; autoplay=&quot;&quot; class=&quot;kskin&quot; data-durationhint=&quot;541.88408163265&quot; data-startoffset=&quot;0&quot; data-mwtitle=&quot;Ich_bin_ein_Berliner_Speech_(June_26,_1963)_John_Fitzgerald_Kennedy_trimmed.theora.ogv&quot; data-mwprovider=&quot;wikimediacommons&quot;&gt;&lt;source src=&quot;//upload.wikimedia.org/wikipedia/commons/transcoded/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv.360p.webm&quot; type=&quot;video/webm; codecs=&amp;quot;vp8, vorbis&amp;quot;&quot; transcodekey=&quot;360p.webm&quot; data-title=&quot;Web streamable WebM (360P)&quot; data-shorttitle=&quot;WebM 360P&quot; data-width=&quot;320&quot; data-height=&quot;240&quot; data-bandwidth=&quot;571472&quot; data-framerate=&quot;29.97002997003&quot; /&gt;&lt;source src=&quot;//upload.wikimedia.org/wikipedia/commons/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv&quot; type=&quot;video/ogg; codecs=&amp;quot;theora, vorbis&amp;quot;&quot; data-title=&quot;Original Ogg file, 320 \u00d7 240 (586 kbps)&quot; data-shorttitle=&quot;Ogg source&quot; data-width=&quot;320&quot; data-height=&quot;240&quot; data-bandwidth=&quot;585523&quot; data-framerate=&quot;29.97002997003&quot; /&gt;&lt;track kind=&quot;subtitles&quot; data-mwtitle=&quot;TimedText:Ich_bin_ein_Berliner_Speech_(June_26,_1963)_John_Fitzgerald_Kennedy_trimmed.theora.ogv.en.srt&quot; data-mwprovider=&quot;wikimediacommons&quot; type=&quot;text/x-srt&quot; src=&quot;//commons.wikimedia.org/w/index.php?title=:Ich+bin+ein+Berliner+Speech+(June+26,+1963)+John+Fitzgerald+Kennedy+trimmed.theora.ogv.en.srt&amp;amp;action=raw&amp;amp;ctype=text/x-srt&quot; srclang=&quot;en&quot; data-dir=&quot;ltr&quot; label=&quot;English (en) subtitles&quot; /&gt;Sorry, your browser either has JavaScript disabled or does not have any supported player.&lt;br /&gt;\nYou can &lt;a href=&quot;//upload.wikimedia.org/wikipedia/commons/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv&quot;&gt;download the clip&lt;/a&gt; or &lt;a href=&quot;//www.mediawiki.org/wiki/Extension:TimedMediaHandler/Client_download&quot;&gt;download a player&lt;/a&gt; to play the clip in your browser.&lt;/video&gt;&lt;/div&gt;\"><img alt=\"File:Ich bin ein Berliner Speech (June 26, 1963) John Fitzgerald Kennedy trimmed.theora.ogv\" style=\"width:100px;height:75px\" src=\"//upload.wikimedia.org/wikipedia/commons/thumb/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv/100px--Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv.jpg\" /><a href=\"//upload.wikimedia.org/wikipedia/commons/1/15/Ich_bin_ein_Berliner_Speech_%28June_26%2C_1963%29_John_Fitzgerald_Kennedy_trimmed.theora.ogv\" title=\"Play media\" target=\"new\"><span class=\"play-btn-large\">&#160;</span></a></div>\n</div>\n<ul>\n<li style=\"-moz-float-edge: content-box\"><a href=\"/wiki/1886\" title=\"1886\">1886</a> \u2013 French chemist <a href=\"/wiki/Henri_Moissan\" title=\"Henri Moissan\">Henri Moissan</a> reported he was able to successfully isolate elemental <b><a href=\"/wiki/Fluorine\" title=\"Fluorine\">fluorine</a></b>, for which he later won the <a href=\"/wiki/Nobel_Prize_in_Chemistry\" title=\"Nobel Prize in Chemistry\">Nobel Prize in Chemistry</a>.</li>\n<li style=\"-moz-float-edge: content-box\"><a href=\"/wiki/1906\" title=\"1906\">1906</a> \u2013 The <b><a href=\"/wiki/1906_French_Grand_Prix\" title=\"1906 French Grand Prix\">1906 French Grand Prix</a></b>, the first <a href=\"/wiki/Grand_Prix_motor_racing\" title=\"Grand Prix motor racing\">Grand Prix motor racing</a> competition, was held outside <a href=\"/wiki/Le_Mans\" title=\"Le Mans\">Le Mans</a>.</li>\n<li style=\"-moz-float-edge: content-box\"><a href=\"/wiki/1907\" title=\"1907\">1907</a> \u2013 Organised by <a href=\"/wiki/Vladimir_Lenin\" title=\"Vladimir Lenin\">Vladimir Lenin</a> and <a href=\"/wiki/Joseph_Stalin\" title=\"Joseph Stalin\">Joseph Stalin</a>, among others, <a href=\"/wiki/Bolshevik\" title=\"Bolshevik\">Bolshevik</a> revolutionaries in <a href=\"/wiki/Tbilisi\" title=\"Tbilisi\">Tiflis</a>, Georgia, <b><a href=\"/wiki/1907_Tiflis_bank_robbery\" title=\"1907 Tiflis bank robbery\">robbed a bank stagecoach</a></b>, getting away with 341,000 <a href=\"/wiki/Ruble\" title=\"Ruble\">rubles</a>.</li>\n<li style=\"-moz-float-edge: content-box\"><a href=\"/wiki/1963\" title=\"1963\">1963</a> \u2013 <a href=\"/wiki/President_of_the_United_States\" title=\"President of the United States\">U.S. President</a> <a href=\"/wiki/John_F._Kennedy\" title=\"John F. Kennedy\">John F. Kennedy</a> gave his \"<i><b>[[Ich bin ein Berliner|<span lang=\"de\" xml:lang=\"de\">Ich bin ein Berliner</span>]]</b></i>\" speech <i>(video featured)</i>, underlining the support of the United States for <a href=\"/wiki/Democracy\" title=\"Democracy\">democratic</a> <a href=\"/wiki/West_Germany\" title=\"West Germany\">West Germany</a> shortly after Soviet-supported <a href=\"/wiki/East_Germany\" title=\"East Germany\">East Germany</a> erected the <a href=\"/wiki/Berlin_Wall\" title=\"Berlin Wall\">Berlin Wall</a>.</li>\n<li style=\"-moz-float-edge: content-box\"><a href=\"/wiki/2003\" title=\"2003\">2003</a> \u2013 The <a href=\"/wiki/Supreme_Court_of_the_United_States\" title=\"Supreme Court of the United States\">U.S. Supreme Court</a> delivered its decision in <i><b><a href=\"/wiki/Lawrence_v._Texas\" title=\"Lawrence v. Texas\">Lawrence v. Texas</a></b></i>, striking down <a href=\"/wiki/Sodomy_law\" title=\"Sodomy law\">sodomy laws</a> in the United States.</li>\n</ul>\n<p>More anniversaries: <span class=\"nowrap\"><a href=\"/wiki/June_25\" title=\"June 25\">June 25</a> \u2013</span> <span class=\"nowrap\"><b><a href=\"/wiki/June_26\" title=\"June 26\">June 26</a></b> \u2013</span> <span class=\"nowrap\"><a href=\"/wiki/June_27\" title=\"June 27\">June 27</a></span></p>\n<div style=\"text-align: right;\" class=\"noprint\"><span class=\"nowrap\"><b><a href=\"/wiki/Wikipedia:Selected_anniversaries/June\" title=\"Wikipedia:Selected anniversaries/June\">Archive</a></b> \u2013</span> <span class=\"nowrap\"><b><a href=\"https://lists.wikimedia.org/mailman/listinfo/daily-article-l\" class=\"extiw\" title=\"mail:daily-article-l\">By email</a></b> \u2013</span> <span class=\"nowrap\"><b><a href=\"/wiki/List_of_historical_anniversaries\" title=\"List of historical anniversaries\">List of historical anniversaries</a></b></span></div>\n<div style=\"text-align: right;\"><small>It is now <span class=\"nowrap\">June 26, 2013</span> (<a href=\"/wiki/Coordinated_Universal_Time\" title=\"Coordinated Universal Time\">UTC</a>) \u2013 <span class=\"plainlinks\" id=\"purgelink\"><span class=\"nowrap\"><a class=\"external text\" href=\"//en.wikipedia.org/w/index.php?title=API&amp;action=purge\">Reload this page</a></span></span></small></div>\n\n"
        },
        "langlinks": [

        ],
        "categories": [
            {
                "sortkey": "",
                "*": "Articles_containing_German-language_text"
            }
        ],
        "links": [
            {
                "ns": 0,
                "*": "June 26",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "International Day in Support of Victims of Torture",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "List of national independence days",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Madagascar",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1960",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Flag of Romania",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1886",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Henri Moissan",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Fluorine",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Nobel Prize in Chemistry",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1906",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1906 French Grand Prix",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Grand Prix motor racing",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Le Mans",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1907",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Vladimir Lenin",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Joseph Stalin",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Bolshevik",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Tbilisi",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1907 Tiflis bank robbery",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Ruble",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "1963",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "President of the United States",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "John F. Kennedy",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Democracy",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "West Germany",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "East Germany",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Berlin Wall",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "2003",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Supreme Court of the United States",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Lawrence v. Texas",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Sodomy law",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "June 25",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "June 27",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "List of historical anniversaries",
                "exists": ""
            },
            {
                "ns": 0,
                "*": "Coordinated Universal Time",
                "exists": ""
            },
            {
                "ns": 4,
                "*": "Wikipedia:Selected anniversaries/June",
                "exists": ""
            }
        ],
        "templates": [
            {
                "ns": 4,
                "*": "Wikipedia:Selected anniversaries/June 26",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:*mp",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Lang",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Category handler",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Category handler/blacklist",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:If pagename",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Category handler/numbered",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Namespace detect",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:SelAnnivFooter",
                "exists": ""
            },
            {
                "ns": 10,
                "*": "Template:Nowrap",
                "exists": ""
            },
            {
                "ns": 828,
                "*": "Module:Namespace detect",
                "exists": ""
            }
        ],
        "images": [
            "Ich_bin_ein_Berliner_Speech_(June_26,_1963)_John_Fitzgerald_Kennedy_trimmed.theora.ogv"
        ],
        "externallinks": [

        ],
        "sections": [

        ],
        "displaytitle": "API",
        "iwlinks": [
            {
                "prefix": "mail",
                "url": "https://lists.wikimedia.org/mailman/listinfo/daily-article-l",
                "*": "mail:daily-article-l"
            }
        ],
        "properties": [

        ]
    }
}
Comment 1 MZMcBride 2013-06-26 05:19:44 UTC
So buried up there is the string:

---
<a href=\"/wiki/John_F._Kennedy\" title=\"John F. Kennedy\">John F. Kennedy</a> gave his \"<i><b>[[Ich bin ein Berliner|<span lang=\"de\" xml:lang=\"de\">Ich bin ein Berliner</span>]]</b></i>\" speech <i>(video featured)</i>
---

You can see the "[[" and "]]" and "|" in there. As far as I know, the parse module should fully expand the wikitext into HTML. Not sure what's going on here.
Comment 2 MZMcBride 2013-06-26 05:24:08 UTC
"'''''[[Ich bin ein Berliner|{{lang|de|Ich bin ein Berliner}}]]'''''"

Ich%20bin%20ein%20Berliner|{{lang|de|Ich%20bin%20ein%20Berliner}}]]'''''%22&disablepp=1&format=jsonfm">https://en.wikipedia.org/w/api.php?action=parse&text=%22'''''[[Ich%20bin%20ein%20Berliner|{{lang|de|Ich%20bin%20ein%20Berliner}}]]'''''%22&disablepp=1&format=jsonfm

"text": {
            "*": "<p>\"<i><b>[[Ich bin ein Berliner|<span lang=\"de\" xml:lang=\"de\">Ich bin ein Berliner</span>]]</b></i>\"</p>\n\n"
        },

It seems it's something to do with the {{lang}} template being in the display text of the link.
Comment 3 MZMcBride 2013-06-26 05:26:00 UTC
From <view-source:https://en.wikipedia.org/wiki/Wikipedia:Selected_anniversaries/June_26>:

---
gave his "<i><b><a href="/wiki/Ich_bin_ein_Berliner" title="Ich bin ein Berliner"><span lang="de" xml:lang="de">Ich bin ein Berliner</span></a></b></i>" speech
---

This is the correct output. This bug is seemingly related to the API, not the parser.
Comment 4 Brad Jorsch 2013-06-26 14:07:02 UTC
The problem is that {{lang}}'s output includes a category link when it is transcluded in the main namespace; if you change your API link to specify a non-mainspace title, e.g. https://en.wikipedia.org/w/api.php?action=parse&text={{Wikipedia:Selected%20anniversaries/June%2026}}&disablepp=1&format=jsonfm&title=Wikipedia:Sandbox, then it works as expected. And conversely, if you take "[[Ich bin ein Berliner|{{lang|de|Ich bin ein Berliner}}]]" and paste it into a mainspace page then you will see the issue there.

I note this is already mentioned in the documentation for {{lang}}:
> This template also includes a categorisation link when used by main namespace
> pages, therefore it should not be included inside a wikilink. This error may
> not be immediately obvious if it is used via another template namespace page.
> If appropriate, the entire wikilink may be fed to the template instead:
> {{lang|ar|[[Arabic language|العربية]]}}.
Comment 5 MZMcBride 2013-06-26 23:34:28 UTC
This is pretty bizarre behavior, but thanks for the explanation.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links