Rens Oliemans <[email protected]> writes: >>> There are a couple of known limitations: >>> - Some github gists automatically redirect appropriately (f.e., >>> https://gist.github.com/4343164 redirects to >>> https://gist.github.com/tonyday567/4343164). gothub only supports the >>> "complete" url (/user/gistid). Those gist urls aren't supported yet. >>> - github supports two way of forcing the "raw" file, via >>> raw.github.com/... and via github.com/...?raw=true, I currently only >>> convert the first one. >>> - github issues pages are not rewritten, see above. >> >> I am wondering whether such unconvertable links might be captured when >> publishing with --debug flag. > > I am not sure what you mean with captured, do you mean "following" the > redirection?
I mean - throw an error if we have links that cannot be converted. That error will be visible during the build and can be quickly fixed by manually altering the problematic links. > Also, is it customary to change the subject line to one containing PATCH > halfway through the discussion? Having an attachment is sufficient. > --- a/.gitignore > +++ b/.gitignore > @@ -4,3 +4,4 @@ > patches/ > /.project > *patch > +*.sexp A canonical extension of Elisp data is .eld > +(push "./" load-path) > +(require 'rewrite-urls) We can simply use (load "rewrite-urls") Also, it is a good practice to use a non-generic prefix. Something like worg-urls. > +(add-hook 'org-export-before-parsing-functions #'add-alternative-links) Similarly, it is a good practice to prefix library function names with library name: worg-urls-add-alternative-links > +(defvar libredirect-url > "https://raw.githubusercontent.com/libredirect/instances/main/data.json") > +(defvar libredirect-data nil) It would be nice to have docstrings for all variables. > +(defcustom free-alternatives '((youtube . invidious) > + (github . gothub)) > + "Alist of free frontends to use. The CDR corresponds to a symbol that is > +known by libredirect, see https://codeberg.org/LibRedirect/instances.") First line of the docstring, by convention, should be a short, full sentence, briefly describing the purpose of a given variable. This is for the purposes of eldoc displaying nice description. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
