Skip to content

Commit 9ef3792

Browse files
committed
Fix single args for shortcodes
1 parent 93c5e46 commit 9ef3792

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

progs/markdown-utils.scm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@
109109
(else "")))
110110

111111
(define-public (assoc->html-attr arg)
112-
"Converts pairs (a . b) into html attribute strings \"a=\"b\". "
113-
(let* ((key (symbol->string (car arg)))
112+
"Converts pairs (a . b) into html attribute strings \"a=\"b\". Set a to #f to only output \"b\"."
113+
(let* ((key (and (symbol? (car arg)) (symbol->string (car arg))))
114114
(val (attr-val (cdr arg))))
115-
(string-append key "=" (string-quote val))))
115+
(if key
116+
(string-append key "=" (string-quote val))
117+
(string-quote val))))
116118

117119

118120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

progs/markdownout.scm

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,10 @@
386386
"Custom hugo {{<cite>}} shortcode"
387387
(if (not (hugo-extensions?)) ""
388388
(with citations
389-
(map force-string
390-
(filter (lambda (x) (and (string? x) (not (string-null? x))))
391-
(cdr x)))
389+
(filter (lambda (x) (and (string? x) (not (string-null? x)))) (cdr x))
392390
(md-set 'refs (append (md-get 'refs) citations))
393-
(md-hugo-shortcode (cons 'cite citations)))))
391+
(md-hugo-shortcode
392+
(cons 'cite (map (lambda (s) `(#f . ,s)) citations))))))
394393

395394
(define (md-cite-detail x)
396395
(if (not (hugo-extensions?)) ""
@@ -485,11 +484,11 @@
485484

486485
(define (md-sidenote-sub x numbered?)
487486
(if (hugo-extensions?)
488-
(let ((numbered (if numbered? '((numbered "numbered")) '()))
487+
(let ((numbered (if numbered? '((numbered . "numbered")) '()))
489488
(args (cdr x)))
490489
(md-hugo-shortcode
491-
(append `(sidenote (halign ,(md-marginal-style (first args)))
492-
(valign ,(md-marginal-style (second args))))
490+
(append `(sidenote (halign . ,(md-marginal-style (first args)))
491+
(valign . ,(md-marginal-style (second args))))
493492
numbered)
494493
(third args)))
495494
(serialize-markdown* `(footnote ,(third (cdr x))))))

0 commit comments

Comments
 (0)