emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA/elpa-admin] Render README.org as HTML with ox-html


From: Stefan Monnier
Subject: Re: [ELPA/elpa-admin] Render README.org as HTML with ox-html
Date: Mon, 20 Sep 2021 00:29:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Thanks, now I have a better idea of what you want.  Hopefully this patch
> is close to what you have in mind.

Looks good, thanks.

> -    (with-temp-buffer
> -      (insert-file-contents (expand-file-name file srcdir))
> -      (buffer-string)))
> +    ;; Return FILE's contents.
> +    (let ((type
> +           (pcase (mailcap-extension-to-mime (file-name-extension file))
> +             ((and `nil
> +                   (guard (member-ignore-case
> +                           (file-name-extension file) '("md" "markdown"))))
> +              ;; `mailcap-extension-to-mime' returns nil for Markdown
> +              ;; files, at least on Emacs 26.3.
> +              "text/markdown")

Here `mailcap-extension-to-mime` could fail if `mailcap` is not yet
loaded.  Also, the problem you describe seems to depend on
/etc/mime.types rather than the version of Emacs.  Here (a Debian
machine) I got another problem which is that my /etc/mime.types says:

    [...]
    application/vnd.lotus-organizer                 or3 or2 org
    [...]

so I got an error from elpaa--section-to-* complaining that it doesn't
know how to convert `application/vnd.lotus-organizer` :-(

I think we're going to have to use our own mapping from extensions to
types :-(

After fixing this problem, I got another one which was in the part that
generates the "news" because it calls `elpaa--get-section` but was not
updated to adjust to the new return value.

I fixed these and made a few other cosmetic changes.
You can see the result in the `scratch/prettify-readme.org` branch of elpa.git

One thing I noticed in the resulting <pkg>.html file is that the doc is
not clearly delimited any more (e.g. it tends to use <h2> headers for
its own top-level entities whereas the surrounding HTML uses <h2> as
the header that introduces the doc).
:-(


        Stefan




reply via email to

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