mirror of https://codeberg.org/cage/tinmop/
- printed TOC also for gemini pages loaded from a local path.
This commit is contained in:
parent
9233f5c6f9
commit
4dccfda25e
|
@ -780,7 +780,8 @@
|
|||
path)))
|
||||
(ev:with-enqueued-process-and-unblock ()
|
||||
(clean-gemtext main-window)
|
||||
(collect-ir-lines path gui-goodies:*main-frame* parsed-lines)))
|
||||
(collect-ir-lines path gui-goodies:*main-frame* parsed-lines)
|
||||
(render-toc main-window path)))
|
||||
(if force-rendering
|
||||
(let ((lines (cev:enqueue-request-and-wait-results :gemini-slurp-local-file
|
||||
1
|
||||
|
|
|
@ -410,10 +410,15 @@
|
|||
(let ((status (gemini-stream-status iri)))
|
||||
(eq status :completed)))
|
||||
|
||||
(defun build-gemini-toc (iri width)
|
||||
(defun parsed-lines-from-remore-iri (iri)
|
||||
(a:when-let ((stream-wrapper (gw:find-db-stream-url iri)))
|
||||
(gw:parsed-lines stream-wrapper)))
|
||||
|
||||
(defun parsed-lines-from-local-path (path)
|
||||
(gemini-parser:parse-gemini-file (fs:slurp-file path)))
|
||||
|
||||
(defun parsed-lines->toc (parsed-lines width)
|
||||
(a:when-let* ((ordered-headers-tag '(:h1 :h2 :h3))
|
||||
(stream-wrapper (gw:find-db-stream-url iri))
|
||||
(parsed-lines (gw:parsed-lines stream-wrapper))
|
||||
(headers (remove-if-not (lambda (a) (member (html-utils:tag a)
|
||||
ordered-headers-tag))
|
||||
parsed-lines)))
|
||||
|
@ -466,6 +471,12 @@
|
|||
:text (ellipsize text width)))
|
||||
toc)))))
|
||||
|
||||
(defun build-gemini-toc (iri width)
|
||||
(a:when-let* ((parsed-lines (if (fs:file-exists-p iri)
|
||||
(parsed-lines-from-local-path iri)
|
||||
(parsed-lines-from-remore-iri iri))))
|
||||
(parsed-lines->toc parsed-lines width)))
|
||||
|
||||
(defclass gemini-toc (box) ())
|
||||
|
||||
(defun encode-flat-array-of-plists (list stream)
|
||||
|
|
Loading…
Reference in New Issue