1ba35cc3198993c1e08062d6cc2ce5918353168c — Aluísio Augusto Silva Gonçalves 1 year, 2 months ago bf9f9ed
markdown: Prepare to support automatic ID generation for headings

We don't have a generator function yet, but everything else is in place.
1 files changed, 9 insertions(+), 3 deletions(-)

M haunt.scm
M haunt.scm => haunt.scm +9 -3
@@ 244,9 244,15 @@
    (match sxml
           ((tag middle ... tail)
            (let*-values (((before attrs) (extract-attributes tail))
                          ((parsed-attrs) (fold-attributes-dict (build-attributes-dict attrs)))
                          ((wrapped-attrs) (if (null? attrs) '() (cons '@ parsed-attrs))))
              `(,tag ,wrapped-attrs ,@middle ,before)))
                          ((parsed-attrs) (build-attributes-dict attrs))
                          ((folded-attrs) (fold-attributes-dict parsed-attrs)))
              (let ((sxml-attrs
                      (if (vhash-assq 'id parsed-attrs)
                          (cons '@ folded-attrs)
                          ; TODO: devise a deterministic ID generator (probably hashing the XML representation)
                          ;(cons* '@ (list 'id (generate-identifier sxml)) folded-attrs))))
                          (cons '@ folded-attrs))))
                `(,tag ,sxml-attrs ,@middle ,before))))
           (_ sxml)))
  (define (remove-single-paragraphs-from-lists . sxml)
    (match sxml