racket / scribble

Other
194 stars 90 forks source link

Cyrillic titles / sections / etc. generate incorrect links #359

Open danilbraun opened 1 year ago

danilbraun commented 1 year ago

The cyrillic letters are replaced by underscores in the links, and if the names of two sections have the same length (the same number of characters), the link to two different sections will be the same.

DrRacket

Brave browser

wwall commented 1 year ago

for cyrillic letters you can edit regexp in file racket/pkgs/scribble-lib/scribble/private/tag.rkt in function gen-tag and add "а-яА-Я" quickfix

(define (gen-tag content)
  (datum-intern-literal
   ;; Generate tag from ASCII plus CJK characters. Constraining to
   ;; ASCII for most purposes helps avoid encoding issues for
   ;; uncooperative environments, but constraining to ASCII is too
   ;; uncooperative in another direction for CJK text (i.e., creates
   ;; too many conflicting tags).
   (regexp-replace* #px"[^-А-Яа-яa-zA-Z0-9_=\u4e00-\u9fff\u3040-\u309F\u30A0-\u30FF]"
                    (content->string content) "_")))