I had just installed MediaWiki. What must I do to have wikipedia style templates like this: http://i.piccy.info/i4/4b/37/fe303fda0c813c0bda717d3a1e3b.png (example).
I have already installed ParserFunctions Extension on my MediaWiki CMS. I have tried to look source & copy it, but it didn't work. Thanks.
**sorry for my English (it isn't my native language)*
When you copied the source for that infobox, what you were missing was the template that the {{infobox}} tag uses, which you can find at the Wikipedia page for the Infobox template. (That page will show you the documentation on the template; View Source for the code you'll need to copy.)
If you want to use Wikipedia's templates, you'll need to copy them. (Observing, of course, Wikipedia's licensing terms.)
Related
I know there is way to copy static files via jsdoc, for images as example.
Is there a way to "extend" the generated template via markdown or html files that integrate into the "look & feel" of the used theme?
I know you can include one markdown file as "landing page", but i wonder if its possible to add more pages/files.
Why im asking this?
Because i want to generate the documentation out of my source code and add then some additional pages which describe the workflow of my application or the behavior of some components.
Doing this in a single markdown document & that as "landing page" seems not a good solution.
I cant imagine that there exist not a "read to use" solution.
I just want a nice & complete documentation of my application which includes stuff from the source code and additional pages.
Any hint is welcome.
Thanks in Advance.
So I've been trying to implement an #if parser into an infobox, but I seem to be out of luck. The previous code I used seems to be outdated, and I can't find the a way to code it in again, differentely. :/
Basically, in this infobox, if a field is not typed in(or if typed in is left empty) it should become 'invisible' or not even render.
This code worked fine in a previous version of MediaWiki(not sure which one though), but no longer: http://pastebin.com/uQ49mPbQ. I've been trying to use it as a tutorial, and even outright copy and pasted it, but it simply doesn't work. All of the fields would become invisible, regardless of what I would have done to them...
This is the new code that I am using, and would like to be #if'ed: http://pastebin.com/3j0AbN5v
Any help would be welcome.
You need to enable the ParserFunctions extension to be able to use the {{#if}} parser function. Do this in your LocalSettings.php:
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
If you want to use the string functions (like {{#replace}}, {{#explode}}, etc), also add:
$wgPFEnableStringFunctions = true;
In recent versions of MediaWiki, ParserFunctions is included (but not enabled) so you don't need to download anything.
Basic troubleshooting: Whenever you see code like {{#zyx:...}} in a wiki page, it (probably) means, that someone tried to use a parser function that is not installed. Unless there is a parser function called “zyx” installed, the code {{#zyx:...}} has no special meaning to the wiki, and the text will be printed just like it is. The most common parser functions are collected in an extension called ParserFunctions, that is used on WikiMedia wikis. You will need the parser functions from ParserFunctions whenever copying templates from e.g. English Wikipedia.
To see what parser functions you have enabled, navigate to Special:Version on your wiki. Below the list of installed extensions is a list of tags (such as <gallery />) and parser functions available. As you can see, “if” is among the parser functions on your old wiki, but not on your new.
Is it possible to embed code to Trac wiki page straight from source code? I mean code blocks, not links pointing to the source. Like
MyCode.java contents
Look at IncludeMacro which is also able to embed from source repository (keyword source:).
Furthermore you can copy source code to wiki and format it with syntax-highlighting, for example:
{{{
#!python
hello = lambda: "world"
}}}
Read more about it here.
You're using 'code blocks' in a way that makes me think of partial citation.
As falkb pointed out, IncludeMacro is the current best way of embedding Trac (and even external) content into a Trac resource, that is rendered with support for Trac's WikiFormatting. But sadly, there is NO such partial citation capability yet.
You may want to at least request it as enhancement for the aforementioned plugin, and could even push it closer to reality by providing valid use case example - or better: some real code to make it happen. Be prepared to test code, if a patch is proposed or - ideally - if the trunk (development) branch receives changes to make partial citation happen.
Is there a way to get the mediawiki code that is generated by a template? I want to go on to Wikipedia, use a citation template, and copy the generated wiki code to my wiki that doesn't have those citation templates.
There is indeed a way -- http://en.wikipedia.org/wiki/Special:ExpandTemplates
Note that this is provided by an extension, so if you want this ability on your own MediaWiki installation you may need to install it: http://www.mediawiki.org/wiki/Extension:ExpandTemplates
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 be too big). Click Export to dump a .xml file of the template. Then import this into the destination wiki.
After it has been imported open the template for editing, check the list below the edit box "Pages transcluded onto the current version of this page:". If there are any red links repeat the above steps for these templates as well. You might also need to copy styles in MediaWiki:Common.css page and Javascript in MediaWiki:Common.js before everything works. Finally edit the templates to customize for your wiki.
If it still doesn't work and you have messy pages of braces and if statements, then you need to install the ParserFunctions extension. If there is {{#invoke: }} in template code you'll also need to install the Scribunto extension.
MediaWiki Help:Templates explains the process in more detail.
You can directly copy templates from Wikipedia. A nice example is the Keypress template.
This task is a bit more involved than just exporting and importing.
A "simple" overview can be found here -> How to add Wikipedia templates to your own Mediawiki
Upgrade our MediaWiki to the latest stable version, hoping to match Wikipedia’s one.
Install the Scribunto extension and properly configure it.
Export/Import the LUA modules used by the (meta)templates you want to use and import them in your MediaWiki.
Export/Import the Wikipedia templates you want to use, together with all the required metatemplates, and import them in your
MediaWiki.
Copy the relevant CSS classes from the Wikipedia’s Common.css file and paste them in your MediaWiki’s Common.css.
Activate MediaWiki IstantCommons feature to automatically fetch the Template image files from the commons.wikipedia.com repository.