From 94dd2f4a8e5ca50bbfb857395d98da88bf581b6c Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 11 May 2023 11:23:11 +0200 Subject: [PATCH] fix: remove newlines in link descriptions Currently, when an orgmode link has a newline in its description, it is passed to the description of the Gemini link. Example: ```org [[https://example.com][This is a link with a newline to example.com]] ``` Which exports to: ```gmi => https://example.com This is a link with a newline to example.com ``` This commit fixes this by replacing newlines with a simple space. The new output is: ```gmi => https://example.com This is a link with a newline to example.com ``` It also fixes a compilation error on Emacs 30 by properly escaping quotation marks. Signed-off-by: Lucien Cartier-Tilet --- ox-gemini.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ox-gemini.el b/ox-gemini.el index b18a0bf..45d8a5e 100644 --- a/ox-gemini.el +++ b/ox-gemini.el @@ -79,7 +79,8 @@ ITEM is the parsed-org element with all properties." (defun org-gemini-code-inline (input _contents info) "Generate an inline code in Gemtext from the parsed INPUT. -INPUT is either a 'src-block' or 'example-block' element. INFO is a plist." +INPUT is either a \\='src-block\\=' or \\='example-block\\=' +element. INFO is a plist." ;; there's a bug here where there's a trailing space in the `` (format "`%s`" (org-export-format-code-default input info))) @@ -108,9 +109,10 @@ INFO is a plist." (concat (file-name-sans-extension (org-element-property :path link)) ".gmi") raw-path)) (desc (org-element-contents link)) - (anchor (org-export-data - (or desc (org-element-property :raw-link link)) - info))) + (anchor (string-replace "\n" " " + (org-export-data + (or desc (org-element-property :raw-link link)) + info)))) (format "=> %s %s\n" (url-encode-url path) anchor))) links "") (when (car links)