The second patch adds a regex to the filter replacing links to binary blobs in org files. I've included it as a separate patch because I'm not sure if it is considered desirable here.
You can see it in action here[0] and here[1], for each repo the .org file is in the repository along with the screenshot. Sometimes repositories on Github have a screenshot checked in and linked to from the about page. If there is such a link found in the org file, replace it with the path to the resource being hosted by cgit. Org image links look like this: [[./something.png]] This regex will find matches and replace the "./" with a URL constructed from $HTTPS, $HTTP_HOST and $CGIT_REPO_URL. Thanks for your work on cgit. Kind regards, Ruben [0] https://code.rkm.id.au/websockets-fighter/about/ [1] https://code.rkm.id.au/circe-notifications/about/ --- filters/html-converters/resources/org2html.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/filters/html-converters/resources/org2html.el b/filters/html-converters/resources/org2html.el index 8cac096..5fcd6bf 100755 --- a/filters/html-converters/resources/org2html.el +++ b/filters/html-converters/resources/org2html.el @@ -40,4 +40,10 @@ (when (get-buffer "*org2html*") (set-buffer "*org2html*") + (goto-char (point-min)) + (replace-regexp + "\\[\\[\\.\\/\\([^.]+\\)\\.\\(\\w+\\)\\]\\]" + (concat "[[" (if (string-equal "on" (getenv "HTTPS")) "https://" "http://") + (getenv "HTTP_HOST") "/" (getenv "CGIT_REPO_URL") + "/plain/\\1.\\2]]")) (princ (org-export-as 'html nil t t))) -- 2.4.5 _______________________________________________ CGit mailing list [email protected] http://lists.zx2c4.com/mailman/listinfo/cgit
