Compare commits

...

14 Commits

Author SHA1 Message Date
Rutherther
88c2e2349a doc: Use versioned manual URLs.
* doc/build.scm (stylized-html): Move to versioned manual URL.
(html-manual): Use versioned manual URL.
* doc/htmlxref.cnf (GUIX): Add /1.4.0.

Change-Id: I82048a9548894e335e7c2427a739733304a7961a
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Fixes: #5681
2026-01-19 10:02:52 +01:00
Ludovic Courtès
3bf155b888 doc: Fix URL of ‘language-picker.svg’.
Fixes a regression introduced in
824d46a2fe.

* doc/build.scm (stylized-html)[build]: Avoid double leading slash for
‘language-picker.svg’.

Change-Id: I0817949862f061dbbe04352bda1e479347015c84
2025-07-09 14:29:35 +02:00
Ludovic Courtès
a40cc32ae8 doc: Add links to versions and variants as a drop-down menu.
* doc/build.scm (%latest-guix-version): New variable.
(stylized-html): Add #:latest-version.
[build](menu-item-separator): New variable.
(version-menu-items, input-file-language): New procedures.
(stylized-html, process-html): Add ‘language’ parameter.  Update
callers.

Change-Id: If7cea2410802eec5af1d3c0407d5569250eb15ef
2025-07-09 14:19:04 +02:00
Ludovic Courtès
1691a4458c doc: Really honor ‘GUIX_WEB_SITE_URL’.
This is useful when testing changes locally, so that CSS links point to
the right place.

* doc/build.scm (%web-site-url): Default to /.
(%manual-css-url): Honor ‘%web-site-url’.

Change-Id: I8d885eba0fb8560dd7da7f21629c716a06c16b1f
2025-07-09 14:17:30 +02:00
Ludovic Courtès
e32c098f5d doc: Update build machinery for today’s ‘master’.
This updates TeX Live package names to match what’s available in today’s
‘master’ branch since ‘master’ is what is used to build the on-line copy
of the manual.

* doc/build.scm (pdf-manual)[texinfo-profile]: Update TeX Live package
names.

Change-Id: I5db327e1543a1f9a8697bf3b1b65ab50959efdc4
2025-06-16 17:21:25 +02:00
Ludovic Courtès
4ea1538dd7 doc: Use CSS from guix.gnu.org.
This is a followup to commit 7bbc00ccf0315a68509cacd6a85e1ae8ae7f5e5d of
guix/artwork.git.

* doc/build.scm (%manual-css-url): New variable.
(%makeinfo-html-options): Use it instead of www.gnu.org/…/manual.css.
(stylized-html): Likewise for the default #:manual-css-url.

Change-Id: I20bd3866383f8cbb4984993c15dbab483a17f6c9
2025-06-16 17:17:02 +02:00
Christopher Baines
10527dac08 doc: build.scm: Handle (current-source-directory) being #f.
Since this seems to be the case when the devel manual is being built on
bayfront.

* doc/build.scm: Use the current working directory as a fallback
if (current-source-directory) is #f, and log the value of root.

Change-Id: Ic43fd05a4a0822d9efb935069850f0a8cadd80aa
2025-06-16 17:15:40 +02:00
Ludovic Courtès
f492b57306 doc: Change ‘guix-install.sh’ URL to https://guix.gnu.org/install.sh.
This is a followup to 47d554602c, as
proposed in
<https://lists.gnu.org/archive/html/guix-devel/2025-01/msg00167.html>.

* doc/guix.texi (Installation, Binary Installation): Change URL for
installation script.  Add ‘-O guix-install.sh’ to wget command line.

Change-Id: I83702cacc3bdf8d15d3972d2de17e1ce8607ed52
2025-04-09 13:05:06 +02:00
Leo Famulari
9b3c194c2d doc: Use the correct patch submission email address.
Reported by sleep_walker on #guix.

* doc/contributing.texi (Sending a Patch Series): Fix the email address
in the example.

Change-Id: If81243f9f23128a62201a77d328c158de94a4683
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2025-03-12 22:46:28 +09:00
Ludovic Courtès
bba1e723b0 doc: Add missing quotes in wget command for ‘guix-install.sh’.
* doc/guix.texi (Binary Installation): Add missing quotes in wget
command.

