From 834f01f267f2f8ab677d0de33e12034c06dbabd6 Mon Sep 17 00:00:00 2001 From: YugaEgo Date: Wed, 12 Jan 2022 12:24:09 +0200 Subject: [PATCH] Provide more control over linked documentation * README: (:doc-html, :resources): Document new properties. * elpa-admin.el (elpaa--html-insert-resources): New function. (elpaa--html-make-pkg): Use new function. (elpaa--build-Info-1): Do not generate HTML doc if :doc-html is 'ignore'. --- README | 13 +++++++++++++ elpa-admin.el | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README b/README index a0e34ff78c..b83e8dfd1a 100644 --- a/README +++ b/README @@ -146,6 +146,19 @@ Name of the documentation file for the package. It can be either an Info file, a Texinfo file, or an Org file. FILE can also be a list of those. +** =:doc-html= +By default, if =:doc= specification contains a Texinfo file, then HTML +documentation is generated from it; the link to the generated HTML +file is added to the package page. To disable this behavior, set +=:doc-html= to ~ignore~. + +** =:resoures LINKS= +Enables 'Additional Resources' section on the package page. This must +be an association list of the titles and URLs of online resources. +For example: + + (("User Manual" . "https://example.tld/manual.html")) + ** =:make TARGET= Indicates that we should run ~make TARGET~ in order to build some files. This is run before processing =:doc=, so it can be used to generate diff --git a/elpa-admin.el b/elpa-admin.el index d570c3c6aa..c09e22241d 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -1469,6 +1469,13 @@ arbitrary code." )) (insert "\n")))) +(defun elpaa--html-insert-resources (pkg-spec) + (when-let ((links (elpaa--spec-get pkg-spec :resources))) + (insert "
Additional Resources
\n") + (dolist (link links) + (insert "" (car link) "\n")) + (insert "
\n"))) + (defun elpaa--html-make-pkg (pkg pkg-spec files srcdir) (let* ((name (symbol-name (car pkg))) (latest (package-version-join (aref (cdr pkg) 0))) @@ -1517,6 +1524,7 @@ arbitrary code." (elpaa--get-prop "URL" name srcdir mainsrcfile))) (insert (format "
Badge
\n" (elpaa--html-quote name))) (elpaa--html-insert-docs pkg-spec) + (elpaa--html-insert-resources pkg-spec) (insert "") (insert (format "

To install this package, run in Emacs:

M-x package-install RET %s RET
" @@ -2106,7 +2114,9 @@ relative to elpa root." t "makeinfo" "--no-split" docfile "-o" info-file) (message "%s" (buffer-string))) - (when html-dir (elpaa--html-build-doc pkg-spec docfile html-dir)) + (let ((doc-html (elpaa--spec-get pkg-spec :doc-html))) + (when (and html-dir (not (equal doc-html 'ignore))) + (elpaa--html-build-doc pkg-spec docfile html-dir))) (setq docfile info-file))) -- 2.34.1