diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-05-01 19:35:36 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-05-08 22:22:14 +0200 |
| commit | ef3dcc29e545c86276bdccfa59457c5dcf418eaf (patch) | |
| tree | 5659db7e55529ad2d3da12acd53c9814d41c6b92 | |
| parent | b84d3cb9bf3636619bc65870037e0a360c1c671f (diff) | |
doc: Build with Texinfo 7.
This is a backport of guix/lernigilo#7 and followup commits.
* doc/build.scm (html-manual-identifier-index)[build]
(collect-anchors): Add clauses matching Texinfo 7 output.
(syntax-highlighted-html)[build](concatenate-snippets): Likewise.
(syntax-highlight):Likewise.
(stylized-html)[stylized-html]: Do not insert <link> tag for ‘%manual-css-url’
since it’s already added by ‘makeinfo’.
Change-Id: I3a51eece053d4fdeeaa72d2642fd4a62695cc3a6
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #8272
| -rw-r--r-- | doc/build.scm | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/doc/build.scm b/doc/build.scm index 726d209ce60..7837c42b8a1 100644 --- a/doc/build.scm +++ b/doc/build.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2019-2025 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2019-2026 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> | 3 | ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de> |
| 4 | ;;; Copyright © 2022 Maxim Cournoyer <maxim@guixotic.coop> | 4 | ;;; Copyright © 2022 Maxim Cournoyer <maxim@guixotic.coop> |
| 5 | ;;; Copyright © 2025 Florian Pelz <pelzflorian@pelzflorian.de> | 5 | ;;; Copyright © 2025 Florian Pelz <pelzflorian@pelzflorian.de> |
| @@ -324,17 +324,31 @@ actual file name." | |||
| 324 | ((('span ('@ ('class "category")) ;raw Texinfo 6.8 | 324 | ((('span ('@ ('class "category")) ;raw Texinfo 6.8 |
| 325 | (? string-or-entity?) ...) rest ...) | 325 | (? string-or-entity?) ...) rest ...) |
| 326 | #t) | 326 | #t) |
| 327 | ((('span ('@ ('class "symbol-definition-category")) | 327 | ((('span ;Texinfo 6, post-processed |
| 328 | (? string-or-entity?) ...) rest ...) | 328 | ('@ ('class "symbol-definition-category")) |
| 329 | (? string-or-entity?) ...) rest ...) | ||
| 330 | #t) | ||
| 331 | ((('span ;Texinfo 7 | ||
| 332 | ('@ ('class "category-def")) _ ...) | ||
| 333 | ('span ('strong ('@ ('class "def-name")) _ ...) | ||
| 334 | _ ...) | ||
| 335 | rest ...) | ||
| 329 | #t) | 336 | #t) |
| 330 | (x | 337 | (x |
| 331 | #f)))) | 338 | #f)))) |
| 332 | 339 | ||
| 340 | (define (definition-class? class) | ||
| 341 | ;; Return true for "deffn def-line", "deftp def-line", etc. | ||
| 342 | (string-suffix? " def-line" class)) | ||
| 343 | |||
| 333 | (let ((shtml (call-with-input-file file html->shtml))) | 344 | (let ((shtml (call-with-input-file file html->shtml))) |
| 334 | (let loop ((shtml shtml) | 345 | (let loop ((shtml shtml) |
| 335 | (anchors anchors)) | 346 | (anchors anchors)) |
| 336 | (match shtml | 347 | (match shtml |
| 337 | (('dt ('@ ('id id) _ ...) rest ...) | 348 | ((or ('dt ('@ ('id id) _ ...) rest ...) ;Texinfo 6 |
| 349 | ('dt ('@ ('class (? definition-class?)) ;Texinfo 7 | ||
| 350 | ('id id)) | ||
| 351 | rest ...)) | ||
| 338 | (if (and (string-prefix? "index-" id) | 352 | (if (and (string-prefix? "index-" id) |
| 339 | (worthy-entry? rest)) | 353 | (worthy-entry? rest)) |
| 340 | (alist-cons (anchor-id->key id) | 354 | (alist-cons (anchor-id->key id) |
| @@ -505,10 +519,16 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')." | |||
| 505 | (loop rest (cons str strings))) | 519 | (loop rest (cons str strings))) |
| 506 | ((('*ENTITY* "additional" entity) . rest) | 520 | ((('*ENTITY* "additional" entity) . rest) |
| 507 | (loop rest (cons (entity->string entity) strings))) | 521 | (loop rest (cons (entity->string entity) strings))) |
| 522 | ((('*ENTITY* "additional-char" entity) . rest) | ||
| 523 | (loop rest (cons (string | ||
| 524 | (integer->char (string->number entity))) | ||
| 525 | strings))) | ||
| 508 | ((('span _ lst ...) . rest) ;for <span class="roman"> | 526 | ((('span _ lst ...) . rest) ;for <span class="roman"> |
| 509 | (loop (append lst rest) strings)) | 527 | (loop (append lst rest) strings)) |
| 510 | ((('var name) . rest) ;for @var{name} within @lisp | 528 | ((('var ('@ _) name) . rest) ;for @var{name} within @lisp |
| 511 | (loop rest (cons name strings))) ;XXX: losing formatting | 529 | (loop rest (cons name strings))) ;XXX: losing formatting |
| 530 | ((('var name) . rest) ;likewise (Texinfo 6) | ||
| 531 | (loop rest (cons name strings))) | ||
| 512 | (something | 532 | (something |
| 513 | (pk 'unsupported-code-snippet something) | 533 | (pk 'unsupported-code-snippet something) |
| 514 | (primitive-exit 1))))) | 534 | (primitive-exit 1))))) |
| @@ -537,7 +557,10 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')." | |||
| 537 | (link (@ (rel "stylesheet") | 557 | (link (@ (rel "stylesheet") |
| 538 | (type "text/css") | 558 | (type "text/css") |
| 539 | (href #$syntax-css-url))))) | 559 | (href #$syntax-css-url))))) |
| 540 | (('pre ('@ ('class "lisp")) code-snippet ...) | 560 | ((or ('pre ('@ ('class "lisp")) ;Texinfo 6 |
| 561 | code-snippet ...) | ||
| 562 | ('pre ('@ ('class "lisp-preformatted")) | ||
| 563 | code-snippet ...)) | ||
| 541 | `(pre (@ (class "lisp")) | 564 | `(pre (@ (class "lisp")) |
| 542 | ,@(highlights->sxml* | 565 | ,@(highlights->sxml* |
| 543 | (pair-open/close | 566 | (pair-open/close |
| @@ -545,14 +568,16 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')." | |||
| 545 | (concatenate-snippets code-snippet))) | 568 | (concatenate-snippets code-snippet))) |
| 546 | anchors))) | 569 | anchors))) |
| 547 | 570 | ||
| 548 | ;; Replace the ugly <strong> used for @deffn etc., which | 571 | ;; For Texinfo 6: Replace the ugly <strong> used for @deffn |
| 549 | ;; translate to <dt>, with more stylable markup. | 572 | ;; etc., which translate to <dt>, with more stylable |
| 573 | ;; markup. No such post-processing is needed for @deffn | ||
| 574 | ;; with Texinfo 7. | ||
| 550 | (('dt ('@ ('id id)) ;raw Texinfo 6.8 | 575 | (('dt ('@ ('id id)) ;raw Texinfo 6.8 |
| 551 | ('span ('@ ('class "category")) category ...) | 576 | ('span ('@ ('class "category")) category ...) |
| 552 | ('span ('strong thing) | 577 | ('span ('strong thing) |
| 553 | anchor)) | 578 | anchor)) |
| 554 | (highlight-definition id category thing '())) | 579 | (highlight-definition id category thing '())) |
| 555 | (('dt (@ ('id id)) | 580 | (('dt ('@ ('id id)) ;ditto |
| 556 | ('span ('@ ('class "category")) category ...) | 581 | ('span ('@ ('class "category")) category ...) |
| 557 | ('span ('strong thing) | 582 | ('span ('strong thing) |
| 558 | (? space?) ('em args ...) | 583 | (? space?) ('em args ...) |
| @@ -808,16 +833,9 @@ in SOURCE." | |||
| 808 | (match sxml | 833 | (match sxml |
| 809 | (('*TOP* decl body ...) | 834 | (('*TOP* decl body ...) |
| 810 | `(*TOP* ,decl ,@(map loop body))) | 835 | `(*TOP* ,decl ,@(map loop body))) |
| 811 | (('head elements ...) | 836 | ((or ('body ('@ _) elements ...) |
| 812 | ;; Add reference to our own manual CSS, which provides | 837 | ('body elements ...)) |
| 813 | ;; support for the language menu. | 838 | `(body ,(navigation-bar |
| 814 | `(head ,@elements | ||
| 815 | (link (@ (rel "stylesheet") | ||
| 816 | (type "text/css") | ||
| 817 | (href #$manual-css-url))))) | ||
| 818 | (('body ('@ attributes ...) elements ...) | ||
| 819 | `(body (@ ,@attributes) | ||
| 820 | ,(navigation-bar | ||
| 821 | ;; TODO: Add "Contribute" menu, to report | 839 | ;; TODO: Add "Contribute" menu, to report |
| 822 | ;; errors, etc. | 840 | ;; errors, etc. |
| 823 | (list (menu-dropdown | 841 | (list (menu-dropdown |
| @@ -952,12 +970,12 @@ makeinfo OPTIONS." | |||
| 952 | (mkdir-p (string-append #$output "/" | 970 | (mkdir-p (string-append #$output "/" |
| 953 | (normalize language))) | 971 | (normalize language))) |
| 954 | (setenv "LANGUAGE" language) | 972 | (setenv "LANGUAGE" language) |
| 955 | (apply invoke #$(file-append texinfo "/bin/makeinfo") | 973 | (apply invoke #$(file-append texinfo-7 "/bin/makeinfo") |
| 956 | "-o" (string-append #$output "/" | 974 | "-o" (string-append #$output "/" |
| 957 | (normalize language) | 975 | (normalize language) |
| 958 | "/html_node") | 976 | "/html_node") |
| 959 | opts) | 977 | opts) |
| 960 | (apply invoke #$(file-append texinfo "/bin/makeinfo") | 978 | (apply invoke #$(file-append texinfo-7 "/bin/makeinfo") |
| 961 | "--no-split" | 979 | "--no-split" |
| 962 | "-o" | 980 | "-o" |
| 963 | (string-append #$output "/" | 981 | (string-append #$output "/" |
| @@ -1409,7 +1427,7 @@ commit date (an integer)." | |||
| 1409 | (string-append #+tar "/bin:" | 1427 | (string-append #+tar "/bin:" |
| 1410 | #+xz "/bin:" | 1428 | #+xz "/bin:" |
| 1411 | #+zstd "/bin:" | 1429 | #+zstd "/bin:" |
| 1412 | #+texinfo "/bin")) | 1430 | #+texinfo-7 "/bin")) |
| 1413 | (invoke "tar" "xf" #$(package-source guile)) | 1431 | (invoke "tar" "xf" #$(package-source guile)) |
| 1414 | (mkdir-p (string-append #$output "/en/html_node")) | 1432 | (mkdir-p (string-append #$output "/en/html_node")) |
| 1415 | 1433 | ||