Change-Id: I4ebb50492070c298ccc4f02e62d90e875ffe44da
2025-01-21 16:14:02 +01:00
Ludovic Courtès
47d554602c doc: Change ‘guix-install.sh’ URL to gitweb.
The cgit interface at Savannah has been taken down.

* doc/guix.texi (Installation): Change ‘guix-install.sh’ URL to gitweb.

Change-Id: I45274bdb7713d16bafe2d0b464865362bddcf303
2025-01-21 14:13:48 +01:00
Florian Pelz
aaf86bbe1f doc: build: Handle when guile source is packed with zstd.
* doc/build.scm (guile-manual): Also include zstd in PATH.

Change-Id: Iff49825fe84121bff777ed45c03fb14af0a0e719
2024-09-05 00:19:07 +02:00
Ludovic Courtès
889fe96307 doc: Repair building non-English website manuals.
Fixes: <https://issues.guix.gnu.org/72257>.

* doc/build.scm (translated-texi-manuals): Copy the code
from (@ (guix self) translate-texi-manuals) rather than importing
it.  This fixes building doc/build.scm at version 1.4.0 with
recent Guix revisions.

Change-Id: Ia23425f824e4a6e619f32a28493b811c0e7c31d5
Signed-off-by: Florian Pelz <pelzflorian@pelzflorian.de>
2024-07-26 21:41:40 +02:00
Ludovic Courtès
efc8489651 doc: Adjust HTML patterns to correctly process Texinfo 6.8 output.
Prior to ceb5ef8347, (@ (gnu packages
texinfo) texinfo), which is what is used here, was pointing to version 6.7.

