Indentation cleanup in PEG parser and Html serializer

This commit is contained in:
Gabriel Wicke 2011-11-07 21:05:37 +00:00
parent aa31a5ebce
commit 944d010eb2
2 changed files with 237 additions and 235 deletions

View file

@ -145,7 +145,7 @@ h1 = sol
attributes: {level: 1},
text: c
}
}
}
h2 = sol
'==' c:heading_text '==' &newline {
@ -154,7 +154,7 @@ h2 = sol
attributes: {level: 2},
content: c
}
}
}
h3 = sol
'===' c:heading_text '===' &newline {
@ -163,7 +163,7 @@ h3 = sol
attributes: {level: 3},
content: c
}
}
}
h4 = sol
'====' c:heading_text '====' &newline {
@ -172,7 +172,7 @@ h4 = sol
attributes: {level: 4},
content: c
}
}
}
h5 = sol
'=====' c:heading_text '=====' &newline {
@ -181,7 +181,7 @@ h5 = sol
attributes: {level: 5},
content: c
}
}
}
h6 = sol
'======' c:heading_text '======' &newline {
@ -190,7 +190,7 @@ h6 = sol
attributes: {level: 6},
content: c
}
}
}
heading_marker
= '=' '='*
@ -310,7 +310,7 @@ extlink
target: target,
text: text
}
}
}
// = "[" target:url text:extlink_text "]" { return { type: 'extlink', target: target, text: text } }
@ -330,7 +330,7 @@ template
obj.params = params;
}
return obj;
}
}
template_param
= name:template_param_name "=" c:template_param_text {
@ -338,13 +338,14 @@ template_param
name: name,
content: c
};
} / c:template_param_text {
} / c:template_param_text {
return {
content: c
};
}
}
tplarg = "{{{" name:link_target params:("|" p:template_param { return p })* "}}}" {
tplarg
= "{{{" name:link_target params:("|" p:template_param { return p })* "}}}" {
var obj = {
type: 'tplarg',
name: name
@ -353,7 +354,7 @@ tplarg = "{{{" name:link_target params:("|" p:template_param { return p })* "}}}
obj.params = params;
}
return obj;
}
}
template_param_name
= h:( !"}}" x:([^=|]) { return x } )* { return h.join(''); }
@ -382,7 +383,7 @@ link
obj.text = text[0][1]; // ehhhh
}
return obj;
}
}
link_target
= h:( !"]]" x:([^|]) { return x } )* { return h.join(''); }
@ -435,9 +436,7 @@ italic_marker
/* Will need to check anything xmlish agains known/allowed HTML tags and
* registered extensions, otherwise fail the match. Should ref be treated as a
* regular extension? */
xmlish_tag =
ref /
references
xmlish_tag = ref / references
ref = ref_full / ref_empty
@ -496,7 +495,7 @@ references_full
content: content,
close: close
}
}
}
references_empty
= start:references_start close:(space* "/>") {
@ -507,7 +506,7 @@ references_empty
params: start.params,
close: close
}
}
}
references_start
= "<references" params:ext_param* ws:space* {
@ -515,24 +514,24 @@ references_start
params: params,
ws: ws
};
}
}
references_end
= all:("</references" space* ">") {
return all.join('');
}
}
references_content
= !references_end a:(inline) {
return a;
}
}
ext_param
= space* name:ext_param_name "=" val:ext_param_val {
val.name = name;
return val;
}
}
ext_param_name
= name:[a-zA-Z0-9-]+ {
@ -719,3 +718,6 @@ table_end = newline? "|}" { clearFlag('table'); }
* convert inlines into annotations
* change contents into children
*/
/* Tabs do not mix well with the hybrid production syntax */
/* vim: et:ts=4:sw=4:cindent */