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

HUGO_BASE_DIR check does not happen when running C-c C-e H t #333

Closed
Hodapp87 opened this issue Feb 23, 2020 · 20 comments
Closed

HUGO_BASE_DIR check does not happen when running C-c C-e H t #333

Hodapp87 opened this issue Feb 23, 2020 · 20 comments

Comments

@Hodapp87
Copy link

Actual Behavior

Export fails with an error like:

org-hugo--attachment-rewrite-maybe: Wrong type argument: stringp, nil

Expected Behavior

Export succeeds or else gives a more relevant error on why it cannot.

How to Reproduce the Issue

Run "C-c C-e H t" on the below org file. In my own tests, I could reproduce this anytime I had a link like http://.../foo.jpg or [[http://.../foo.jpg]] (i.e. the way Emacs produces a link when description is left blank). Links like [[http://.../foo.jpg][foo]] don't show this problem, links with something like .jpg or .txt don't either.

Example Org File

* Foo
** http://foo.bar/baz.jpg

This also seems to cause it:

* Foo
** [[https://foo.bar/baz.jpg]]

This does not:

* Foo
** [[https://foo.bar/baz.jpg][bar]]

Neither does this:

* Foo
** [[https://foo.bar/baz.txt]]

Generated Markdown File or Error

org-hugo--attachment-rewrite-maybe: Wrong type argument: stringp, nil

Ox-Hugo Debug Information

Debug Info

Debug information for ox-hugo

Emacs Version

GNU Emacs 25.2.2 (x86_64-pc-linux-gnu)
 of 2017-09-22, modified by Debian

Org Version

Org mode version 9.3.6 (9.3.6-elpa @ /home/hodapp/.emacs.d/elpa/org-9.3.6/)

Hugo Version

=hugo= binary not found in PATH

Org load-path shadows

Warning: Possible mixed installation of Org

/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-shen hides /usr/share/emacs/25.2/lisp/org/ob-shen
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-crypt hides /usr/share/emacs/25.2/lisp/org/org-crypt
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-archive hides /usr/share/emacs/25.2/lisp/org/org-archive
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-matlab hides /usr/share/emacs/25.2/lisp/org/ob-matlab
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-awk hides /usr/share/emacs/25.2/lisp/org/ob-awk
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-sass hides /usr/share/emacs/25.2/lisp/org/ob-sass
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-clojure hides /usr/share/emacs/25.2/lisp/org/ob-clojure
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-macro hides /usr/share/emacs/25.2/lisp/org/org-macro
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-plot hides /usr/share/emacs/25.2/lisp/org/org-plot
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-eval hides /usr/share/emacs/25.2/lisp/org/ob-eval
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-lisp hides /usr/share/emacs/25.2/lisp/org/ob-lisp
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-emacs-lisp hides /usr/share/emacs/25.2/lisp/org/ob-emacs-lisp
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-scheme hides /usr/share/emacs/25.2/lisp/org/ob-scheme
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-feed hides /usr/share/emacs/25.2/lisp/org/org-feed
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-compat hides /usr/share/emacs/25.2/lisp/org/org-compat
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-ditaa hides /usr/share/emacs/25.2/lisp/org/ob-ditaa
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-beamer hides /usr/share/emacs/25.2/lisp/org/ox-beamer
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-icalendar hides /usr/share/emacs/25.2/lisp/org/ox-icalendar
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-io hides /usr/share/emacs/25.2/lisp/org/ob-io
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-gnuplot hides /usr/share/emacs/25.2/lisp/org/ob-gnuplot
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-datetree hides /usr/share/emacs/25.2/lisp/org/org-datetree
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-ref hides /usr/share/emacs/25.2/lisp/org/ob-ref
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-id hides /usr/share/emacs/25.2/lisp/org/org-id
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-lilypond hides /usr/share/emacs/25.2/lisp/org/ob-lilypond
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-perl hides /usr/share/emacs/25.2/lisp/org/ob-perl
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-ascii hides /usr/share/emacs/25.2/lisp/org/ox-ascii
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-plantuml hides /usr/share/emacs/25.2/lisp/org/ob-plantuml
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-faces hides /usr/share/emacs/25.2/lisp/org/org-faces
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-sql hides /usr/share/emacs/25.2/lisp/org/ob-sql
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-timer hides /usr/share/emacs/25.2/lisp/org/org-timer
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-comint hides /usr/share/emacs/25.2/lisp/org/ob-comint
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-html hides /usr/share/emacs/25.2/lisp/org/ox-html
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-tangle hides /usr/share/emacs/25.2/lisp/org/ob-tangle
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-ledger hides /usr/share/emacs/25.2/lisp/org/ob-ledger
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-element hides /usr/share/emacs/25.2/lisp/org/org-element
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-calc hides /usr/share/emacs/25.2/lisp/org/ob-calc
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-md hides /usr/share/emacs/25.2/lisp/org/ox-md
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-lob hides /usr/share/emacs/25.2/lisp/org/ob-lob
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-R hides /usr/share/emacs/25.2/lisp/org/ob-R
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-js hides /usr/share/emacs/25.2/lisp/org/ob-js
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-java hides /usr/share/emacs/25.2/lisp/org/ob-java
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-pcomplete hides /usr/share/emacs/25.2/lisp/org/org-pcomplete
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-screen hides /usr/share/emacs/25.2/lisp/org/ob-screen
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-macs hides /usr/share/emacs/25.2/lisp/org/org-macs
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-asymptote hides /usr/share/emacs/25.2/lisp/org/ob-asymptote
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-sqlite hides /usr/share/emacs/25.2/lisp/org/ob-sqlite
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob hides /usr/share/emacs/25.2/lisp/org/ob
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-latex hides /usr/share/emacs/25.2/lisp/org/ox-latex
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-table hides /usr/share/emacs/25.2/lisp/org/ob-table
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-colview hides /usr/share/emacs/25.2/lisp/org/org-colview
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-loaddefs hides /usr/share/emacs/25.2/lisp/org/org-loaddefs
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-clock hides /usr/share/emacs/25.2/lisp/org/org-clock
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-inlinetask hides /usr/share/emacs/25.2/lisp/org/org-inlinetask
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-capture hides /usr/share/emacs/25.2/lisp/org/org-capture
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-octave hides /usr/share/emacs/25.2/lisp/org/ob-octave
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-core hides /usr/share/emacs/25.2/lisp/org/ob-core
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-ctags hides /usr/share/emacs/25.2/lisp/org/org-ctags
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-maxima hides /usr/share/emacs/25.2/lisp/org/ob-maxima
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-ruby hides /usr/share/emacs/25.2/lisp/org/ob-ruby
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-agenda hides /usr/share/emacs/25.2/lisp/org/org-agenda
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-mscgen hides /usr/share/emacs/25.2/lisp/org/ob-mscgen
/home/hodapp/.emacs.d/elpa/org-9.3.6/org hides /usr/share/emacs/25.2/lisp/org/org
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-odt hides /usr/share/emacs/25.2/lisp/org/ox-odt
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-picolisp hides /usr/share/emacs/25.2/lisp/org/ob-picolisp
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-org hides /usr/share/emacs/25.2/lisp/org/ob-org
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-attach hides /usr/share/emacs/25.2/lisp/org/org-attach
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-dot hides /usr/share/emacs/25.2/lisp/org/ob-dot
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-list hides /usr/share/emacs/25.2/lisp/org/org-list
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-mobile hides /usr/share/emacs/25.2/lisp/org/org-mobile
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-habit hides /usr/share/emacs/25.2/lisp/org/org-habit
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-indent hides /usr/share/emacs/25.2/lisp/org/org-indent
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-src hides /usr/share/emacs/25.2/lisp/org/org-src
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-table hides /usr/share/emacs/25.2/lisp/org/org-table
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-haskell hides /usr/share/emacs/25.2/lisp/org/ob-haskell
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-publish hides /usr/share/emacs/25.2/lisp/org/ox-publish
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-css hides /usr/share/emacs/25.2/lisp/org/ob-css
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-protocol hides /usr/share/emacs/25.2/lisp/org/org-protocol
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-mouse hides /usr/share/emacs/25.2/lisp/org/org-mouse
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-entities hides /usr/share/emacs/25.2/lisp/org/org-entities
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-man hides /usr/share/emacs/25.2/lisp/org/ox-man
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-org hides /usr/share/emacs/25.2/lisp/org/ox-org
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-footnote hides /usr/share/emacs/25.2/lisp/org/org-footnote
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-ocaml hides /usr/share/emacs/25.2/lisp/org/ob-ocaml
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-fortran hides /usr/share/emacs/25.2/lisp/org/ob-fortran
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-exp hides /usr/share/emacs/25.2/lisp/org/ob-exp
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox-texinfo hides /usr/share/emacs/25.2/lisp/org/ox-texinfo
/home/hodapp/.emacs.d/elpa/org-9.3.6/ox hides /usr/share/emacs/25.2/lisp/org/ox
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-C hides /usr/share/emacs/25.2/lisp/org/ob-C
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-makefile hides /usr/share/emacs/25.2/lisp/org/ob-makefile
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-install hides /usr/share/emacs/25.2/lisp/org/org-install
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-python hides /usr/share/emacs/25.2/lisp/org/ob-python
/home/hodapp/.emacs.d/elpa/org-9.3.6/ob-latex hides /usr/share/emacs/25.2/lisp/org/ob-latex
/home/hodapp/.emacs.d/elpa/org-9.3.6/org-version hides /usr/share/emacs/25.2/lisp/org/org-version

Study the output of M-x list-load-path-shadows.

ox-hugo defcustoms

org-hugo-section "posts"
org-hugo-use-code-for-kbd nil
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format "toml"
org-hugo-default-static-subdirectory-for-externals "ox-hugo"
org-hugo-external-file-extensions-allowed-for-copying ("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")
org-hugo-date-format "%Y-%m-%dT%T%z"
org-hugo-paired-shortcodes ""
org-hugo-langs-no-descr-in-code-fences nil
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format "toml"
@kaushalmodi
Copy link
Owner

Hello,

Just checking in to say that I have read your issue. Thanks for opening it. It's just that life's a bit too busy at the moment. But I will definitely get to this.

Btw I see that you have image links in Org headings?! I have never tried that and may be that's why this never got tested.

@Hodapp87
Copy link
Author

Thank you for taking the time.

I have a huge org document which spans from "me first learning to use Emacs" up to the present day - so it has a lot of things early on that appear to be legal but aren't really idiomatic org. The issue isn't really that I have to change things for ox-hugo to handle them (I've been doing this with regexes and such) - it's just that it's difficult for me to find the actual thing that needs changing when a single problematic line can crash the whole conversion without it telling me where.

However, it doesn't appear to be specific to headings. The following both trigger the same error:

* Foo
  - http://foo.bar/baz.jpg

and

* Foo
  http://foo.bar/baz.jpg

As a side note, possibly related and possibly not, internal links like [[Foo]] are deleted completely in the Markdown (instead of producing a link to Foo with a description of Foo), while Org appears to treat them identically to [[Foo][Foo]]. I'll file a separate issue on this if you want me to.

@kaushalmodi
Copy link
Owner

However, it doesn't appear to be specific to headings. The following both trigger the same error:

That's intriguing.. because I definitely use images on my blog and also have many image tests: https://ox-hugo.scripter.co/test/tags/image

You can see this big single ox-hugo test Org file that has source to the above exported image test pages.

So, now I am curious what's special in your setup.

As a side note, possibly related and possibly not, internal links like [[Foo]] are deleted completely in the Markdown (instead of producing a link to Foo with a description of Foo), while Org appears to treat them identically to [[Foo][Foo]]. I'll file a separate issue on this if you want me to.

Yes, please. I'd like to track that separately.

Thanks.

@kaushalmodi
Copy link
Owner

@Hodapp87 Also, please ensure that you are using the latest ox-hugo version from Melpa (and not Melpa-stable).

@Hodapp87
Copy link
Author

I'm not sure how to check exact version, but I'm on melpa, not melpa-stable, and am seeing ~/.emacs.d/elpa/ox-hugo-20200122.2049 in my installation. This is only the setup that I tested on - I set this up a week or two ago on a separate machine after first observing the problem there in my normal setup.

To be clear, regardless of what is in that large org file you linked to - you are not able to reproduce this error with any of the smaller examples I linked? Or are you?

@kaushalmodi
Copy link
Owner

you are not able to reproduce this error with any of the smaller examples I linked? Or are you?

I haven't tried that.. I'll get to it soon.

I just wanted to check if you were using the latest ox-hugo version.. Just surprised seeing your report that none of the image links work.. because I have used and seen them being used in wild.

@Hodapp87
Copy link
Author

I had an example in my original post that did work. If the link properly contains a description like [[https://foo.bar/baz.jpg][bar]], it appears to be fine. The failure case seemed to be [[https://foo.bar/baz.jpg]] or https://foo.bar/baz.jpg.

@kaushalmodi
Copy link
Owner

I checked that I already have this test in the ox-hugo test suite:

[[https://ox-hugo.scripter.co/test/images/org-mode-unicorn-logo.png]]

That exports fine to:

{{< figure src="https://ox-hugo.scripter.co/test/images/org-mode-unicorn-logo.png" >}}

See https://ox-hugo.scripter.co/test/posts/figure-shortcode-and-attr-html/#multiple-attr-html.

(locally I tested that to export fine without the html attr's as well).

So I'll need to spend some time later to figure out how to reproduce this issue.

@Ddscully
Copy link

Ddscully commented May 9, 2020

I see the same behaviour only on org files with links like those mentioned above as well as an entry with the COMMENT keyword. That I get when I use org-toggle-comment.
Removing any COMMENT keywords solves it for me.

kaushalmodi added a commit that referenced this issue May 18, 2020
@kaushalmodi kaushalmodi added awaiting user response cannot reproduce issue The issue reported by the OP cannot be reproduce in tests and removed need to investigate labels May 18, 2020
@kaushalmodi
Copy link
Owner

@Hodapp87 @Ddscully I am sorry but I cannot reproduce the issue. Here's a simple test (I have used description-less https image links and also one nested inside a COMMENT subtree):

* ox-hugo Issue 333 test
:PROPERTIES:
:EXPORT_FILE_NAME: 333
:END:
#+begin_description
Description-less link an ~https~ image link.
#+end_description

[[https://ox-hugo.scripter.co/test/ox-hugo/org.png]]
** COMMENT A comment block
Testing an /https/ image link inside a comment block.
[[https://ox-hugo.scripter.co/test/ox-hugo/org.png]]

Here's the outcome of that test:


Please ensure that you are using ox-hugo from Melpa and not Melpa Stable.

@Hodapp87
Copy link
Author

I'm still reproducing it in every case I try.

Here is a gist containing a minimal Dockerfile (Ubuntu 18.04 and Emacs), an init.el for Emacs, and the org example that you just gave: https://gist.github.com/Hodapp87/2a3e9c47d6715dd47a50cb04736e8279

init.el comes directly from instructions at https://melpa.org/#/getting-started on how to use MELPA (note that it is not using melpa-stable).

Here is a screen capture of me running through the test: https://www.youtube.com/watch?v=v1nuo93ewR0&feature=youtu.be

  • Showing the Dockerfile, init.el, and test.org.
  • Building the Dockerfile with docker build . -t ox_hugo_test (this finishes at about 1:40)
  • Running the Dockerfile with docker run -ti ox_hugo_test
  • Running emacs and (package-install 'ox-hugo) (this finishes at about 3:00).
  • Quitting emacs and showing that it is using ~/.emacs.d/elpa/ox-hugo-20200501.1317.
  • Fetching commit 93e4c9e of your repo from GitHub (the latest as of today), unzipping it, and running the md5sum of all .el files.
  • Returning to ~/.emacs.d/elpa/ox-hugo-20200501.1317 and running md5sum again. Compared to what is in the repo, all md5 sums match (see around 3:50).
  • Re-running emacs and (require 'ox-hugo).
  • Open test.org, your example.
  • Press C-c C-e H t. It gives Wrong type argument: stringp, nil and produces no output.

If you start from this Dockerfile, and you are still not reproducing the problem, specifically with C-c C-e H t and not with a test suite, then please, tell me exactly what you are running that is different from the above.

@kaushalmodi
Copy link
Owner

kaushalmodi commented May 18, 2020

It gives Wrong type argument: stringp, nil and produces no output.

I do not have docker installed. But given that you can consistently create that error, can you post the backtrace here?

Do M-x toggle-debug-on-error, do C-c C-e H t and then paste the backtrace here.

Thanks.

@kaushalmodi
Copy link
Owner

@Hodapp87 Also, what are the emacs and org mode versions in your container? The minimal versions are Emacs 24.4 and Org 9.2.

@Hodapp87
Copy link
Author

Backtrace is here: https://gist.github.com/Hodapp87/c6c30893a05e99a9331e8f5746a85394

Emacs is 25.2.2. As is visible in several parts of the video, org is 9.3.6.

@kaushalmodi
Copy link
Owner

kaushalmodi commented May 18, 2020

I think you are missing the #+hugo_base_dir: (though, I did have a user-error that threw is that keyword was missing.. I'll investigate).

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-as-directory(nil)
  org-hugo--attachment-rewrite-maybe("//ox-hugo.scripter.co/test/ox-hugo/org.png" (:export-options nil :back-end [cl-struct-org-export-backend hugo blackfriday ((code . org-hugo-kbd-tags-maybe) (example-block . org-hugo-example-block) (export-block . org-hugo-export-block) (export-snippet . org-hugo-export-snippet) (headline . org-hugo-headline) (inner-template . org-hugo-inner-template) (keyword . org-hugo-keyword) (link . org-hugo-link) (paragraph . org-hugo-paragraph) (src-block . org-hugo-src-block) (special-block . org-hugo-special-block)) ((:with-toc nil "toc" org-hugo-export-with-toc) (:section-numbers nil "num" org-hugo-export-with-section-numbers) (:author "AUTHOR" nil user-full-name newline) (:creator "CREATOR" nil org-hugo-export-creator-string) (:with-smart-quotes nil "'" nil) (:with-special-strings nil "-" nil) (:with-sub-superscript nil "^" (quote {})) (:hugo-with-locale "HUGO_WITH_LOCALE" nil nil) (:hugo-front-matter-format "HUGO_FRONT_MATTER_FORMAT" nil org-hugo-front-matter-format) (:hugo-level-offset "HUGO_LEVEL_OFFSET" nil "1") (:hugo-preserve-filling "HUGO_PRESERVE_FILLING" nil org-hugo-preserve-filling) (:hugo-delete-trailing-ws "HUGO_DELETE_TRAILING_WS" nil org-hugo-delete-trailing-ws) (:hugo-section "HUGO_SECTION" nil org-hugo-section) (:hugo-bundle "HUGO_BUNDLE" nil nil) (:hugo-base-dir "HUGO_BASE_DIR" nil nil) (:hugo-code-fence "HUGO_CODE_FENCE" nil t) (:hugo-use-code-for-kbd "HUGO_USE_CODE_FOR_KBD" nil org-hugo-use-code-for-kbd) (:hugo-prefer-hyphen-in-tags "HUGO_PREFER_HYPHEN_IN_TAGS" nil org-hugo-prefer-hyphen-in-tags) (:hugo-allow-spaces-in-tags "HUGO_ALLOW_SPACES_IN_TAGS" nil org-hugo-allow-spaces-in-tags) (:hugo-auto-set-lastmod "HUGO_AUTO_SET_LASTMOD" nil org-hugo-auto-set-lastmod) (:hugo-custom-front-matter "HUGO_CUSTOM_FRONT_MATTER" nil nil space) (:hugo-blackfriday "HUGO_BLACKFRIDAY" nil nil space) (:hugo-front-matter-key-replace "HUGO_FRONT_MATTER_KEY_REPLACE" nil nil space) (:hugo-date-format "HUGO_DATE_FORMAT" nil org-hugo-date-format) (:hugo-paired-shortcodes "HUGO_PAIRED_SHORTCODES" nil org-hugo-paired-shortcodes space) (:hugo-pandoc-citations "HUGO_PANDOC_CITATIONS" nil nil) (:bibliography "BIBLIOGRAPHY" nil nil newline) (:hugo-aliases "HUGO_ALIASES" nil nil space) (:hugo-audio "HUGO_AUDIO" nil nil) (:date "DATE" nil nil) (:description "DESCRIPTION" nil nil) (:hugo-draft "HUGO_DRAFT" nil nil) (:hugo-expirydate "HUGO_EXPIRYDATE" nil nil) (:hugo-headless "HUGO_HEADLESS" nil nil) (:hugo-images "HUGO_IMAGES" nil nil newline) (:hugo-iscjklanguage "HUGO_ISCJKLANGUAGE" nil nil) (:keywords "KEYWORDS" nil nil newline) (:hugo-layout "HUGO_LAYOUT" nil nil) (:hugo-lastmod "HUGO_LASTMOD" nil nil) (:hugo-linktitle "HUGO_LINKTITLE" nil nil) (:hugo-locale "HUGO_LOCALE" nil nil) (:hugo-markup "HUGO_MARKUP" nil nil) (:hugo-menu "HUGO_MENU" nil nil space) (:hugo-menu-override "HUGO_MENU_OVERRIDE" nil nil space) (:hugo-outputs "HUGO_OUTPUTS" nil nil space) (:hugo-publishdate "HUGO_PUBLISHDATE" nil nil) (:hugo-series "HUGO_SERIES" nil nil newline) (:hugo-slug "HUGO_SLUG" nil nil) (:hugo-tags "HUGO_TAGS" nil nil newline) (:hugo-categories "HUGO_CATEGORIES" nil nil newline) ...) ((:filter-body . org-hugo-body-filter)) nil (72 "Export to Hugo-compatible Markdown" ((72 "Subtree or File to Md file            " (lambda (a _s v _b) (org-hugo-export-wim-to-md nil a v))) (104 "File to Md file" (lambda (a s v _b) (org-hugo-export-to-md a s v))) (79 "Subtree or File to Md file and open   " (lambda (a _s v _b) (if a (org-hugo-export-wim-to-md nil :async v) (org-open-file ...)))) (111 "File to Md file and open" (lambda (a s v _b) (if a (org-hugo-export-to-md :async s v) (org-open-file ...)))) (65 "All subtrees (or File) to Md file(s)  " (lambda (a _s v _b) (org-hugo-export-wim-to-md :all-subtrees a v))) (116 "File to a temporary Md buffer" (lambda (a s v _b) (org-hugo-export-as-md a s v)))))] :translate-alist ((code . org-hugo-kbd-tags-maybe) (example-block . org-hugo-example-block) (export-block . org-hugo-export-block) (export-snippet . org-hugo-export-snippet) (headline . org-hugo-headline) (inner-template . org-hugo-inner-template) (keyword . org-hugo-keyword) (link . org-hugo-link) (paragraph . org-hugo-paragraph) (src-block . org-hugo-src-block) (special-block . org-hugo-special-block) (center-block . org-blackfriday-center-block) (example-block . org-blackfriday-example-block) (fixed-width . org-blackfriday-fixed-width) (footnote-reference . org-blackfriday-footnote-reference) (inner-template . org-blackfriday-inner-template) (italic . org-blackfriday-italic) (item . org-blackfriday-item) (latex-environment . org-blackfriday-latex-environment) (latex-fragment . org-blackfriday-latex-fragment) (line-break . org-html-line-break) (plain-list . org-blackfriday-plain-list) (plain-text . org-blackfriday-plain-text) (quote-block . org-blackfriday-quote-block) (special-block . org-blackfriday-special-block) (src-block . org-blackfriday-src-block) (strike-through . org-blackfriday-strike-through) (table-cell . org-blackfriday-table-cell) (table-row . org-blackfriday-table-row) (table . org-blackfriday-table) (verse-block . org-blackfriday-verse-block) (bold . org-md-bold) (code . org-md-verbatim) (example-block . org-md-example-block) (export-block . org-md-export-block) (fixed-width . org-md-example-block) (headline . org-md-headline) (horizontal-rule . org-md-horizontal-rule) (inline-src-block . org-md-verbatim) (inner-template . org-md-inner-template) (italic . org-md-italic) (item . org-md-item) (keyword . org-md-keyword) (line-break . org-md-line-break) (link . org-md-link) (node-property . org-md-node-property) (paragraph . org-md-paragraph) (plain-list . org-md-plain-list) (plain-text . org-md-plain-text) (property-drawer . org-md-property-drawer) ...) :exported-data #s(hash-table size 4001 test eq rehash-size 1.5 rehash-threshold 0.8 data (#("Description-less link an " 0 25 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #2 (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #("image link.\n" 0 12 (:parent #4))))) #("Description-less link an " 0 25 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #("image link.\n" 0 12 (:parent #4))))) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) #2 #("image link.\n" 0 12 (:parent #4))))) "`https` " #("image link.\n" 0 12 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #2))) #("image link.\n" 0 12 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #("image link.\n" 0 12 (:parent #4))))) (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent (section (:begin 26 :end 205 :contents-begin 26 :contents-end 205 :post-blank 1 :post-affiliated 26 :parent ...) #4 (paragraph ... ... #("\n" 0 1 ...)))) #2)) #("Description-less link an " 0 25 (:parent #2)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #2)) #("image link.\n" 0 12 (:parent #2))) #("Description-less link an `https` image link.\n\n" 0 25 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #("image link.\n" 0 12 (:parent #4)))) 33 44 (:parent (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent ...) #4)) #("Description-less link an " 0 25 (:parent #4)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #4)) #("image link.\n" 0 12 (:parent #4))))) (special-block (:type "description" :begin 68 :end 152 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 68 :parent (section (:begin 26 :end 205 :contents-begin 26 :contents-end 205 :post-blank 1 :post-affiliated 26 :parent (headline (:raw-value "ox-hugo Issue 333 test" :begin 1 :end 205 :pre-blank 0 :contents-begin 26 :contents-end 205 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 1 :EXPORT_FILE_NAME "333" :title ... :parent ...) #4)) #2 (paragraph (:begin 152 :end 205 :contents-begin 152 :contents-end 205 :post-blank 1 :post-affiliated 152 :parent #4) (link (:type "https" :path "//ox-hugo.scripter.co/test/ox-hugo/org.png" :format bracket :raw-link "https://ox-hugo.scripter.co/test/ox-hugo/org.png" :application nil :search-option nil :begin 152 :end 204 :contents-begin nil :contents-end nil :post-blank 0 :parent #5)) #("\n" 0 1 (:parent #5))))) (paragraph (:begin 88 :end 133 :contents-begin 88 :contents-end 133 :post-blank 1 :post-affiliated 88 :parent #2) #("Description-less link an " 0 25 (:parent #3)) (code (:value "https" :begin 113 :end 121 :post-blank 1 :parent #3)) #("image link.\n" 0 12 (:parent #3)))) "" nil "" ...)) :input-buffer "test.org" :input-file "/root/test.org" :with-toc nil :section-numbers nil :author "root" :creator "Emacs 25.2.2 (Org mode 9.3.6 + ox-hugo)" :with-smart-quotes nil :with-special-strings nil :with-sub-superscript {} :hugo-with-locale nil :hugo-front-matter-format "toml" :hugo-level-offset "1" :hugo-preserve-filling t :hugo-delete-trailing-ws t :hugo-section "posts" :hugo-bundle nil :hugo-base-dir nil :hugo-code-fence t :hugo-use-code-for-kbd nil :hugo-prefer-hyphen-in-tags t :hugo-allow-spaces-in-tags t ...))

From above, see that you have :hugo-base-dir nil.

I have documented the requirement of the #+hugo_base_dir here: https://ox-hugo.scripter.co/#before-you-export

I now need to see why that user-error did not trigger in your case.

@kaushalmodi
Copy link
Owner

OK, finally I can reproduce the issue by removing #+hugo_base_dir: keyword and running C-c C-e H t (though not when running C-c C-e H H).

Note that C-c C-e H t is not the usual export function, but I recognize that this is a bug; will fix it.

@kaushalmodi kaushalmodi changed the title Image link causes "org-hugo--attachment-rewrite-maybe: Wrong type argument: stringp, nil" HUGO_BASE_DIR check does not happen when running C-c C-e H t May 18, 2020
@kaushalmodi kaushalmodi added bug and removed awaiting user response cannot reproduce issue The issue reported by the OP cannot be reproduce in tests labels May 18, 2020
@kaushalmodi
Copy link
Owner

Actually HUGO_BASE_DIR related stuff should be ignored when running C-c C-e H t, because there's no point of that if the user is not exporting the Markdown to the content/ dir.

@kaushalmodi
Copy link
Owner

May be I will deprecate C-c C-e H t.. need to think ..

@kaushalmodi
Copy link
Owner

@Hodapp87 Please try out the latest master. Now you should see a user-error with the #+hugo_base_dir missing.

@kaushalmodi
Copy link
Owner

Hello, I am safely assuming that this particular issue is now fixed for you. If the #+hugo_base_dir: is missing, you should now be faced with a user error instead of an elisp debug backtrace.

Feel free to comment here if this is still not fixed for your use case.

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

No branches or pull requests

3 participants