mediawiki-templates

How escape pipe charachter in MediaWiki parser function?

99封情书 提交于 2021-02-11 06:10:45
问题 How do I escape a pipe character using a MediaWiki parser function? Replacing a backslash by a hyphen can be like this: {{#vardefine:varName|test\test\test}} {{#vardefine:varName2|{{#replace:{{#var:varName}}|\|-}}}} {{#var:varName2}} But replacing a pipe character ...? 回答1: Use the built-in magic word {{!}} instead of litteral pipes. 来源: https://stackoverflow.com/questions/62773762/how-escape-pipe-charachter-in-mediawiki-parser-function

Equals signs in Wikipedia template parameters won't display properly

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 16:38:29
问题 I've noticed that using links with equals signs in them doesn't seem to work properly (when the link is placed inside the {{missing information}} template). Is there any way to work around this limitation so that links with equals signs can be included inside MediaWiki templates? {{missing information|[https://www.google.com/search?q=google+search+test This link has an equals sign in it, and the template is not displaying properly.]}} {{missing information|[https://www.google.com/ This link

Equals signs in Wikipedia template parameters won't display properly

徘徊边缘 提交于 2020-01-03 16:37:08
问题 I've noticed that using links with equals signs in them doesn't seem to work properly (when the link is placed inside the {{missing information}} template). Is there any way to work around this limitation so that links with equals signs can be included inside MediaWiki templates? {{missing information|[https://www.google.com/search?q=google+search+test This link has an equals sign in it, and the template is not displaying properly.]}} {{missing information|[https://www.google.com/ This link

Where can I get templates for MediaWiki?

浪尽此生 提交于 2019-12-20 11:41:40
问题 I have noticed that a lot of mediawiki-based websites use such templates as Robelbox, Ambox etc. Where can I get them and how should they be installed? 回答1: It's a PITA and unfortunately (unlike extensions or media files) there is no repository of canned templates. Templates load other templates which load others in turn, etc. Go to Wikipedia and copy the name of the template you're after, go to Special:Export and paste the name of the template in the big text box, e.g. Template:Infobox.

regex to match up to first occurrence of

偶尔善良 提交于 2019-12-14 01:55:01
问题 I have this text: {{Infobox Item |name = value |prop2 = value |prop3 = value }} it's from a mediawiki template. i have the following regex: preg_match('/\{\{Infobox Item.+\\n\}\}\\n/s', $text, $ra); I'm using PHP. I want to match the from {{Infobox Item up to the first occurrence of }} which is always going to be on a line by itself. The above regex will match from {{Infobox Item to the end of another {{ }} style block, which isn't what I want. How can I achieve this? 回答1: Code preg_match('/{

MediaWiki custom skin: check if current page is main page

你。 提交于 2019-12-13 15:27:38
问题 I'm setting up a bunch of different language mediawiki's on one codebase. So far most of it is working, but I want to use a main page that looks different than the rest of the pages. To do this I originally just added some css rules that only applied to the main_page class: body .page-Main_Page { <rules> } The problem is that in other languages the main page is called differently (and the class changes accordingly), so I either have to add css rules for all possible main page titles (not

wikimedia api getting relavant data from json string

独自空忆成欢 提交于 2019-12-12 02:19:58
问题 This is the question I asked yesterday. I was able to get the required data. The final data is like this. Please follow this link. I tried with the following code to get all the infobox data content = content.split("}}\n"); for(k in content) { if(content[k].search("Infobox")==2) { var infobox = content[k]; alert(infobox); infobox = infobox.replace("{{",""); alert(infobox); infobox = infobox.split("\n|"); //alert(infobox[0]); var infohtml=""; for(l in infobox) { if(infobox[l].search("=")>0) {

Passing an equal sign ('=') to a parameter in a MediaWiki template

自作多情 提交于 2019-12-06 17:04:17
问题 How can I use a '=' character in a template parameter without breaking the template parser? I'm not a MediaWIKI developer so I haven't debugged the code or checked the logs, I'm hoping someone here has a tip for escaping characters passed to templates. Create a template called "Test" with this content: {{{1}}} Like this: {{ Test | R = 3/(2-(1+1)) }} Will render {{{1}}} instead of the complex formula! I've determined the '=' character is the culprit. 回答1: If a MediaWiki template parameter

Passing an equal sign ('=') to a parameter in a MediaWiki template

柔情痞子 提交于 2019-12-04 22:43:08
How can I use a '=' character in a template parameter without breaking the template parser? I'm not a MediaWIKI developer so I haven't debugged the code or checked the logs, I'm hoping someone here has a tip for escaping characters passed to templates. Create a template called "Test" with this content: {{{1}}} Like this: {{ Test | R = 3/(2-(1+1)) }} Will render {{{1}}} instead of the complex formula! I've determined the '=' character is the culprit. If a MediaWiki template parameter string contains an equals sign, everything before the sign is taken to be the name of the parameter. If it does

Where can I get templates for MediaWiki?

六月ゝ 毕业季﹏ 提交于 2019-12-03 01:41:51
I have noticed that a lot of mediawiki-based websites use such templates as Robelbox, Ambox etc. Where can I get them and how should they be installed? It's a PITA and unfortunately (unlike extensions or media files) there is no repository of canned templates. Templates load other templates which load others in turn, etc. Go to Wikipedia and copy the name of the template you're after, go to Special:Export and paste the name of the template in the big text box, e.g. Template:Infobox. Check "Include templates" and check "Include only the current revision, not the full history", (or the file will