Commit 94a73856e1

94a73856e1597e1aa8fd2c9462d41c041b8e4207

parent: 16ff1fdee9

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-21 19:15 UTC

Export elisp:, shell:, help: and shortdoc: links to LaTeX as Emacs does

Layout: unified · split

Sources/OrgCore/Export/LaTeXExport.swift +1 −1
@@ -1608,7 +1608,7 @@ final class LaTeXRenderer {
1608 let uri = path.hasPrefix("//") ? "file:" + path : path.hasPrefix("/") ? "file://" + path : path 1608 let uri = path.hasPrefix("//") ? "file:" + path : path.hasPrefix("/") ? "file://" + path : path
1609 let protected = Self.protect(uri) 1609 let protected = Self.protect(uri)
1610 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}" 1610 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}"
1611 case "http", "https", "ftp", "mailto", "news": 1611 case "http", "https", "ftp", "mailto", "news", "elisp", "shell", "help", "shortdoc":
1612 let protected = Self.protect(type + ":" + path) 1612 let protected = Self.protect(type + ":" + path)
1613 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}" 1613 return description.map { "\\href{\(protected)}{\($0)}" } ?? "\\url{\(protected)}"
1614 default: 1614 default:
Tests/OrgCoreTests/LaTeXExportTests.swift +1
@@ -106,6 +106,7 @@ struct LaTeXExportTests {
106 "Snippets @@latex:\\newpage@@ and @@html:<br>@@ gone. Also @@html:x@@ @@html:y@@ end.\n@@html:z@@ start\n", 106 "Snippets @@latex:\\newpage@@ and @@html:<br>@@ gone. Also @@html:x@@ @@html:y@@ end.\n@@html:z@@ start\n",
107 "Line one\\\\\nline two \\\\\n\\\\\nafter\n", 107 "Line one\\\\\nline two \\\\\n\\\\\nafter\n",
108 "Links: [[https://orgmode.org][Org & co]] <https://a.b/c_d> https://x.y/%20 [[mailto:me@x.org]] [[file:doc.pdf][the doc]] [[./rel/file.txt]] [[file:/abs/path.org]]\n", 108 "Links: [[https://orgmode.org][Org & co]] <https://a.b/c_d> https://x.y/%20 [[mailto:me@x.org]] [[file:doc.pdf][the doc]] [[./rel/file.txt]] [[file:/abs/path.org]]\n",
109 "Run [[elisp:(+ 1 2)][add]] and [[elisp:(message \"50% #x\")]], [[shell:ls ~/x_y][list]] [[shell:echo $HOME]], [[help:car][car]] [[shortdoc:string]].\n",
109 "* Target section\nA <<anchor>> here and [[anchor]] and [[anchor][desc]].\n* Other\nSee [[*Target section]] and [[Target section][named]] and [[#cid]].\n* Third\n:PROPERTIES:\n:CUSTOM_ID: cid\n:END:\nx\n", 110 "* Target section\nA <<anchor>> here and [[anchor]] and [[anchor][desc]].\n* Other\nSee [[*Target section]] and [[Target section][named]] and [[#cid]].\n* Third\n:PROPERTIES:\n:CUSTOM_ID: cid\n:END:\nx\n",
110 "#+OPTIONS: num:nil\n* Head\nSee [[*Head]].\n", 111 "#+OPTIONS: num:nil\n* Head\nSee [[*Head]].\n",
111 "Footnotes[fn:1] twice[fn:1] and[fn:2][fn:3] and inline[fn::anon /x/] and[fn:named:inline def].\n\n[fn:1] First.\n\n[fn:2] Second\n with two lines.\n\n[fn:3] Third.\n", 112 "Footnotes[fn:1] twice[fn:1] and[fn:2][fn:3] and inline[fn::anon /x/] and[fn:named:inline def].\n\n[fn:1] First.\n\n[fn:2] Second\n with two lines.\n\n[fn:3] Third.\n",