Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow exporting with broken links if broken-links: t #587

Closed
3 tasks done
kaushalmodi opened this issue Mar 13, 2022 Discussed in #586 · 9 comments · Fixed by #596
Closed
3 tasks done

Allow exporting with broken links if broken-links: t #587

kaushalmodi opened this issue Mar 13, 2022 Discussed in #586 · 9 comments · Fixed by #596
Labels

Comments

@kaushalmodi
Copy link
Owner

kaushalmodi commented Mar 13, 2022

Status


Discussed in #586

Originally posted by Codeberg-AsGithubAlternative-buhtz March 12, 2022
Hello I am getting the message Unable to resolve link; aborting: "roam:git" when using org-hugo-export-wim-to-md. See the full debug output at the end.

In the context of org-roam especially when used for Zettelkasten it is usual to have dead links. A dead link is not an error just an information because it will remind you that there is something to do ("thinking further").

From ox-publish I know the variable (setq org-export-with-broken-links t). It seems to me that this is not relevant for ox-hugo, correct?
I did M-x customize-group RET ox-hugo but couldn't see an option like that there.

Can ox-hugo export such links? It could just replace them with the string ERRORor whatever it wants. But it shouldn't stop the export process.

  1 Debugger entered--Lisp error: (org-link-broken "roam:git")
  2   signal(org-link-broken ("roam:git"))
  3   org-export-resolve-fuzzy-link((link (:type "fuzzy" :path "roam:git" :format bracket :raw-link "roam:git" :appli$
  4   #f(compiled-function (link) #<bytecode 0x158ff9168c05>)((link (:type "fuzzy" :path "roam:git" :format bracket :$
  5   #f(compiled-function (--data) #<bytecode 0x158ff9168c65>)((link (:type "fuzzy" :path "roam:git" :format bracket$
  6   mapc(#f(compiled-function (--data) #<bytecode 0x158ff9168c65>) (#("SSH-Key for Codeberg.org erstellen, um ohne $
  7   #f(compiled-function (--data) #<bytecode 0x158ff9168c65>)((paragraph (:begin 155 :end 294 :contents-begin 155 :$
  8   mapc(#f(compiled-function (--data) #<bytecode 0x158ff9168c65>) ((paragraph (:begin 155 :end 294 :contents-begin$
  9   #f(compiled-function (--data) #<bytecode 0x158ff9168c65>)((section (:begin 155 :end 295 :contents-begin 155 :co$
 10   mapc(#f(compiled-function (--data) #<bytecode 0x158ff9168c65>) ((section (:begin 155 :end 295 :contents-begin 1$
 11   #f(compiled-function (--data) #<bytecode 0x158ff9168c65>)((headline (:raw-value "Ziel" :begin 148 :end 295 :pre$
 12   mapc(#f(compiled-function (--data) #<bytecode 0x158ff9168c65>) ((section (:begin 1 :end 148 :contents-begin 1 :$
 13   #f(compiled-function (--data) #<bytecode 0x158ff9168c65>)((org-data nil (section (:begin 1 :end 148 :contents-b$
 14   org-element-map((org-data nil (section (:begin 1 :end 148 :contents-begin 1 :contents-end 148 :post-blank 0 :po$
 15   org-hugo--get-pre-processed-buffer()
 16   org-hugo-export-wim-to-md(:all-subtrees)
 17   (save-current-buffer (set-buffer (find-file-noselect org-file)) (message (format "[ox-hugo/export-all file %d/%$
 18   (let ((org-file (car --dolist-tail--))) (save-current-buffer (set-buffer (find-file-noselect org-file)) (messag$
 19   (while --dolist-tail-- (let ((org-file (car --dolist-tail--))) (save-current-buffer (set-buffer (find-file-nose$
 20   (let ((--dolist-tail-- org-files)) (while --dolist-tail-- (let ((org-file (car --dolist-tail--))) (save-current$
 21   (progn (message (format (if dont-recurse "[ox-hugo/export-all] Exporting %d files from %S .." "[ox-hugo/export-$
 22   (if (= 0 num-files) (message (format "No Org files found in %s" search-path)) (progn (message (format (if dont-$
 23   (let* ((org-files-root-dir (or org-files-root-dir default-directory)) (dont-recurse (or dont-recurse (and curre$
 24   ox-hugo/export-all("~/tab-cloud/my.org-roam")
 25   eval((ox-hugo/export-all "~/tab-cloud/my.org-roam") t)
 26   eval-expression((ox-hugo/export-all "~/tab-cloud/my.org-roam") nil nil 127)
 27   funcall-interactively(eval-expression (ox-hugo/export-all "~/tab-cloud/my.org-roam") nil nil 127)
 28   call-interactively(eval-expression nil nil)
 29   command-execute(eval-expression)
```</div>
@kaushalmodi
Copy link
Owner Author

The issue stems from the fact that the broken link errors are not masked using the broken_links:t option when pre-processing the buffer. See #447 (comment)

@kaushalmodi
Copy link
Owner Author

kaushalmodi commented Mar 13, 2022

Update: This workaround is not needed any more; fixed in #596.


@Codeberg-AsGithubAlternative-buhtz

This is not a proper fix. Please undo the following workaround once this issue is fixed.

For now, I think that if you set this internal variable to nil, this issue can be bypassed. Put this in your emacs config:

(with-eval-after-load 'ox-hugo
  (setq org-hugo--preprocess-buffer nil))

@buhtz
Copy link

buhtz commented Mar 13, 2022

That is the reproducing org-file

:PROPERTIES:
:ID:       0ee70e23-8aec-44a6-abd1-8ed1935b58e8
:END:
#+title: SSH-key for Codeberg.org
+date: [2022-02-05 Sa 22:02]
#+filetags: Wiki
* Ziel
SSH-Key for Codeberg.org erstellen, um ohne Passwort [[roam:git]] nutzen zu können.
Hinweis: Jede Maschine sollte einen eigenen Key haben.

From the first view it looks like that the workaround with org-hug--preprocess-buffer works. Instead of you I did exactly this, which IMHO is use-package's equivalent of with-eval-after-load.

(use-package ox-hugo
  :config
  (setq org-hugo-base-dir "~/tab-cloud/my.org-html")
  (setq org-hugo--preprocess-buffer nil)
)

Everything is exported (over 100 files) and the last message is "Done!".

o you see that error when you export using ox-md or ox-html

I did not understand that comment. I do not know ox-md or ox-html and does not know if this is a function, variable, package, etc I am sorry but it is still not easy for me to dive through the emacs-universe. ;)

@kaushalmodi
Copy link
Owner Author

I do not know ox-md or ox-html

They are Org built-in exporters. But that's alright, given that that workaround worked, this issue is definitely in ox-hugo.

@kaushalmodi
Copy link
Owner Author

kaushalmodi commented Mar 13, 2022

Unrelated:

I think you are missing a # in the beginning of the line here on the date line:

:PROPERTIES:
:ID:       0ee70e23-8aec-44a6-abd1-8ed1935b58e8
:END:
#+title: SSH-key for Codeberg.org
+date: [2022-02-05 Sa 22:02]

@buhtz
Copy link

buhtz commented Mar 13, 2022

Unrelated:
I think you are missing a # in the beginning of the line here on the date line:

IMHO I do not. Some orgroam folks told me that this is editors decision if someone use #+ or +. I saw both variants in a lot of tutorials and videos I wondered about that in the beginning.
But I am not sure about this. And I can not find my original question again.

@kaushalmodi
Copy link
Owner Author

I have personally never used or seen keywords begin with a plain +.

See the Org manual: https://orgmode.org/manual/In_002dbuffer-Settings.html

I saw both variants in a lot of tutorials and videos I wondered about that in the beginning.

If you see this again, I think you should report that issue. I am actually surprised if the keywords starting with just "+" are even getting parsed for you.

@kaushalmodi
Copy link
Owner Author

@Codeberg-AsGithubAlternative-buhtz If you don't do subtree-based export (which I believe would be the case if you have only org-roam files), this issue is fixed for you indirectly by the nature of fixing #589.

I'll leave this issue open until it truly gets fixed.

@kaushalmodi
Copy link
Owner Author

You can remove this workaround now.

kaushalmodi added a commit that referenced this issue Mar 15, 2022
Buffer pre-processing is enabled by default when doing subtree
exports.

Ref: #587

This doesn't entirely fix this issue. Broken link exports now work
only if `#+options: broken-links:t` is set globally. Still
`:EXPORT_OPTIONS: broken-links:t` doesn't work.. wip
kaushalmodi added a commit that referenced this issue Mar 15, 2022
Buffer pre-processing is enabled by default when doing subtree
exports.

Ref: #587

This doesn't entirely fix this issue. Broken link exports now work
only if `#+options: broken-links:t` is set globally. Still
`:EXPORT_OPTIONS: broken-links:t` doesn't work.. wip
@kaushalmodi kaushalmodi changed the title Allow exporting with broken links if broken_links: t Allow exporting with broken links if broken-links: t Mar 15, 2022
kaushalmodi added a commit that referenced this issue Mar 18, 2022
This fix was possible after the AST looping was moved outside the
`with-temp-buffer` construct:
#595

Fixes #587.
kaushalmodi added a commit that referenced this issue Mar 18, 2022
…ons-parsing

Fix broken links export options parsing.

Fixes #587.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants