◊(Local Yarn Code "View Ticket")

Ticket Hash: 713fa32699d69e855adc037f1067143ac26281bd
Title: Make footnote anchor links unique to each article
Status: Closed Type: Feature Proposal
Severity: Important Priority: High
Subsystem: Resolution: Fixed
Last Modified: 2019-06-01 20:44:27
Version Found In:
User Comments:
joel added on 2018-08-17 03:15:11:

Footnote anchor link IDs should have a prefix that is deterministic/unique to the article in which it appears, so that in full-body listings of multiple articles the IDs do not collide.

Since the metas of the current article are now visible to tag functions, perhaps the prefix should default to some encoding of ‘here-path’, or if that is not present, some hash of the first string contained in the first element of the document.

MD5 hashes look cooler, but some light testing shows that uri-encode from net/uri-codec is faster. Maybe use that on (remove-ext* here-path).

Here’s a quick way to get just a string out of a txexpr:

(define (tx-strs xpr)
  (cond
    [(txexpr? xpr) (apply string-append (map tx-strs (get-elements xpr)))]
    [(string? xpr) xpr]
    [else ""]))