User:MjolnirPants/mediawiki lang npp
![](http://upload.wikimedia.org/wikipedia/commons/1/10/MediaWiki_xml_ScreenCap.jpg)
I have found it useful to be able to edit wikipedia outside of wikipedia itself. Rather than opening a second tab or window with my sandbox in it, I've taken to editing in Notepad++. This has the advantage of giving me the entire width of my screen for editing, as well as providing a storage place from which I can easily cut and paste. This page hosts the UDL (User Defined Language) .xml file I use for this purpose. I've included a screen shot to show the formatting it creates.
If you have any suggestions or comments, feel free to let me know here or on my user talk page. I've found this very useful, and I hope someone else does, too.
Notes, features & limitations
[edit]- This UDL does not allow folding of code (meaning you cannot collapse sections).
- It does not recognize keywords such as template or article names, and so it will not warn you if you typo something.
- It will 'bleed' formatting past a tag if you forget to close it out.
- It doesn't recognized nested tags, so it will not format a wikilink within a template, for instance.
- There is currently no way to preview in Notepad++.
- There is currently no way to implement additional text styles (right now there are 8, some of which are used for multiple markups.)
Code
[edit]MediaWiki.xml — Expand to see the code.
|
---|
<NotepadPlus>
<UserLang name="MediaWiki" ext="wiki" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="yes" Keywords2="yes" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00 01 02 03<! 04--></Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
<Keywords name="Numbers, extras1"></Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2"></Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">/</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open"><fold></Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close"></fold></Keywords>
<Keywords name="Folders in code2, open"></Keywords>
<Keywords name="Folders in code2, middle"></Keywords>
<Keywords name="Folders in code2, close"></Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">'''</Keywords>
<Keywords name="Keywords2">''</Keywords>
<Keywords name="Keywords3">*</Keywords>
<Keywords name="Keywords4"></Keywords>
<Keywords name="Keywords5"></Keywords>
<Keywords name="Keywords6"></Keywords>
<Keywords name="Keywords7"></Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00(( [[ <ref> )) 01 02(( ]] </ref> )) 03(( ''''' [ )) 04 05(( ''''' ] )) 06{{ 07 08}} 09(( ''' ==== ===== ====== )) 10 11(( ''' ==== ===== ====== )) 12'' 13 14'' 15< 16 17> 18=== 19 20=== 21== 22 23==</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="0" fontSize="10" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="408080" bgColor="FFFF80" fontName="Courier New" fontStyle="0" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="Georgia" fontStyle="1" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="FF80FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="808040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="0000FF" bgColor="FFFFFF" fontName="Arial" fontStyle="1" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="3" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="800080" bgColor="FFFFFF" fontName="Arial" fontStyle="1" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="1" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="2" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="FF0080" bgColor="FFFFFF" fontName="Arial" fontStyle="1" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="Georgia" fontStyle="1" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="Georgia" fontStyle="3" fontSize="12" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
|
Instructions
[edit]Installation
[edit]If you don't have it already, please download and install Notepad++. Don't worry, it's free and open-source. Once that's done, follow these steps.
- Open notepad (or Notepad++) and copy the code above into it.
- Save the file with whatever name you like, with the extension
.xml
. Make sure theSave as type:
drop-down is set toAll files (*.*)
before you save. (If you use Notepad++ to save it, you can choose XML from that dropdown, instead of typing in the extension yourself.) - Open Notepad++ and create a new document.
- Type some mediaWiki code into it. (Give it a section or two, add some wikilinks and comments and so on.)
- Save the document as whatever name you like, with the file extension
.wiki
. Make sure that theSave as type:
drop down list is set toAll types (*.*)
. - Click on
Language
in the menu bar and selectDefine your language...
from the drop-down. - In the window that opens up, select the
Import...
button at the top. - Browse to the location you saved the .xml file to and select it.
- If the text in your .wiki file hasn't changed formatting, click on the
Language
menu item again. This time, you should noticeMediaWiki
at the bottom of the list, belowDefine your language...
. Select it. - Enjoy your offline editing!
File Association
[edit]As an optional step, if you are using Windows you can also set Notepad++ to open .wiki files by default. To do this, complete the following steps:
- Browse to the .wiki file you saved and double click on it.
- When the dialog box stating that Windows can't open the file appears, choose
Select a program from a list of installed programs
and clickOK
. - In the next window, make sure that
Always use the selected program to open this kind of file
is checked at the bottom, and either find Notepad++ in the list of programs shown, or clickBrowse...
and browse to the folder that contains it. - Click
OK
as many times as needed to close the boxes, and watch it open in Notepad++.
Linux Users
[edit]If you are a Linux user, you can still download Notepad++ and use this UDL. Just apt-get
Wine and make sure it is installed and working properly before downloading and installing Notepad++. Once this is done, follow the steps above for installation. If you use Ubuntu, Wine is available on the Ubuntu Software Center (at least it was the last time I checked).
Mac Users
[edit]If you are a Mac user, please do yourself a favor and get a computer that isn't designed to be the blackest box on the market. Just kidding! There is plenty of compatibility layer software designed to allow you to run Windows applications on your Mac. Unfortunately, few of them are free, so I'm not going to suggest one here.
See Also
[edit]External links
[edit]![](http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/MediaWiki-2020-icon.svg/40px-MediaWiki-2020-icon.svg.png)
![](http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/MediaWiki-2020-icon.svg/40px-MediaWiki-2020-icon.svg.png)