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: Maxim Cournoyer
Subject: [bug#65479] [PATCH core-updates 17/61] gnu: Add docbook-mathml-1.0.
Date: Sat, 07 Oct 2023 13:01:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Bruno,

Bruno Victal <mirai@makinata.eu> writes:

> 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.
>
> ;; 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)))))))
>

I don't think that's valid, but I've not tried.

The idea is to try to meet the 80 chars limit while not making the
unique strings awkward to use (e.g. by breaking them on multiple lines).

I thought there's only 2 of them here so binding them in a let seemed
the best way to go.

Let's keep it simple :-).

-- 
Thanks,
Maxim





reply via email to

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