Summary Files Commits Branches @commit @diff @stats
path: root / single.awk
diff options
context:
space:
mode:
1 files changed, 5 insertions, 2 deletions
-rw-r--r--single.awk7
diff --git a/single.awk b/single.awk
index 9195576..65883f7 100644
--- a/single.awk
+++ b/single.awk
@@ -13,8 +13,8 @@
# [ ] Links
# [ ] Inline
# [ ] Reference
-# [ ] Code
# [x] Emphasis
+# [x] Code
# [ ] Images
# [ ] Inline
# [ ] Reference
@@ -156,8 +156,9 @@ function sub_match(replacement) {
}
function surround(brace, left, right, blen) {
if (blen == "") { blen = length(brace) }
- if (match($0, brace "[^" brace "]+" brace)) {
+ if (match($0, brace (brace == "``" ? "." : "[^" brace "]") "+" brace)) {
elem = left substr($0, RSTART + blen, RLENGTH - 2*blen) right
+ if (brace == "``") { gsub("`", "\\`", elem) }
sub_match(elem)
return 1;
}
@@ -185,6 +186,8 @@ function gsurround(brace, left, right, blen) {
gsurround("_" , "<em>" , "</em>")
gsurround("\\*\\*", "<strong>", "</strong>", 2)
gsurround("\\*" , "<em>" , "</em>", 1)
+ gsurround("``" , "<code>" , "</code>")
+ gsurround("`" , "<code>" , "</code>")
}
# Paragraph