* doc/build.scm (html-manual-identifier-index)[build](worthy-entry?):
Adjust patterns for Texinfo 6.8.
(syntax-highlighted-html)[build](syntax-highlight): Likewise.
2023-06-08 23:52:23 +02:00
4 changed files with 221 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2019-2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
@@ -34,6 +34,7 @@
(guix profiles)
(guix utils)
(git)
(gnu packages)
(gnu packages base)
(gnu packages compression)
(gnu packages gawk)
@@ -52,8 +53,116 @@
(define file-append*
(@@ (guix self) file-append*))
(define translated-texi-manuals
(@@ (guix self) translate-texi-manuals))
(define (translated-texi-manuals source)
"Return the translated texinfo manuals built from SOURCE."
(define po4a
(specification->package "po4a"))
(define gettext-minimal
(specification->package "gettext-minimal"))
(define documentation
(file-append* source "doc"))
(define documentation-po
(file-append* source "po/doc"))
(define build
(with-imported-modules '((guix build utils) (guix build po))
#~(begin
(use-modules (guix build utils) (guix build po)
(ice-9 match) (ice-9 regex) (ice-9 textual-ports)
(ice-9 vlist) (ice-9 threads)
(srfi srfi-1))
(define (translate-tmp-texi po source output)
"Translate Texinfo file SOURCE using messages from PO, and write
the result to OUTPUT."
(invoke #+(file-append po4a "/bin/po4a-translate")
"-M" "UTF-8" "-L" "UTF-8" "-k" "0" "-f" "texinfo"
"-m" source "-p" po "-l" output))
(define (canonicalize-whitespace str)
;; Change whitespace (newlines, etc.) in STR to #\space.
(string-map (lambda (chr)
(if (char-set-contains? char-set:whitespace chr)
#\space
chr))
str))
(define* (translate-texi prefix po lang
#:key (extras '()))
"Translate the manual for one language LANG using the PO file.
PREFIX must be the prefix of the manual, 'guix' or 'guix-cookbook'. EXTRAS is
a list of extra files, such as '(\"contributing\")."
(for-each (lambda (file)
(translate-tmp-texi po (string-append file ".texi")
(string-append file "." lang
".texi.tmp")))
(cons prefix extras))
(for-each (lambda (file)
(let* ((texi (string-append file "." lang ".texi"))
(tmp (string-append texi ".tmp")))
(copy-file tmp texi)
(translate-cross-references texi po)))
(cons prefix extras)))
(define (available-translations directory domain)
;; Return the list of available translations under DIRECTORY for
;; DOMAIN, a gettext domain such as "guix-manual". The result is
;; a list of language/PO file pairs.
(filter-map (lambda (po)
(let ((base (basename po)))
(and (string-prefix? (string-append domain ".")
base)
(match (string-split base #\.)
((_ ... lang "po")
(cons lang po))))))
(find-files directory
"\\.[a-z]{2}(_[A-Z]{2})?\\.po$")))
(define parallel-jobs
;; Limit thread creation by 'n-par-for-each', mostly to put an
;; upper bound on memory usage.
(min (parallel-job-count) 4))
(mkdir #$output)
(copy-recursively #$documentation "."
#:log (%make-void-port "w"))
(for-each
(lambda (file)
(copy-file file (basename file)))
(find-files #$documentation-po ".*.po$"))
(setenv "GUIX_LOCPATH"
#+(file-append glibc-utf8-locales "/lib/locale"))
(setenv "PATH" #+(file-append gettext-minimal "/bin"))
(setenv "LC_ALL" "en_US.UTF-8")
(setlocale LC_ALL "en_US.UTF-8")
(n-par-for-each parallel-jobs
(match-lambda
((language . po)
(translate-texi "guix" po language
#:extras '("contributing"))))
(available-translations "." "guix-manual"))
(n-par-for-each parallel-jobs
(match-lambda
((language . po)
(translate-texi "guix-cookbook" po language)))
(available-translations "." "guix-cookbook"))
(for-each (lambda (file)
(install-file file #$output))
(append
(find-files "." "contributing\\..*\\.texi$")
(find-files "." "guix\\..*\\.texi$")
(find-files "." "guix-cookbook\\..*\\.texi$"))))))
(computed-file "guix-translated-texinfo" build))
(define info-manual
(@@ (guix self) info-manual))
@@ -78,6 +187,10 @@
%cookbook-languages
%manual-languages))
(define %latest-guix-version
;; Latest released version.
"1.4.0")
(define (texinfo-manual-images source)
"Return a directory containing all the images used by the user manual, taken
from SOURCE, the root of the source tree."
@@ -184,11 +297,16 @@ as well as images, OS examples, and translations."
(define %web-site-url
;; URL of the web site home page.
(or (getenv "GUIX_WEB_SITE_URL")
"/software/guix/"))
"/"))
(define %manual-css-url
;; URL of the main CSS file.
(in-vicinity %web-site-url
"themes/initial/css/manual.css"))
(define %makeinfo-html-options
;; Options passed to 'makeinfo --html'.
'("--css-ref=https://www.gnu.org/software/gnulib/manual.css"
`(,(string-append "--css-ref=" %manual-css-url)
"-c" "EXTRA_HEAD=<meta name=\"viewport\" \
content=\"width=device-width, initial-scale=1\" />"))
@@ -284,6 +402,9 @@ actual file name."
(loop rest))
((('strong _ ...) _ ...)
#t)
((('span ('@ ('class "category")) ;raw Texinfo 6.8
(? string-or-entity?) ...) rest ...)
#t)
((('span ('@ ('class "symbol-definition-category"))
(? string-or-entity?) ...) rest ...)
#t)
@@ -507,10 +628,16 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
;; Replace the ugly <strong> used for @deffn etc., which
;; translate to <dt>, with more stylable markup.
(('dt (@ ('id id)) category ... ('strong thing))
(('dt ('@ ('id id)) ;raw Texinfo 6.8
('span ('@ ('class "category")) category ...)
('span ('strong thing)
anchor))
(highlight-definition id category thing '()))
(('dt (@ ('id id)) category ... ('strong thing)
(? space?) ('em args ...))
(('dt (@ ('id id))
('span ('@ ('class "category")) category ...)
('span ('strong thing)
(? space?) ('em args ...)
anchor))
(highlight-definition id category thing args))
((tag ('@ attributes ...) body ...)
@@ -613,9 +740,10 @@ its <pre class=\"lisp\"> blocks (as produced by 'makeinfo --html')."
(define* (stylized-html source input
#:key
(latest-version %latest-guix-version)
(languages %languages)
(manual %manual)
(manual-css-url "/static/base/css/manual.css"))
(manual-css-url %manual-css-url))
"Process all the HTML files in INPUT; add them MANUAL-CSS-URL as a <style>
link, and add a menu to choose among LANGUAGES. Use the Guix PO files found
in SOURCE."
@@ -661,6 +789,14 @@ in SOURCE."
(href ,url))
,label)))
(define menu-item-separator
;; Thin horizontal line to separate drop-down menu items.
`(img (@ (class "hline")
(src ,(in-vicinity
#$%web-site-url
"themes/initial/img/h-separator.png"))
(alt ""))))
(define* (navigation-bar menus #:key split-node?)
;; Return the navigation bar showing all of MENUS.
`(header (@ (class "navbar"))
@@ -707,7 +843,43 @@ in SOURCE."
"https://translate.fedoraproject.org/projects/guix/documentation-cookbook/"
"https://translate.fedoraproject.org/projects/guix/documentation-manual/")))))
(define (stylized-html sxml file)
(define (version-menu-items language split-node?)
;; Return the menu items to select the version of the manual of
;; the type of medium (PDF, split-node, etc.).
(define language-extension
(if (string=? language "en")
""
(string-append "." language)))
(define pdf-link
(string-append (if split-node? "../" "")
#$manual language-extension ".pdf"))
(define version-links
(list (menu-item #$latest-version
(string-append
"/manual/" #$latest-version
"/" language
(if split-node? "/html_node" "")))
(menu-item "development"
(string-append
"/manual/devel/" language
(if split-node? "/html_node" "")))
menu-item-separator))
(append (if (string=? #$manual "guix")
version-links
'())
(list (if split-node?
(menu-item "single page"
(string-append "../" #$manual
language-extension
".html"))
(menu-item "multiple pages"
"html_node"))
(menu-item "PDF" pdf-link))))
(define (stylized-html sxml file language)
;; Return SXML, which was read from FILE, with additional
;; styling.
(define split-node?
@@ -730,9 +902,16 @@ in SOURCE."
;; TODO: Add "Contribute" menu, to report
;; errors, etc.
(list (menu-dropdown
#:label "Version"
#:items
(version-menu-items language
split-node?))
(menu-dropdown
#:label
`(img (@ (alt "Language")
(src "/static/base/img/language-picker.svg")))
(src #$(in-vicinity
%web-site-url
"themes/initial/img/language-picker.svg"))))
#:items
(language-menu-items file)))
#:split-node? split-node?)
@@ -744,13 +923,13 @@ in SOURCE."
((? string? str)
str))))
(define (process-html file)
(define (process-html file language)
;; Parse FILE and add links to translations. Install the result
;; to #$output.
(format (current-error-port) "processing ~a...~%" file)
(let* ((shtml (parameterize ((%strict-tokenizer? #t))
(call-with-input-file file html->shtml)))
(processed (stylized-html shtml file))
(processed (stylized-html shtml file language))
(base (string-drop file (string-length #$input)))
(target (string-append #$output base)))
(mkdir-p (dirname target))
@@ -758,6 +937,15 @@ in SOURCE."
(lambda (port)
(write-shtml-as-html processed port)))))
(define (input-file-language file)
;; Return the language code of FILE, an input file, as a string
;; like "sv" or "zh-cn".
(match (string-tokenize (string-drop file
(string-length #$input))
(char-set-complement
(char-set #\/)))
((language _ ...) language)))
;; Install a UTF-8 locale so we can process UTF-8 files.
(setenv "GUIX_LOCPATH"
#+(file-append glibc-utf8-locales "/lib/locale"))
@@ -768,7 +956,8 @@ in SOURCE."
(n-par-for-each (parallel-job-count)
(lambda (file)
(if (string-suffix? ".html" file)
(process-html file)
(let ((language (input-file-language file)))
(process-html file language))
;; Copy FILE as is to #$output.
(let* ((base (string-drop file (string-length #$input)))
(target (string-append #$output base)))
@@ -835,7 +1024,8 @@ makeinfo OPTIONS."
(let* ((texi (language->texi-file-name language))
(opts `("--html"
"-c" ,(string-append "TOP_NODE_UP_URL=/manual/"
language)
#$%latest-guix-version
"/" language)
#$@options
,texi)))
(format #t "building HTML manual for language '~a'...~%"
@@ -903,11 +1093,11 @@ makeinfo OPTIONS."
sed
tar
texinfo
texlive-base
texlive-scheme-basic
texlive-bin ;for GUIX_TEXMF
texlive-epsf
texlive-fonts-ec
texlive-tex-texinfo)))))
texlive-ec
texlive-texinfo)))))
(define build
(with-imported-modules '((guix build utils))
@@ -1293,6 +1483,7 @@ commit date (an integer)."
(setenv "PATH"
(string-append #+tar "/bin:"
#+xz "/bin:"
#+zstd "/bin:"
#+texinfo "/bin"))
(invoke "tar" "xf" #$(package-source guile))
(mkdir-p (string-append #$output "/en/html_node"))
@@ -1356,7 +1547,9 @@ by 'html-identifier-indexes'."
(let* ((root (canonicalize-path
(string-append (current-source-directory) "/..")))
(string-append (or (current-source-directory)
(string-append (getcwd) "/doc"))
"/..")))
(commit date (latest-commit+date root))
(version (or (getenv "GUIX_MANUAL_VERSION")
(string-take commit 7)))
@@ -1403,7 +1596,8 @@ by 'html-identifier-indexes'."
(merge-index-alists guix-split-node-indexes guile-split-node-indexes))
(format (current-error-port)
"building manual from work tree around commit ~a, ~a~%"
"building manual from work tree (~a) around commit ~a, ~a~%"
root
commit
(let* ((time (make-time time-utc 0 date))
(date (time-utc->date time)))

View File

@@ -1514,7 +1514,7 @@ that we can send the rest of the patches to.
@example
$ git send-email outgoing/0000-cover-letter.patch -a \
--to=guix-patches@@debbugs.gnu.org \
--to=guix-patches@@gnu.org \
$(etc/teams.scm cc-members ...)
$ rm outgoing/0000-cover-letter.patch # we don't want to resend it!
@end example

View File

@@ -22,7 +22,7 @@
@set SUBSTITUTE-URLS https://@value{SUBSTITUTE-SERVER-1} https://@value{SUBSTITUTE-SERVER-2}
@copying
Copyright @copyright{} 2012-2022 Ludovic Courtès@*
Copyright @copyright{} 2012-2022, 2025 Ludovic Courtès@*
Copyright @copyright{} 2013, 2014, 2016 Andreas Enge@*
Copyright @copyright{} 2013 Nikita Karetnikov@*
Copyright @copyright{} 2014, 2015, 2016 Alex Kost@*
@@ -642,7 +642,7 @@ to join! @xref{Contributing}, for information about how you can help.
@quotation Note
We recommend the use of this
@uref{https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh,
@uref{https://guix.gnu.org/install.sh,
shell installer script} to install Guix on top of a running GNU/Linux system,
thereafter called a @dfn{foreign distro}.@footnote{This section is concerned
with the installation of the package manager, which can be done on top of a
@@ -691,14 +691,14 @@ GNU@tie{}tar and Xz.
@c Note duplicated from the ``Installation'' node.
@quotation Note
We recommend the use of this
@uref{https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh,
@uref{https://guix.gnu.org/install.sh,
shell installer script}. The script automates the download, installation, and
initial configuration steps described below. It should be run as the root
user. As root, you can thus run this:
@example
cd /tmp
wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
wget -O guix-install.sh https://guix.gnu.org/install.sh
chmod +x guix-install.sh
./guix-install.sh
@end example

View File

@@ -1,7 +1,7 @@
# htmlxref.cnf - reference file for free Texinfo manuals on the web.
# Modified by Ludovic Courtès <ludo@gnu.org> for the GNU Guix manual.
htmlxrefversion=2022-12-18.15; # UTC
htmlxrefversion=2026-01-19.09; # UTC
# Copyright 2010-2020, 2022 Free Software Foundation, Inc.
#
@@ -415,7 +415,7 @@ guile-rpc mono ${GS}/guile-rpc/manual/guile-rpc.html
guile-rpc node ${GS}/guile-rpc/manual/html_node/
GUIX_ROOT = https://guix.gnu.org
GUIX = ${GUIX_ROOT}/manual
GUIX = ${GUIX_ROOT}/manual/1.4.0
guix.de mono ${GUIX}/de/guix.de.html
guix.de node ${GUIX}/de/html_node/
guix.es mono ${GUIX}/es/guix.es.html