From 7e34b7fb6396513560ea7e2994ee73d3e2a9820a Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 29 Aug 2021 17:45:22 -0500 Subject: [PATCH 2/2] * elpa-admin.el (elpaa--get-README): Docstring, export Org readmes Exports "README.org" files using ox-ascii.el, which is more readable on the ELPA Web site. --- elpa-admin.el | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/elpa-admin.el b/elpa-admin.el index ac72f2f..dfe56f0 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -1210,14 +1210,27 @@ return section under HEADER in package's main file." (buffer-string))))))) (defun elpaa--get-README (pkg-spec dir) - (elpaa--get-section - "Commentary" (elpaa--spec-get pkg-spec :readme - '("README" "README.rst" - ;; Most README.md files seem to be currently - ;; worse than the Commentary: section :-( - ;; "README.md" - "README.org")) - dir pkg-spec)) + "Return readme for PKG-SPEC in DIR as a string. +If readme is an Org file, render it to plain-text using Org +Export." + (let ((readme-file + (elpaa--spec-get pkg-spec :readme + '("README" "README.rst" + ;; Most README.md files seem to be currently + ;; worse than the Commentary: section :-( + ;; "README.md" + "README.org")))) + (pcase readme-file + ("README.org" + (require 'org) + (require 'ox) + (with-temp-buffer + (insert-file-contents readme-file) + (org-export-as 'ascii nil nil nil (:ascii-charset utf-8 :with-broken-links t))) + ) + (_ (elpaa--get-section + "Commentary" readme-file + dir pkg-spec))))) (defun elpaa--get-NEWS (pkg-spec dir) (let ((text -- 2.7.4