Skip to content

Commit

Permalink
feat: Export info: links for Org manual to https://orgmode.org URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Apr 16, 2022
1 parent 7b00d67 commit 63084bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions ox-hugo.el
Original file line number Diff line number Diff line change
Expand Up @@ -898,14 +898,16 @@ https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6b2a7cb20b357e73
;; `link' below is mostly derived from the code in
;; `org-info-map-html-url'.
(link (cond ((member manual org-info-emacs-documents)
(let* ((base-url "https://www.gnu.org/software/emacs/manual/html_node")
(node-url (if (string= node "Top")
"index.html"
(concat (org-info--expand-node-name node) ".html"))))
(format "%s/%s/%s" base-url manual node-url)))
((cdr (assoc manual org-info-other-documents)))
(t
(concat manual ".html")))))
(let* ((manual-url (if (string= (downcase manual) "org")
"https://orgmode.org/manual"
(format "https://www.gnu.org/software/emacs/manual/html_node/%s" manual)))
(node-url (if (string= node "Top")
"index.html"
(concat (org-info--expand-node-name node) ".html"))))
(format "%s/%s" manual-url node-url)))
((cdr (assoc manual org-info-other-documents)))
(t
(concat manual ".html")))))
(when (member format '(md hugo))
(format "[%s](%s \"%s\")" desc link title))))

Expand Down
2 changes: 1 addition & 1 deletion test/site/content/posts/coderef.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tags = ["src-block", "coderef", "annotation", "example-block"]
draft = false
+++

See [Org Info: Literal Examples](https://www.gnu.org/software/emacs/manual/html_node/org/Literal-Examples.html "Emacs Lisp: (info \"(org) Literal Examples\")").
See [Org Info: Literal Examples](https://orgmode.org/manual/Literal-Examples.html "Emacs Lisp: (info \"(org) Literal Examples\")").

In literal examples, Org interprets strings like `(ref:name)` as
labels, and use them as targets for special hyperlinks like
Expand Down
4 changes: 2 additions & 2 deletions test/site/content/posts/links-to-info-manual-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ tags = ["links", "info"]
draft = false
+++

- Link to an Org Info manual node: [Org Info: Search Options](https://www.gnu.org/software/emacs/manual/html_node/org/Search-Options.html "Emacs Lisp: (info \"(org) Search Options\")")
- Links to Top nodes of manuals: [Emacs Info](https://www.gnu.org/software/emacs/manual/html_node/emacs/index.html "Emacs Lisp: (info \"(emacs) Top\")") | [Org Info](https://www.gnu.org/software/emacs/manual/html_node/org/index.html "Emacs Lisp: (info \"(org) Top\")")
- Link to an Org Info manual node: [Org Info: Search Options](https://orgmode.org/manual/Search-Options.html "Emacs Lisp: (info \"(org) Search Options\")")
- Links to Top nodes of manuals: [Emacs Info](https://www.gnu.org/software/emacs/manual/html_node/emacs/index.html "Emacs Lisp: (info \"(emacs) Top\")") | [Org Info](https://orgmode.org/manual/index.html "Emacs Lisp: (info \"(org) Top\")")
- Link to an Emacs Info manual node: [Emacs Info: Point](https://www.gnu.org/software/emacs/manual/html_node/emacs/Point.html "Emacs Lisp: (info \"(emacs) Point\")") (same link but
with a custom description: [🛈 Emacs: Point](https://www.gnu.org/software/emacs/manual/html_node/emacs/Point.html "Emacs Lisp: (info \"(emacs) Point\")"))
- Link to an Emacs Lisp Info manual node: [Elisp Info: Lambda Expressions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions.html "Emacs Lisp: (info \"(elisp) Lambda Expressions\")")

0 comments on commit 63084bf

Please sign in to comment.