diff options
author | Case Duckworth | 2019-06-30 23:43:37 -0500 |
---|---|---|
committer | Case Duckworth | 2019-06-30 23:43:37 -0500 |
commit | 65a2052ffcb933b904b4bed154ec0ba2959a4eb4 (patch) | |
tree | 494b39d2b707d2844f1aa31f4934ac3d0c2f7d02 /lht | |
parent | Add .gitignore (diff) | |
download | unk-65a2052ffcb933b904b4bed154ec0ba2959a4eb4.tar.gz unk-65a2052ffcb933b904b4bed154ec0ba2959a4eb4.zip |
"Naked" blocks must begin with "<" and end with ">"
I had the "hey, here's a block here already!" detection set to only check for a tag at the end of the block, but realized that that could mess things up if a block ends on, say, an emphasized bit of text. This change checks both that the block begins with a tag and ends with a tag, which can still give false positives (and could engender some false negatives as well), but is, in my opinion, better overall.
Diffstat (limited to 'lht')
-rwxr-xr-x | lht | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lht b/lht index 771fcad..247acf9 100755 --- a/lht +++ b/lht | |||
@@ -2,4 +2,4 @@ | |||
2 | function s(t,i){while(match($0,t)){if(I[ni]==i)ni-=sub(t,"</"i">") | 2 | function s(t,i){while(match($0,t)){if(I[ni]==i)ni-=sub(t,"</"i">") |
3 | else if(sub(t,"<"i">"))I[++ni]=i}}BEGIN{FS="\n"; RS="";ni=0} | 3 | else if(sub(t,"<"i">"))I[++ni]=i}}BEGIN{FS="\n"; RS="";ni=0} |
4 | {s("[\\*_]{2}","strong");s("[\\*_]","em");s("`","code") | 4 | {s("[\\*_]{2}","strong");s("[\\*_]","em");s("`","code") |
5 | $0=(match($0,/>$/))?$0:"<p>"$0"</p>";print} | 5 | $0=(match($0,/^<.*>$/))?$0:"<p>"$0"</p>";print} |