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

Summary splitter (more comment) at end of post content (file or subtree) causes error #152

Closed
zzamboni opened this issue Apr 5, 2018 · 6 comments

Comments

@zzamboni
Copy link
Contributor

zzamboni commented Apr 5, 2018

First of all, I'd like to say THANK YOU for ox-hugo - it has revolutionized how I maintain my Hugo-powered website using org-mode.

I have found a strange behavior in what should be a very uncommon corner case, but here it is anyway: if a post contains a <!--more--> tag as its last line, upon export I get the prompt Buffer test.md modified; kill anyway?, and then no matter what I respond, I get the error markdown-syntax-propertize-comments: Wrong type argument: integer-or-marker-p, nil, and the file is not exported.

Very easy workaround: adding some text after the <!--more--> line, even if it's just a \nbsp, then the export works fine (this is why I think this is an uncommon corner case, in regular use this shouldn't happen).

Here's a short file which reproduces the problem:

#+hugo_base_dir: ../

* DONE Test post
CLOSED: [2018-04-05 Thu 14:33]
:PROPERTIES:
:EXPORT_FILE_NAME: test
:END:

Here is some test.

@@html:<!--more-->@@

In case you are curious: I came across this because I have a short page in which I want to have the <!--more--> tag to influence the generation of the post summary by Hugo (I cannot use the :summary custom front matter because in this case I want the summary to include some HTML generated by a custom Hugo shortcode, which would otherwise get stripped out).

Versions: Emacs 25.3.2, Org mode 9.1.8, ox-hugo 20180403.1111 from MELPA

@kaushalmodi
Copy link
Owner

First of all, I'd like to say THANK YOU for ox-hugo - it has revolutionized how I maintain my Hugo-powered website using org-mode.

Thanks!

no matter what I respond, I get the error markdown-syntax-propertize-comments: Wrong type argument: integer-or-marker-p, nil, and the file is not exported.

That sounds like a bug. Can you do M-x toggle-debug-on-error, then recreate that error. That should throw a backtrace, paste that here. Thanks.

I'll also try to reproduce the problem locally, but the backtrace will immensely help.

@kaushalmodi
Copy link
Owner

kaushalmodi commented Apr 5, 2018

And to the question:

How to insert <!--more--> tag in a post?

You can simply do:

#+hugo: more

@zzamboni
Copy link
Contributor Author

zzamboni commented Apr 5, 2018

Thanks for the quick response! Here's the backtrace:
https://gist.github.com/zzamboni/d4cab2c2d26aa981a9094d60a0c0551e

Thanks for the tip about the more tag! Much cleaner that way. It still triggers the same error though :)

@kaushalmodi
Copy link
Owner

OK, I was able to reproduce this issue even with:

*** Summary Splitter at EOF                                             :eof:
:PROPERTIES:
:EXPORT_FILE_NAME: summary-splitter-at-eof
:END:
Here is the summary.
#+hugo: more

I'll take a look by the end of today.

@kaushalmodi kaushalmodi changed the title How to insert <!--more--> tag in a post? Summary spiller (more comment) at end of post content (file or subtree) causes error Apr 5, 2018
@kaushalmodi kaushalmodi added the bug label Apr 5, 2018
@kaushalmodi
Copy link
Owner

kaushalmodi commented Apr 5, 2018

Hmm, it's definitely a bug.. but looks like a markdown-mode bug based on this:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  remove-text-properties(nil 269 (markdown-tilde-fence-begin nil markdown-tilde-fence-end nil markdown-fenced-code nil markdown-yaml-metadata-begin nil markdown-yaml-metadata-end nil markdown-yaml-metadata-section nil markdown-gfm-block-begin nil markdown-gfm-block-end nil markdown-gfm-code nil markdown-list-item nil markdown-pre nil markdown-blockquote nil markdown-hr nil markdown-comment nil markdown-heading nil markdown-heading-1-setext nil markdown-heading-2-setext nil markdown-heading-1-atx nil markdown-heading-2-atx nil markdown-heading-3-atx nil markdown-heading-4-atx nil markdown-heading-5-atx nil markdown-heading-6-atx nil markdown-metadata-key nil markdown-metadata-value nil markdown-metadata-markup nil))
  markdown-syntax-propertize-comments(263 270)
  markdown-syntax-propertize-comments(258 270)
  markdown-syntax-propertize(258 270)
  markdown-font-lock-extend-region-function(269 270 0)
  run-hook-with-args(markdown-font-lock-extend-region-function 269 270 0)
  jit-lock-after-change(269 270 0)
  #f(compiled-function (&optional called-interactively) "Save the current buffer in its visited file, if it has been modified.\n\nThe hooks `write-contents-functions', `local-write-file-hooks'\nand `write-file-functions' get a chance to do the job of saving;\nif they do not, then the buffer is saved in the visited file in\nthe usual way.\n\nBefore and after saving the buffer, this function runs\n`before-save-hook' and `after-save-hook', respectively." (interactive '(called-interactively)) #<bytecode 0x290dc7>)(nil)
  apply(#f(compiled-function (&optional called-interactively) "Save the current buffer in its visited file, if it has been modified.\n\nThe hooks `write-contents-functions', `local-write-file-hooks'\nand `write-file-functions' get a chance to do the job of saving;\nif they do not, then the buffer is saved in the visited file in\nthe usual way.\n\nBefore and after saving the buffer, this function runs\n`before-save-hook' and `after-save-hook', respectively." (interactive '(called-interactively)) #<bytecode 0x290dc7>) nil)
  basic-save-buffer(nil)
  save-buffer()
  write-file("/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/summary-splitter-at-eof.md")
  org-export-to-file(hugo "/home/kmodi/stow/pub_dotfiles/emacs/dot-emacs.d/elisp/ox-hugo/test/site/content/posts/summary-splitter-at-eof.md" nil (headline (:raw-value "Summary Splitter at EOF" :begin 63695 :end 63967 :pre-blank 0 :contents-begin 63773 :contents-end 63967 :level 3 :priority nil :tags (#("eof" 0 3 (keymap (keymap (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) mouse-face highlight face (org-tag org-level-3) wrap-prefix #("*** " 0 4 (face org-indent)) line-prefix "" fontified t))) :todo-keyword nil :todo-type nil :post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 63695 :EXPORT_FILE_NAME "summary-splitter-at-eof" :title "Summary Splitter at EOF")) nil)

Will investigate more.


Update: Yes it is.. typing just <!--more--> in a markdown-mode buffer causes the error.

@kaushalmodi kaushalmodi changed the title Summary spiller (more comment) at end of post content (file or subtree) causes error Summary splitter (more comment) at end of post content (file or subtree) causes error Apr 6, 2018
@kaushalmodi
Copy link
Owner

Closing this issue as it's not related to ox-hugo, and it's being tracked in markdown-mode repo at jrblevin/markdown-mode#327.

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

2 participants