User:Lahwaacz/Notes

From ArchWiki
Jump to: navigation, search

Indenting multiline code blocks

MediaWiki does not support multiparagraph list items (and other complex scenarios):

Basically every newline character breaks the list. As a result, multiline code blocks using Template:bc cannot be used inside lists and cannot be indented using colons, unless the content is escaped using <nowiki> tags. Template:hc breaks completely, because the template itself contains a line break -- this is another hack, need to find reference for the The line break is needed, otherwise the wiki will generate extraneous paragraphs inside the 2nd pre block comment.

Another possible workaround is to use HTML-encoded characters, see [1].

Perhaps #tag:pre parser function could solve this? See [2].

API: resolving redirects

Goal: obtain a mapping of all redirect titles to their targets

Method 1: using the redirects parameter: mw:API:Query#Resolving_redirects

Works [3], but additional query is required to obtain list of redirect pages: [4].

Also note that the limit for pageids= parameter is lower than for the generator. Passing more page IDs at once will result only in warning and the limit number of pages will be returned (in random order).

Method 2: using generator=allpages along with prop=redirects. Make sure that limits are properly set (see the first method).

Unfortunately post-processing is required to transform the data to more sensible form, but all data is returned in one query per target namespace: [5].

Note: Specifying rdnamespace to any value results in internal database query error: [6].
{
    "error": {
        "code": "internal_api_error_DBQueryError",
        "info": "[15e71f58] Database query error"
    }
}
Removing rdnamespace fixes it [7], Wikipedia is completely fine: [8].

Method 3: using generator=allredirects (implemented at the same time as method 3, see T59057)

The idea is to use garunique parameter to generate target redirects pages instead of source redirects and prop=redirects to obtain further info on pages redirecting to these titles. This is less expensive than generator=allpages, but unfortunately broken with respect to interwiki redirects: T105234.

Documentation: mw:API:Allredirects

References:

blame mode

Parser

LanguageConverter

Mirroring a wiki

Templates

Fancy section headings

This is why styling section headings is forbidden by Help:Style:

Section with wikicode

Link: #Section with wikicode

Link: #Section with wikicode (invalid)

Section with tag

Link: #Section with tag

Link: [[#Section with tag]] (invalid)

Section with <it>invalid tag</it>

Link: #Section with <it>invalid tag</it>

Section with templateAUR

Link: #Section with templateAUR (depending on the template, the anchor could be much worse)

Section with wikilink

Link: #Section with wikilink

Section with <nowiki>

Link: #Section with .3Cnowiki.3E

Link: [[#Section with <nowiki>]]

Special symbols

Section with HTML entities Σ, Σ, and Σ

Link: #Section_with_HTML_entities_.CE.A3.2C_.CE.A3.2C_and_.CE.A3 (dot-encoded)

Link: #Section with HTML entities Σ, Σ, and Σ (percent-encoded)

Link: #Section with HTML entities Σ, Σ, and Σ (HTML entities)

Link: #Section with HTML entities Σ, Σ, and Σ (unicode symbols)

Section with [brackets]

Link: #Section with .5Bbrackets.5D

Link: #Section with [brackets]

Section with | pipe

Link: #Section with | pipe