History

Code and paragraphs inside blocks

yiyus committed 17 years ago

Commit fec811b1 parent 871822c1 file · +14 −10Browse files

Unified · Split

md2html.awk+14−10
@@ -92,15 +92,6 @@ BEGIN { · 91 unmodified lines
9292 $0 = $0 "</tr>";
9393 }
9494
95−# Code blocks
96−/^( | )/ {
97− if(block != "code")
98− newblock("code");
99− sub(/^( | )/, "");
100− text = text $0 "\n";
101− next;
102−}
103−
10495 # Paragraph
10596 /^$/{
10697 newblock();
@@ -127,7 +118,20 @@ BEGIN { · 20 unmodified lines
127118 }
128119 sub(/^([*+-]|(([0-9]+[\.-]?)+))[ ]/,"");
129120 }
130−nl > 0 { sub("^( ? ?| )","");}
121+{
122+ for(i = 0; i < nl; i++)
123+ sub("^( ? ?| )","");
124+}
125+/^$/ { text = "<p>" text "</p>";
126+
127+# Code blocks
128+/^( | )/ && block != "li" {
129+ if(block != "code")
130+ newblock("code");
131+ sub(/^( | )/, "");
132+ text = text $0 "\n";
133+ next;
134+}
131135
132136 # Setex-style Headers
133137 # (Plus h3 with underscores.)