User:Stevage
From MediaWiki.org
See en:User:Stevage.
The preprocessor does:
- Strip (hooks before/after)
- Remove HTML comments
- Replace variables
-
- Subst
- MSG, MSGNW, RAW
- Parser functions
- Templates
-
The parser does:
- Strip (hooks before, after)
- Internal parse
- Noinclude/onlyinclude/includeonly sections
- Remove HTML tags
- Replace variables
- Hooks: Internalparsebeforelinks
- Tables
- Strip TOC (__NOTOC__, __TOC__)
- Strip no gallery (__NOGALLERY__)
- do headings
- Do dynamic dates
- Do quotes ('' and ''')
- Replace internal links
- Replace external links
- Re-replace masked internal links
- Do magic links (ISBN, RFC...)
- Format headings (__NEWSECTIONLINK__, __FORCETOC__...)
- Unstrip general
- Fix tags (french spaces, guillemet)
- Blocks (lists etc)
- Replace link holders
- Parser convert
- Unstrip no wiki
- Extra tags and params
- User funcs?
- Un strip general
- Normalise char references
- Tidy + hook
The save parser does:
- Convert newlines
- Strips
- Pass 2
- Substs
- Strip again? gallery something.
- Signatures
- Pipe tricks
- Trim trailing whitespace
- Unstrips
[edit] ANTLR grammer for [Image:]
grammar image2;
imageinline: LINK_START IMAGE_NAMESPACE COLON imagename ( PIPE imageoption )* LINK_END ;
//imageinline: LINK_START IMAGE_NAMESPACE COLON pagename;
imagename: pagename DOT imageextension;
imageextension: EXT_JPG | EXT_JPEG | EXT_PNG | EXT_SVG | EXT_GIF | EXT_BMP ;
imageoption: imagemodeparameter | imagesizeparameter | imagealignparameter
| imagevalignparameter | imageotherparameter | caption ;
imagemodeparameter: imagemodemanualthumb | imagemodeautothumb | imagemodeframe | imagemodeframeless;
imagemodemanualthumb: MW_img_manualthumb imagename;
imagemodeautothumb: MW_img_thumbnail;
imagemodeframe: MW_img_frame;
imagemodeframeless: MW_img_frameless;
/* default settings: */
/* Hmm, user-definable grammar seems to be a bad idea. Assume that the img_manualthumb is always something followed by the name. */
MW_img_manualthumb: 'thumbnail=' | 'thumb=';
MW_img_thumbnail: 'thumbnail' | 'thumb';
MW_img_frame: 'framed' | 'enframed' | 'frame';
MW_img_frameless: 'frameless';
imageotherparameter: imageparampage | imageparamupright | imageparamborder;
imageparampage: MW_img_page ;
imageparamupright: MW_img_upright ;
// imageparamupright: L_u L_p L_r L_i L_g L_h L_t ;
imageparamborder: MW_img_border;
/* default settings: */
MW_img_page: 'page=$1' | 'page $1' ; /*??? (where is this used?);*/
MW_img_upright: 'upright' ( '='? POSITIVE_INT)?;
MW_img_border: 'border';
imagesizeparameter: MW_img_width;
/* default setting: */
MW_img_width: POSITIVE_INT 'px' ;
imagealignparameter: imagealignleft | imagealigncenter | imagealignright | imagealignnone;
imagealignleft: MW_img_left ;
imagealigncenter: MW_img_center ;
imagealignright: MW_img_right ;
imagealignnone: MW_img_none;
/* default settings: */
imagevalignparameter: imagevalignbaseline | imagevalignsub | imagevalignsuper | imagevaligntop
| imagevaligntexttop | imagevalignmiddle | imagevalignbottom | imagevaligntextbottom;
imagevalignbaseline: MW_img_baseline ;
imagevalignsub: MW_img_sub;
imagevalignsuper: MW_img_super;
imagevaligntop: MW_img_top;
imagevaligntexttop: MW_img_text_top;
imagevalignmiddle: MW_img_middle;
imagevalignbottom: MW_img_bottom;
imagevaligntextbottom: MW_img_text_bottom;
/* by default: */
MW_img_baseline: 'baseline';
MW_img_sub: 'sub';
MW_img_super: 'super' | 'sup';
MW_img_top: 'top';
MW_img_text_top: 'text-top';
MW_img_middle: 'middle';
MW_img_bottom: 'bottom';
MW_img_text_bottom: 'text-bottom';
LINK_START: '[[';
LINK_END: ']]';
IMAGE_NAMESPACE : 'image';
COLON : ':';
PIPE : '|';
caption: inline_text;
//inline_text: LETTERS;
//pagename: LETTERS; /*obviously not */
pagename: letters; /*obviously not */
//LETTERS : 'hello';
inline_text: lettery (lettery | SPACE | DOT |imageinline)*;
EXT_JPG :'jpg' ;
lettery : letters | MW_img_right|MW_img_upright;
////TEXT :(LETTERS | ' ' | '.')+;
POSITIVE_INT: '0'..'9'+;
EXT_JPEG:'jpeg' ;
EXT_PNG :'png' ;
EXT_SVG :'svg' ;
EXT_GIF :'gif';
EXT_BMP :'bmp';
DOT :'.';
SPACE :' ';
LETTER : ('A'..'Z'|'a'..'z');
letters : LETTER+;
MW_img_left: 'left';
MW_img_center: 'center' | 'centre';
MW_img_right: 'right';
MW_img_none: 'none';