guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#65479] [PATCH core-updates 17/61] gnu: Add docbook-mathml-1.0.


From: Bruno Victal
Subject: [bug#65479] [PATCH core-updates 17/61] gnu: Add docbook-mathml-1.0.
Date: Fri, 6 Oct 2023 15:59:21 +0100
User-agent: Mozilla Thunderbird

On 2023-10-06 01:05, Maxim Cournoyer wrote:
>> +            (add-before 'install 'generate-catalog.xml
>> +              (lambda _
>> +                (let ((store-uri (string-append "file://"
>> +                                                #$output "/"
>> +                                                #$target "dbmathml.dtd")))
>> +                  (call-with-output-file "catalog.xml"
>> +                    (lambda (port)
>> +                      (sxml->xml
>> +                       `(*TOP*
>> +                         (*PI* xml "version='1.0'")
>> +                         (catalog (@ (xmlns 
>> "urn:oasis:names:tc:entity:xmlns:xml:catalog"))
>> +                           (public (@ (publicId "-//OASIS//DTD DocBook 
>> MathML Module V1.0//EN")
>> +                                      (uri ,store-uri)))
> 
> These lines are > 80 chars.  You could bind the public ID and namespace
> as variables to keep these lines shorter.

Would it perhaps be better to define the SXML catalog instead as a
separate procedure/phase and invoke it instead? i.e.

--8<---------------cut here---------------start------------->8---
;; Decouple catalog

(define make-dbmath-catalog-sxml
  #~(lambda* (#:key outputs #:allow-other-keys)
      (let* ((…something along the lines of (assoc-ref output "out")
              or (search-input-files outputs "dbmath.dtd"))
             (uri (string-append "file:/" …)))
        … SXML representation of catalog…))

(define-public
  …
  (add-before 'install 'generate-catalog.xml
    (lambda* (#:key outputs #:allow-other-keys)
      (call-with-output-file "catalog.xml"
        (lambda (port)
          (sxml->xml (#$make-dbmath-catalog-sxml outputs)))))))

;; alternatively, if this is valid…

(define-public
  (define make-dbmath-catalog-sxml …)
  (package
    …
    (add-before 'install 'generate-catalog.xml
      (lambda* (#:key outputs #:allow-other-keys)
        (call-with-output-file "catalog.xml"
          (lambda (port)
            (sxml->xml (#$make-dbmath-catalog-sxml outputs)))))))

--8<---------------cut here---------------end--------------->8---

Alternatively we could do as you suggest though I think the only thing
that's tenable to bind is the namespace. In general, binding public IDs
(and other kinds of ID) in XML Catalogs will quickly yield a rabbit hole
of bindings:

--8<---------------cut here---------------start------------->8---
(let ((namespace …)
      (public-id-for-entry-X …)
      (public-id-for-entry-Y …)
      …
      …
      (public-id-for-entry-γ …)
  …)) 

--8<---------------cut here---------------end--------------->8---

(can you picture what the SXML representations would look like for
something like [1] and [2]?)

Note¹: Though it's tempting to use string manipulation to make some
sort of parameterizable routine that can `map' and generate the full
URIs using only “version” parameters and perhaps other datums I'm
skeptical this is even a good idea. The XML Catalog spec says that
the URIs do not have to be resolvable or have any specific meaning
other than serve as a identifier for some resource. (it could be
something totally crazy, as long the document author and tools
understand that it represents some kind of external “thing”)

> There shouldn't be a trailing '.' in synopses.  'guix lint' should say so.

Nice catch!
I don't usually run `guix lint' as sometimes it can reindent things
with a worse result. I wonder if there's a way to control this behavior.


[1]: <https://docbook.org/xml/4.5/catalog.xml>
[2]: <https://docs.oasis-open.org/docbook/docbook/v5.2/cs01/catalog.xml>

¹ PS: Not really relevant for this series though this question will
be important when packaging the namespace-less variant of docbook-xsl
and generating proper catalogs for both docbook-xsl and docbook-xsl-nons.

-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]