Summary Files Commits Branches @commit @diff @stats
path: root / single.awk
diff options
context:
space:
mode:
Commit707916075efadc55ce432095c333b3025cd01321 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-07-23 18:19:26 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-07-23 18:19:26 +0300
Files99d52412bc64764ba541ea1f6a5633a059192f2b /single.awk
csg-707916075efadc55ce432095c333b3025cd01321.tar
csg-707916075efadc55ce432095c333b3025cd01321.tar.gz
csg-707916075efadc55ce432095c333b3025cd01321.zip
Parente42c3000981b928aa1d1bab23855fe2f0bfc5db4 (diff)
(single) Implemented reaodnly task lists
1 files changed, 9 insertions, 1 deletions
-rw-r--r--single.awk10
diff --git a/single.awk b/single.awk
index ac2eb7a..415e042 100644
--- a/single.awk
+++ b/single.awk
@@ -27,7 +27,7 @@
# [x] Superscript ^...^
# [x] Subscript ~...~
# [ ] Footnote [^...] (with user customizations)
-# [ ] Task list - [ ]
+# [x] Task list - [ ] (readonly)
# [.] Definition lists
# [x] Single line
# [ ] Multi-line
@@ -187,6 +187,14 @@ function autoinsert(arrname, isbefore) {
/^( |\t)[ \t]*/ {
}
+# Check boxes
+/^[ \t]*- \[[ x]\][ \t]/ {
+ match($0, /- \[[ x]\][ \t]/)
+ if (substr($0, RSTART + 3, 1) == "x") checked = " checked=\"checked\""
+ else checked = ""
+ $0 = "<input type=\"checkbox\" disabled=\"disabled\"" checked ">" substr($0, RSTART + RLENGTH) "</br>"
+}
+
# Unordered lists
function abs(x) { return ((x < 0) ? -x : x) }
!blankline && lengthStack("list-level") > 0 {