emacs-love / weblorg

Static Site Generator for Emacs
https://emacs.love/weblorg
GNU General Public License v3.0
282 stars 21 forks source link

Error 'invalid time specification' #54

Closed fklappan closed 3 years ago

fklappan commented 3 years ago

I'm using the publish.el template from the "getting started" guide from the homepage with minimal changes because the require directive alone was not enough.

(add-to-list 'load-path "~/.emacs.d/elpa/weblorg-20210430.2251")
(add-to-list 'load-path "~/.emacs.d/elpa/templatel-20210425.2215")
;; Setup package management
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;; Install and configure dependencies
(use-package templatel :ensure t)
(use-package htmlize
  :ensure t
  :config
  (setq org-html-htmlize-output-type 'css))

(use-package weblorg
  :ensure t)

(require 'weblorg)

;; route for rendering each post
(weblorg-route
 :name "posts"
 :input-pattern "posts/*.org"
 :template "post.html"
 :output "output/posts/{{ slug }}.html"
 :url "/posts/{{ slug }}.html")

 ;; route for rendering each page
(weblorg-route
 :name "pages"
 :input-pattern "pages/*.org"
 :template "page.html"
 :output "output/{{ slug }}.html"
 :url "/{{ slug }}.html")

;; Generate posts summary
(weblorg-route
 :name "index"
 :input-pattern "posts/*.org"
 :input-aggregate #'weblorg-input-aggregate-all-desc
 :template "blog.html"
 :output "output/index.html"
 :url "/")

;; route for static assets that also copies files to output directory
(weblorg-copy-static
 :output "static/{{ file }}"
 :url "/static/{{ file }}")

;; fire the engine and export all the files declared in the routes above
(weblorg-export)

The contents of the /pages and /posts directories are two simple org files with content like

#+TITLE: Meeting

* some meeting page

some text, lorem ipsum

after calling emacs --script publish.el i get the error message

Invalid time specification

I tried it on two different Windows 10 machines and one Manjaro machine. Someone has an idea what could be wrong?

fklappan commented 3 years ago

arg sorry, nevermind...

The #+DATE: [2020-07-12 So 21:52] directive is necessary.

Could be added to the getting started guide.

The simple (unthemed) export now works.

clarete commented 3 years ago

Hi @fklappan thanks for reporting this issue πŸ™‡πŸΎ I'm very glad that you worked around this issue but I think this still counts as a bug on weblorg πŸ˜… sorry about that! that field shouldn't exactly be required for the rendering to work. I guess this is an issue on the default template itself. it should test if the date field is present before trying to convert it. (one could also see that as an issue with the date function itself, but I feel like reporting that kind of error might be wanted in case the data is coming from any other data source that isn't exactly the org file). I'll be back with a fix! πŸ˜„

clarete commented 3 years ago

This should be enough to fix it https://github.com/emacs-love/weblorg/commit/ffea6a93f5d35fed8532f1187463a27eb46bff0a. I'll close this bug but please feel free to re-open it or open a new one if this change isn't enough! thanks for taking the time to bring this up, really appreciate it πŸ™‡πŸΎ