;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;;
;;; This file is part of GNU Guix.
;;;
"guix"))
(define %languages
- '("de" "en" "es" "fr" "ru" "zh_CN"))
+ ;; The cookbook is currently only translated into German.
+ (if (string=? %manual "guix-cookbook")
+ '("de" "en")
+ '("de" "en" "es" "fr" "ru" "zh_CN")))
(define (texinfo-manual-images source)
"Return a directory containing all the images used by the user manual, taken
(date->string date "~B ~Y")
version version))))))
- (install-file #$(file-append* documentation "/htmlxref.cnf")
+ (install-file #$(file-append documentation "/htmlxref.cnf")
#$output)
(for-each (lambda (texi)
(install-file texi #$output))
- (append (find-files #$documentation "\\.(texi|scm)$")
+ (append (find-files #$documentation "\\.(texi|scm|json)$")
(find-files #$(translated-texi-manuals source)
"\\.texi$")))
;; Guile-Lib with a hotfix for (htmlprag).
(package
(inherit guile-lib)
- (source (origin
- (inherit (package-source guile-lib))
- (modules '(( guix build utils)))
- (snippet
- '(begin
- ;; When parsing
- ;; "<body><blockquote><p>foo</p>\n</blockquote></body>",
- ;; 'html->shtml' would mistakenly close 'blockquote' right
- ;; before <p>. This patch removes 'p' from the
- ;; 'parent-constraints' alist to fix that.
- (substitute* "src/htmlprag.scm"
- (("^[[:blank:]]*\\(p[[:blank:]]+\\. \\(body td th\\)\\).*")
- ""))
- #t))))
(arguments
(substitute-keyword-arguments (package-arguments guile-lib)
((#:phases phases '%standard-phases)
`(modify-phases ,phases
- (add-before 'check 'skip-known-failure
- (lambda _
- ;; XXX: The above change causes one test failure among
- ;; the htmlprag tests.
- (setenv "XFAIL_TESTS" "htmlprag.scm")
- #t))))))))
+ (add-before 'build 'fix-htmlprag
+ (lambda _
+ ;; When parsing
+ ;; "<body><blockquote><p>foo</p>\n</blockquote></body>",
+ ;; 'html->shtml' would mistakenly close 'blockquote' right
+ ;; before <p>. This patch removes 'p' from the
+ ;; 'parent-constraints' alist to fix that.
+ (substitute* "src/htmlprag.scm"
+ (("^[[:blank:]]*\\(p[[:blank:]]+\\. \\(body td th\\)\\).*")
+ ""))
+ #t))
+ (add-before 'check 'skip-known-failure
+ (lambda _
+ ;; XXX: The above change causes one test failure among
+ ;; the htmlprag tests.
+ (setenv "XFAIL_TESTS" "htmlprag.scm")
+ #t))))))))
(define* (syntax-highlighted-html input
#:key
(syntax-highlight lexers)
(guix build utils)
(srfi srfi-1)
+ (srfi srfi-26)
(ice-9 match)
(ice-9 threads)
(ice-9 vlist))
(define (anchor-id->key id)
;; Convert ID, an anchor ID such as
;; "index-pam_002dlimits_002dservice" to the corresponding key,
- ;; "pam-limits-service" in this example.
- (underscore-decode
- (string-drop id (string-length "index-"))))
+ ;; "pam-limits-service" in this example. Drop the suffix of
+ ;; duplicate anchor IDs like "operating_002dsystem-1".
+ (let ((id (if (any (cut string-suffix? <> id)
+ '("-1" "-2" "-3" "-4" "-5"))
+ (string-drop-right id 2)
+ id)))
+ (underscore-decode
+ (string-drop id (string-length "index-")))))
(define* (collect-anchors file #:optional (vhash vlist-null))
;; Collect the anchors that appear in FILE, a makeinfo-generated
(lambda (mono)
(let ((anchors (collect-anchors mono)))
(process-html mono anchors)))
- (find-files #$input "^guix(\\.[a-zA-Z_-]+)?\\.html$"))
+ (find-files
+ #$input
+ "^guix(-cookbook|)(\\.[a-zA-Z_-]+)?\\.html$"))
;; Next process the multi-node HTML files in two phases: (1)
;; collect the list of anchors, and (2) perform