User:Stevage

See en:User:Stevage.

The preprocessor does:


 * 1) Strip (hooks before/after)
 * 2) Remove HTML comments
 * 3) Replace variables
 * 4) Subst
 * 5) MSG, MSGNW, RAW
 * 6) Parser functions
 * 7) Templates

The parser does:


 * 1) Strip (hooks before, after)
 * 2) Internal parse
 * 3) Noinclude/onlyinclude/includeonly sections
 * 4) Remove HTML tags
 * 5) Replace variables
 * 6) Hooks: Internalparsebeforelinks
 * 7) Tables
 * 8) Strip TOC
 * 9) Strip no gallery ( __NOGALLERY__ )
 * 10) do headings
 * 11) Do dynamic dates
 * 12) Do quotes (  and ' )
 * 13) Replace internal links
 * 14) Replace external links
 * 15) Re-replace masked internal links
 * 16) Do magic links (ISBN, RFC...)
 * 17) Format headings ( __NEWSECTIONLINK__, ...)
 * 18) Unstrip general
 * 19) Fix tags (french spaces, guillemet)
 * 20) Blocks (lists etc)
 * 21) Replace link holders
 * 22) Parser convert
 * 23) Unstrip no wiki
 * 24) Extra tags and params
 * 25) User funcs?
 * 26) Un strip general
 * 27) Normalise char references
 * 28) Tidy + hook

The save parser does:
 * 1) Convert newlines
 * 2) Strips
 * 3) Pass 2
 * 4) Substs
 * 5) Strip again? gallery something.
 * 6) Signatures
 * 7) Pipe tricks
 * 8) Trim trailing whitespace
 * 9) Unstrips

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';