from ~verbatim~), then strip
;; tags. The caption is:
;; Figure N: CAPTION
.
(when (string-match
"\\(Figure[^<]*\\)\\(\\(?:.\\|\n\\)*?\\)"
html after)
(let* ((num (string-trim (match-string 1 html)))
(raw (match-string 2 html))
;; Strip any inline HTML tags from the caption body.
(cap (string-trim
(replace-regexp-in-string "<[^>]*>" "" raw)))
(short (if (string-match "\\. " cap)
(substring cap 0 (1+ (match-beginning 0)))
cap))
(label (replace-regexp-in-string ":?\\s-*$" "" num)))
(push (format "- %s %s
"
fid label short)
items)))))
(if (null items)
html
(let ((lof (concat
"\n"
"List of Figures
\n"
"\n\n"
(mapconcat #'identity (nreverse items) "\n")
"\n
\n\n\n")))
(if (string-match "