On 8/12/13, Daniel Barrett <d...@vistaprint.com> wrote: > The MediaWiki API seems to add paragraph tags when it parses wikitext, but > only sometimes. Example: > > http://www.mediawiki.org/w/api.php?action=parse&page=Extension:Header/version&format=json&prop=text > > This page (Extension:Header/version) contains only the text "1.0" but gets > turned into "<p>1.0</p>" when parsed via API. On the other hand, the <p> > tag is absent if you transclude {{Extension:Header/version}} into another > wiki article. > > This doesn't happen if your wiki page contains just a table, so something > tricky is going on here. :-) > > Is there a way to make api.php suppress the <p> tag in my first example? > > Thanks, > DanB > > > > _______________________________________________ > Wikitech-l mailing list > Wikitech-l@lists.wikimedia.org > https://lists.wikimedia.org/mailman/listinfo/wikitech-l
If you just have the text "1.0" in the page, then that text is part of a paragraph. If you transclude the text to a middle of another page, then it might not be in the context of a paragraph (or be in the middle of one already begun). If its the first thing transcluded, you still get the <p>'s. If your article starts with a table, a table is a block element, and not text, so no paragraph. Basically, random text by itself forms a paragraph, so it gets marked with a <p> You can't really disable that. Certain places in mediawiki core regex out the "<p>" in places where it doesn't make sense (like Message::parse). --bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l