* [ELPA] Display package description as Org-exported text or HTML? @ 2021-05-31 10:09 Daniel Mendler 2021-05-31 10:29 ` Jean Louis 2021-05-31 13:12 ` [ELPA] Display package description as Org-exported text or HTML? Stefan Monnier 0 siblings, 2 replies; 15+ messages in thread From: Daniel Mendler @ 2021-05-31 10:09 UTC (permalink / raw) To: emacs-devel@gnu.org Is it possible to display a package description as Org-exported text or even as HTML on the ELPA website? See for example http://elpa.gnu.org/packages/consult.html, which shows a large Org source file as "Full description". Daniel ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 10:09 [ELPA] Display package description as Org-exported text or HTML? Daniel Mendler @ 2021-05-31 10:29 ` Jean Louis 2021-05-31 10:53 ` Daniel Mendler 2021-05-31 13:12 ` [ELPA] Display package description as Org-exported text or HTML? Stefan Monnier 1 sibling, 1 reply; 15+ messages in thread From: Jean Louis @ 2021-05-31 10:29 UTC (permalink / raw) To: Daniel Mendler; +Cc: emacs-devel@gnu.org * Daniel Mendler <mail@daniel-mendler.de> [2021-05-31 13:10]: > Is it possible to display a package description as Org-exported text or > even as HTML on the ELPA website? > > See for example http://elpa.gnu.org/packages/consult.html, which shows a > large Org source file as "Full description". That is not readable. You could export it into text and provide in the package as readable text such as README.txt together with README.org There are many lightweight markup languages like Org, Markdown, Asciidoc, txt2tags, reStructuredText, and they are all there usually with the purpose to get transformed in some other type of a document. Expecting that remote party will be able to read, understand the lightweight markup language, or even that remote servers should start supporting such is not reliable for expectation that communication should arrive to user. Don't expect README.txt to be readable only by Emacs or special software, it is better to provide README.txt as plain text. People read files with less, cat and other editors, there are file managers that will open files with any editor, not necesarily Emacs, some file managers will send text to browser. Thus, it is best to provide README.txt in plain text. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 10:29 ` Jean Louis @ 2021-05-31 10:53 ` Daniel Mendler 2021-05-31 11:04 ` Jean Louis 2021-05-31 12:13 ` Michael Heerdegen 0 siblings, 2 replies; 15+ messages in thread From: Daniel Mendler @ 2021-05-31 10:53 UTC (permalink / raw) To: emacs-devel@gnu.org; +Cc: Stefan Monnier On 5/31/21 12:29 PM, Jean Louis wrote: > * Daniel Mendler <mail@daniel-mendler.de> [2021-05-31 13:10]: >> Is it possible to display a package description as Org-exported text or >> even as HTML on the ELPA website? >> >> See for example http://elpa.gnu.org/packages/consult.html, which shows a >> large Org source file as "Full description". > > That is not readable. > ... > Thus, it is best to provide README.txt in plain text. Jean, did you read my question? I am asking how to avoid this problem you are reiterating. To make my question more explicit: Why is ELPA not automatically converting README.org to README.txt and using it on the ELPA website? Stefan Monnier advised me to not make generated files part of the repository. Originally, I generated a vertico.texi file from the README.org. Fortunately the ELPA build process is doing that automatically for me now. It would be great if the same build step could be used for the website. Daniel ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 10:53 ` Daniel Mendler @ 2021-05-31 11:04 ` Jean Louis 2021-05-31 12:13 ` Michael Heerdegen 1 sibling, 0 replies; 15+ messages in thread From: Jean Louis @ 2021-05-31 11:04 UTC (permalink / raw) To: Daniel Mendler; +Cc: Stefan Monnier, emacs-devel@gnu.org * Daniel Mendler <mail@daniel-mendler.de> [2021-05-31 13:54]: > On 5/31/21 12:29 PM, Jean Louis wrote: > > * Daniel Mendler <mail@daniel-mendler.de> [2021-05-31 13:10]: > >> Is it possible to display a package description as Org-exported text or > >> even as HTML on the ELPA website? > >> > >> See for example http://elpa.gnu.org/packages/consult.html, which shows a > >> large Org source file as "Full description". > > > > That is not readable. > > ... > > Thus, it is best to provide README.txt in plain text. > > Jean, did you read my question? I am asking how to avoid this problem > you are reiterating. Yes, I have fully understand it and answered that I find plain text most universally readable file. README should be just that in plain text, without any extensions. I don't oppose using README.org but I oppose usin README.org or README.md without plain text README, as those are less accessible, less readable markups and allow too many variations. By the way, the package description for consult says: Consult has been inspired by Counsel. Some of the Consult commands originated in the Counsel package or the Selectrum wiki. See the README for a full list of contributors. [back] but there is no `README' in the ~/.emacs.d/elpa/consult-20210519.1000/ There are other packages that do have README in the directory, maybe you could include it in the package. IMHO, README as such should be user friendly, not written in any lightweight markup language. That does not mean that I oppose generation of HTML or using README.org, I just think that plain text README should be there and readable by any GNU tools on command line, or any editor, not just Emacs, or markdown supported editor. See (info "(elisp) Multi-file Packages") where it says: ,---- | If the content directory contains a file named ‘README’, this file is | used as the long description (overriding any ‘;;; Commentary:’ section). `---- But Markdown and Org mode silently override decades long readable README files. I just wonder why. Org file can look so nice and readable, but yours is not due to a lot of markup, that is why I say there should should be simple readable version. Markdown may look nice and readable but yet people may include any kind of HTML inside and make it very unreadable. For those reasons it would be better to have plain text README, while Markdown, Org, and other markups could be used for other different purposes. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 10:53 ` Daniel Mendler 2021-05-31 11:04 ` Jean Louis @ 2021-05-31 12:13 ` Michael Heerdegen 2021-05-31 12:29 ` Jean Louis 1 sibling, 1 reply; 15+ messages in thread From: Michael Heerdegen @ 2021-05-31 12:13 UTC (permalink / raw) To: emacs-devel Daniel Mendler <mail@daniel-mendler.de> writes: > Why is ELPA not automatically converting README.org to README.txt and > using it on the ELPA website? The last time I raised the question, the answer was that we want that but still someone has to implement it. Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 12:13 ` Michael Heerdegen @ 2021-05-31 12:29 ` Jean Louis 2021-05-31 13:19 ` Stefan Monnier 0 siblings, 1 reply; 15+ messages in thread From: Jean Louis @ 2021-05-31 12:29 UTC (permalink / raw) To: Michael Heerdegen; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 630 bytes --] * Michael Heerdegen <michael_heerdegen@web.de> [2021-05-31 15:14]: > Daniel Mendler <mail@daniel-mendler.de> writes: > > > Why is ELPA not automatically converting README.org to README.txt and > > using it on the ELPA website? > > The last time I raised the question, the answer was that we want that > but still someone has to implement it. Find attached the script org-to-html that will convert .org files with: cat file | org-to-html > file.html -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://stallmansupport.org/ [-- Attachment #2: org-to-html --] [-- Type: text/plain, Size: 517 bytes --] #!/usr/bin/emacs --script (require 'org) (require 'ox) (require 'ox-html) (defun org-to-html () (let* ((org (with-temp-buffer (progn (condition-case nil (let (line) (while (setq line (read-from-minibuffer "")) (insert line) (insert "\n"))) (error nil)) (buffer-string)))) (html (with-temp-buffer (let ((org-export-with-toc nil)) (insert org) (org-export-to-buffer 'html (current-buffer) nil nil nil t) (buffer-string))))) (prin1 html))) (org-to-html) ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 12:29 ` Jean Louis @ 2021-05-31 13:19 ` Stefan Monnier 2021-05-31 14:08 ` Michael Heerdegen 0 siblings, 1 reply; 15+ messages in thread From: Stefan Monnier @ 2021-05-31 13:19 UTC (permalink / raw) To: Michael Heerdegen; +Cc: emacs-devel > Find attached the script org-to-html that will convert .org files Yes, that's the easy part for markdown as well. The part that requires work (not necessarily very hard, but work nonetheless) is to integrate it with elpa-admin.el, such as: - run those scripts within a `bwrap`. - arrange for the output to fit *within* the existing HTML page (i.e. we don't want an HTML page from the .org, we want just a section of an HTML page). Other things to improve along the way: - make it possible to fold/unfold the various sections of those web pages - add a "menu/tableofcontents". Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 13:19 ` Stefan Monnier @ 2021-05-31 14:08 ` Michael Heerdegen 2021-05-31 14:59 ` Stefan Monnier 0 siblings, 1 reply; 15+ messages in thread From: Michael Heerdegen @ 2021-05-31 14:08 UTC (permalink / raw) To: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > Other things to improve along the way: > - make it possible to fold/unfold the various sections of those web pages > - add a "menu/tableofcontents". And I think we also want to allow embedded images (e.g. animated gifs). This would also be a nice way to present the capabilities of Emacs to the outside world. I really don't understand why working on this isn't a priority. Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 14:08 ` Michael Heerdegen @ 2021-05-31 14:59 ` Stefan Monnier 2021-05-31 15:14 ` Michael Heerdegen 0 siblings, 1 reply; 15+ messages in thread From: Stefan Monnier @ 2021-05-31 14:59 UTC (permalink / raw) To: Michael Heerdegen; +Cc: emacs-devel Michael Heerdegen [2021-05-31 16:08:28] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Other things to improve along the way: >> - make it possible to fold/unfold the various sections of those web pages >> - add a "menu/tableofcontents". > > And I think we also want to allow embedded images (e.g. animated gifs). > > This would also be a nice way to present the capabilities of Emacs to > the outside world. I really don't understand why working on this isn't > a priority. For me there are two problems: - I don't find it fun - I live in the stone age of web technologies Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 14:59 ` Stefan Monnier @ 2021-05-31 15:14 ` Michael Heerdegen 2021-05-31 15:36 ` Stefan Monnier 0 siblings, 1 reply; 15+ messages in thread From: Michael Heerdegen @ 2021-05-31 15:14 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: > > This would also be a nice way to present the capabilities of Emacs to > > the outside world. I really don't understand why working on this isn't > > a priority. > > For me there are two problems: > - I don't find it fun > - I live in the stone age of web technologies Maybe there are people here for whom this is an easy exercise? Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 15:14 ` Michael Heerdegen @ 2021-05-31 15:36 ` Stefan Monnier 2021-05-31 17:23 ` [ELPA PATCH] Add badge generator to elpa-admin.el Daniel Mendler 0 siblings, 1 reply; 15+ messages in thread From: Stefan Monnier @ 2021-05-31 15:36 UTC (permalink / raw) To: Michael Heerdegen; +Cc: emacs-devel Michael Heerdegen [2021-05-31 17:14:32] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >> > This would also be a nice way to present the capabilities of Emacs to >> > the outside world. I really don't understand why working on this isn't >> > a priority. >> >> For me there are two problems: >> - I don't find it fun >> - I live in the stone age of web technologies > > Maybe there are people here for whom this is an easy exercise? That was my hope when I posted the above list ;-) Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
* [ELPA PATCH] Add badge generator to elpa-admin.el 2021-05-31 15:36 ` Stefan Monnier @ 2021-05-31 17:23 ` Daniel Mendler 2021-05-31 18:02 ` Daniel Mendler 0 siblings, 1 reply; 15+ messages in thread From: Daniel Mendler @ 2021-05-31 17:23 UTC (permalink / raw) To: Stefan Monnier, Michael Heerdegen; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 673 bytes --] On 5/31/21 5:36 PM, Stefan Monnier wrote: > Michael Heerdegen [2021-05-31 17:14:32] wrote: >> Stefan Monnier <monnier@iro.umontreal.ca> writes: >>>> This would also be a nice way to present the capabilities of Emacs to >>>> the outside world. I really don't understand why working on this isn't >>>> a priority. >>> >>> For me there are two problems: >>> - I don't find it fun >>> - I live in the stone age of web technologies >> >> Maybe there are people here for whom this is an easy exercise? > > That was my hope when I posted the above list ;-) I can relate to your sentiment above. But I can at least help out with a patch to elpa-admin.el for the badges. Daniel [-- Attachment #2: 0001-elpa-admin.el-Generate-SVG-badges.patch --] [-- Type: text/x-diff, Size: 6409 bytes --] From d882e9a079a1c25c53355843914b94afafbb236b Mon Sep 17 00:00:00 2001 From: Daniel Mendler <mail@daniel-mendler.de> Date: Mon, 31 May 2021 19:10:36 +0200 Subject: [PATCH] * elpa-admin.el: Generate SVG badges (elpaa--string-width): New function. (elpaa--make-badge): New function. (elpaa--make-one-package): Use `elpaa--make-badge`. (elpaa--html-make-pkg): Add link to badge. --- elpa-admin.el | 106 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/elpa-admin.el b/elpa-admin.el index 48fc5decdc..4c1655dd5f 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -626,6 +626,94 @@ Return non-nil if a new tarball was created." (delete-file tarball) (elpaa--make-one-package pkg-spec tarball)))) +(defun elpaa--string-width (str) + "Determine string width in pixels of STR." + (let ((output (shell-command-to-string + (format "convert -debug annotate xc: -font DejaVu-Sans\ + -pointsize 110 -annotate 0 %s null: 2>&1" + (shell-quote-argument str))))) + (save-match-data + (if (string-match + "Metrics:.*?width: \\([0-9]+\\)" + output) + (string-to-number (match-string 1 output)) + (error "Could not determine string width"))))) + +(defun elpaa--make-badge (file left right) + "Make badge svg FILE with LEFT and RIGHT string." + (let* ((lw (elpaa--string-width left)) + (rw (elpaa--string-width right)) + (pad (elpaa--string-width "x")) + (color "#bb3955") + (width (/ (+ lw rw (* 4 pad)) 10)) + (offset -10) ;; Small alignment correction + (ctx `((offset . ,offset) + (left . ,left) + (right . ,right) + (lw . ,lw) + (rw . ,rw) + (width . ,width) + (color . ,color) + (pad . ,pad)))) + (with-temp-buffer + (insert + (replace-regexp-in-string + "[ \t\n]+" " " + (replace-regexp-in-string + "{\\([^}]+\\)}" + (lambda (str) + (format "%s" (eval (read (match-string 1 str)) ctx))) + (replace-regexp-in-string + "'" "\"" + "<?xml version='1.0'?> +<svg xmlns='http://www.w3.org/2000/svg' + xmlns:xlink='http://www.w3.org/1999/xlink' + width='{width}' + height='20' + role='img' + aria-label='{left}: {right}'> + <title>{left}: {right}</title> + <linearGradient id='s' x2='0' y2='100%'> + <stop offset='0' stop-color='#bbb' stop-opacity='.1'/> + <stop offset='1' stop-opacity='.1'/> + </linearGradient> + <clipPath id='r'> + <rect width='{width}' height='20' rx='3' fill='#fff'/> + </clipPath> + <g clip-path='url(#r)'> + <rect width='{(/ (+ lw (* 2 pad)) 10)}' + height='20' fill='#555'/> + <rect x='{(1- (/ (+ lw (* 2 pad)) 10))}' + width='{width}' height='20' fill='{color}'/> + <rect width='{width}' height='20' fill='url(#s)'/> + </g> + <g fill='#fff' + text-anchor='middle' + font-family='Verdana,Geneva,DejaVu Sans,sans-serif' + font-size='110' + text-rendering='geometricPrecision'> + <text aria-hidden='true' + x='{(+ (/ lw 2) pad offset)}' + y='150' + fill='#010101' fill-opacity='.3' + transform='scale(.1)' textLength='{lw}'>{left}</text> + <text x='{(+ (/ lw 2) pad offset)}' + y='140' transform='scale(.1)' + fill='#fff' + textLength='{lw}'>{left}</text> + <text aria-hidden='true' + x='{(+ lw (/ rw 2) (* 3 pad) offset)}' + y='150' + fill='#010101' fill-opacity='.3' + transform='scale(.1)' textLength='{rw}'>{right}</text> + <text x='{(+ lw (/ rw 2) (* 3 pad) offset)}' + y='140' + transform='scale(.1)' + fill='#fff' textLength='{rw}'>{right}</text> + </g> +</svg>")))) + (write-region (point-min) (point-max) file)))) + (defun elpaa--make-one-package (pkg-spec &optional one-tarball) "Build the new tarballs (if needed) for PKG-SPEC. If ONE-TARBALL is non-nil, don't try and select some other revision and @@ -658,6 +746,8 @@ place the resulting tarball into the file named ONE-TARBALL." (devel-vers (concat vers (if (string-match "[0-9]\\'" vers) ".") "0." date-version)) + (release-badge (format "%s/%s.svg" elpaa--release-subdir pkgname)) + (devel-badge (format "%s/%s.svg" elpaa--devel-subdir pkgname)) (tarball (or one-tarball (concat elpaa--devel-subdir (format "%s-%s.tar" pkgname devel-vers)))) @@ -704,7 +794,20 @@ place the resulting tarball into the file named ONE-TARBALL." (elpaa--get-release-revision dir pkg-spec vers (plist-get (cdr pkg-spec) :version-map)))) - (elpaa--release-email pkg-spec metadata dir))))))))) + (elpaa--make-badge release-badge + (format "%s ELPA" elpaa--name) + (format "%s %s" pkgname vers)) + (elpaa--release-email pkg-spec metadata dir))))) + + ;; Generate missing badges + (unless (and (not new) (file-exists-p devel-badge)) + (elpaa--make-badge devel-badge + (format "%s-devel ELPA" elpaa--name) + (format "%s %s" pkgname devel-vers))) + (unless (file-exists-p release-badge) + (elpaa--make-badge release-badge + (format "%s ELPA" elpaa--name) + (format "%s %s" pkgname vers))))))) (defun elpaa--call (destination program &rest args) "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS. @@ -1103,6 +1206,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." pkg-spec (or (cdr (assoc :url (aref (cdr pkg) 4))) (elpaa--get-prop "URL" name srcdir mainsrcfile))) + (insert (format "<dt>Badge</dt><dd><img src=\"%s.svg\"/></dd>\n" (elpaa--html-quote name))) (insert "</dl>") (insert (format "<p>To install this package, run in Emacs:</p> <pre>M-x <span class=\"kw\">package-install</span> RET <span class=\"kw\">%s</span> RET</pre>" -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [ELPA PATCH] Add badge generator to elpa-admin.el 2021-05-31 17:23 ` [ELPA PATCH] Add badge generator to elpa-admin.el Daniel Mendler @ 2021-05-31 18:02 ` Daniel Mendler 2021-06-04 16:00 ` Michael Heerdegen 0 siblings, 1 reply; 15+ messages in thread From: Daniel Mendler @ 2021-05-31 18:02 UTC (permalink / raw) To: Stefan Monnier, Michael Heerdegen; +Cc: emacs-devel [-- Attachment #1: Type: text/plain, Size: 411 bytes --] On 5/31/21 7:23 PM, Daniel Mendler wrote: > I can relate to your sentiment above. But I can at least help out with a > patch to elpa-admin.el for the badges. I attached an improved version, which adds the missing badges and badge links to the existing html files. In principle this patch should work with the existing archive. If a new release and html page is generated, a new badge is generated too. Daniel [-- Attachment #2: 0001-elpa-admin.el-Generate-SVG-badges.patch --] [-- Type: text/x-diff, Size: 7245 bytes --] From a85621396db68c3a2d6c93855a525145ec3a014f Mon Sep 17 00:00:00 2001 From: Daniel Mendler <mail@daniel-mendler.de> Date: Mon, 31 May 2021 19:10:36 +0200 Subject: [PATCH] * elpa-admin.el: Generate SVG badges (elpaa--string-width): New function. (elpaa--make-badge): New function. (elpaa--add-badge-link): New function. (elpaa--make-one-package): Use `elpaa--make-badge` and `elpaa--add-badge-link`. (elpaa--html-make-pkg): Add link to badge, call `elpaa--make-badge`. --- elpa-admin.el | 123 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 1 deletion(-) diff --git a/elpa-admin.el b/elpa-admin.el index 48fc5decdc..823b297cfc 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -626,6 +626,107 @@ Return non-nil if a new tarball was created." (delete-file tarball) (elpaa--make-one-package pkg-spec tarball)))) +(defun elpaa--string-width (str) + "Determine string width in pixels of STR." + (let ((output (shell-command-to-string + (format "convert -debug annotate xc: -font DejaVu-Sans\ + -pointsize 110 -annotate 0 %s null: 2>&1" + (shell-quote-argument str))))) + (save-match-data + (if (string-match + "Metrics:.*?width: \\([0-9]+\\)" + output) + (string-to-number (match-string 1 output)) + (error "Could not determine string width"))))) + +(defun elpaa--make-badge (file left right) + "Make badge svg FILE with LEFT and RIGHT string." + (let* ((lw (elpaa--string-width left)) + (rw (elpaa--string-width right)) + (pad (elpaa--string-width "x")) + (color "#bb3955") + (width (/ (+ lw rw (* 4 pad)) 10)) + (offset -10) ;; Small alignment correction + (ctx `((offset . ,offset) + (left . ,left) + (right . ,right) + (lw . ,lw) + (rw . ,rw) + (width . ,width) + (color . ,color) + (pad . ,pad)))) + (with-temp-buffer + (insert + (replace-regexp-in-string + "[ \t\n]+" " " + (replace-regexp-in-string + "{\\([^}]+\\)}" + (lambda (str) + (format "%s" (eval (read (match-string 1 str)) ctx))) + (replace-regexp-in-string + "'" "\"" + "<?xml version='1.0'?> +<svg xmlns='http://www.w3.org/2000/svg' + xmlns:xlink='http://www.w3.org/1999/xlink' + width='{width}' + height='20' + role='img' + aria-label='{left}: {right}'> + <title>{left}: {right}</title> + <linearGradient id='s' x2='0' y2='100%'> + <stop offset='0' stop-color='#bbb' stop-opacity='.1'/> + <stop offset='1' stop-opacity='.1'/> + </linearGradient> + <clipPath id='r'> + <rect width='{width}' height='20' rx='3' fill='#fff'/> + </clipPath> + <g clip-path='url(#r)'> + <rect width='{(/ (+ lw (* 2 pad)) 10)}' + height='20' fill='#555'/> + <rect x='{(1- (/ (+ lw (* 2 pad)) 10))}' + width='{width}' height='20' fill='{color}'/> + <rect width='{width}' height='20' fill='url(#s)'/> + </g> + <g fill='#fff' + text-anchor='middle' + font-family='Verdana,Geneva,DejaVu Sans,sans-serif' + font-size='110' + text-rendering='geometricPrecision'> + <text aria-hidden='true' + x='{(+ (/ lw 2) pad offset)}' + y='150' + fill='#010101' fill-opacity='.3' + transform='scale(.1)' textLength='{lw}'>{left}</text> + <text x='{(+ (/ lw 2) pad offset)}' + y='140' transform='scale(.1)' + fill='#fff' + textLength='{lw}'>{left}</text> + <text aria-hidden='true' + x='{(+ lw (/ rw 2) (* 3 pad) offset)}' + y='150' + fill='#010101' fill-opacity='.3' + transform='scale(.1)' textLength='{rw}'>{right}</text> + <text x='{(+ lw (/ rw 2) (* 3 pad) offset)}' + y='140' + transform='scale(.1)' + fill='#fff' textLength='{rw}'>{right}</text> + </g> +</svg>")))) + (write-region (point-min) (point-max) file)))) + +(defun elpaa--add-badge-link (file name) + "Add badge link to FILE for package NAME." + (with-temp-buffer + (insert-file-contents file) + (insert + (prog1 + (replace-regexp-in-string "</dl>" + (format "<dt>Badge</dt><dd><img src=\"%s.svg\"/></dd>\n</dl>" + (elpaa--html-quote name)) + (buffer-string)) + (erase-buffer))) + (write-region (point-min) (point-max) file))) + (defun elpaa--make-one-package (pkg-spec &optional one-tarball) "Build the new tarballs (if needed) for PKG-SPEC. If ONE-TARBALL is non-nil, don't try and select some other revision and @@ -704,7 +805,23 @@ place the resulting tarball into the file named ONE-TARBALL." (elpaa--get-release-revision dir pkg-spec vers (plist-get (cdr pkg-spec) :version-map)))) - (elpaa--release-email pkg-spec metadata dir))))))))) + (elpaa--release-email pkg-spec metadata dir))))) + + ;; Generate missing badges (temporary code) + (let ((release-badge (format "%s/%s.svg" elpaa--release-subdir pkgname)) + (devel-badge (format "%s/%s.svg" elpaa--devel-subdir pkgname)) + (release-html (format "%s/%s.html" elpaa--release-subdir pkgname)) + (devel-html (format "%s/%s.html" elpaa--devel-subdir pkgname))) + (unless (file-exists-p devel-badge) + (elpaa--make-badge devel-badge + (format "%s-devel ELPA" elpaa--name) + (format "%s %s" pkgname devel-vers)) + (elpaa--add-badge-link devel-html pkgname)) + (unless (file-exists-p release-badge) + (elpaa--make-badge release-badge + (format "%s ELPA" elpaa--name) + (format "%s %s" pkgname vers)) + (elpaa--add-badge-link release-html pkgname))))))) (defun elpaa--call (destination program &rest args) "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS. @@ -1073,6 +1190,9 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." (mainsrcfile (expand-file-name (elpaa--main-file pkg-spec) srcdir)) (desc (aref (cdr pkg) 2))) (cl-assert (equal name (car pkg-spec))) + (elpaa--make-badge (concat name ".svg") + (format "%s ELPA" elpaa--name) + (format "%s %s" name latest)) (with-temp-buffer (insert (elpaa--html-header (format "%s ELPA - %s" elpaa--name name) @@ -1103,6 +1223,7 @@ Rename DIR/ to PKG-VERS/, and return the descriptor." pkg-spec (or (cdr (assoc :url (aref (cdr pkg) 4))) (elpaa--get-prop "URL" name srcdir mainsrcfile))) + (insert (format "<dt>Badge</dt><dd><img src=\"%s.svg\"/></dd>\n" (elpaa--html-quote name))) (insert "</dl>") (insert (format "<p>To install this package, run in Emacs:</p> <pre>M-x <span class=\"kw\">package-install</span> RET <span class=\"kw\">%s</span> RET</pre>" -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [ELPA PATCH] Add badge generator to elpa-admin.el 2021-05-31 18:02 ` Daniel Mendler @ 2021-06-04 16:00 ` Michael Heerdegen 0 siblings, 0 replies; 15+ messages in thread From: Michael Heerdegen @ 2021-06-04 16:00 UTC (permalink / raw) To: Stefan Monnier; +Cc: Daniel Mendler, emacs-devel Daniel Mendler <mail@daniel-mendler.de> writes: > On 5/31/21 7:23 PM, Daniel Mendler wrote: > > I can relate to your sentiment above. But I can at least help out with a > > patch to elpa-admin.el for the badges. > > I attached an improved version, which adds the missing badges and badge > links to the existing html files. In principle this patch should work > with the existing archive. If a new release and html page is generated, > a new badge is generated too. Thanks, Daniel! Stefan, your opinion...? TIA, Michael. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [ELPA] Display package description as Org-exported text or HTML? 2021-05-31 10:09 [ELPA] Display package description as Org-exported text or HTML? Daniel Mendler 2021-05-31 10:29 ` Jean Louis @ 2021-05-31 13:12 ` Stefan Monnier 1 sibling, 0 replies; 15+ messages in thread From: Stefan Monnier @ 2021-05-31 13:12 UTC (permalink / raw) To: Daniel Mendler; +Cc: emacs-devel@gnu.org Daniel Mendler [2021-05-31 12:09:30] wrote: > Is it possible to display a package description as Org-exported text or > even as HTML on the ELPA website? Yes. It just takes a patch to elpa.git's `elpa-admin.el` first ;-) It would be most welcome. Stefan ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-06-04 16:00 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-05-31 10:09 [ELPA] Display package description as Org-exported text or HTML? Daniel Mendler 2021-05-31 10:29 ` Jean Louis 2021-05-31 10:53 ` Daniel Mendler 2021-05-31 11:04 ` Jean Louis 2021-05-31 12:13 ` Michael Heerdegen 2021-05-31 12:29 ` Jean Louis 2021-05-31 13:19 ` Stefan Monnier 2021-05-31 14:08 ` Michael Heerdegen 2021-05-31 14:59 ` Stefan Monnier 2021-05-31 15:14 ` Michael Heerdegen 2021-05-31 15:36 ` Stefan Monnier 2021-05-31 17:23 ` [ELPA PATCH] Add badge generator to elpa-admin.el Daniel Mendler 2021-05-31 18:02 ` Daniel Mendler 2021-06-04 16:00 ` Michael Heerdegen 2021-05-31 13:12 ` [ELPA] Display package description as Org-exported text or HTML? Stefan Monnier
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).