emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)]
@ 2015-12-12 19:26 Pillow Kuda Sai
  2015-12-15 13:14 ` Robert Klein
  0 siblings, 1 reply; 6+ messages in thread
From: Pillow Kuda Sai @ 2015-12-12 19:26 UTC (permalink / raw)
  To: emacs-orgmode

My setup:
;;; Minimal setup to load latest 'org-mode'
;; activate debugging
(setq debug-on-error t
      debug-on-signal nil
      debug-on-quit nil)

;; add latest org-mode to load path
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-20151123/"))
(add-to-list 'load-path (expand-file-name
"~/.emacs.d/elpa/org-20151123/" t))

What I did:
(require 'ox-publish)
(setq org-publish-project-alist
      '(
	("org-notes"
	 :base-directory "~/org/"
	 :base-extension "org"
	 :publishing-directory "~/public_html/"
	 :recursive t
	 :publishing-function org-html-publish-to-html
	 :headline-levels 4             ; Just the default for this project.
	 :auto-preamble t
	 ;; :html-preamble "Howdy" ; does work
	 :html-preamble (concat "Howdy")
	 )
	("org-static"
	 :base-directory "~/org/"
	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
	 :publishing-directory "~/public_html/"
	 :recursive t
	 :publishing-function org-publish-attachment
	 )
	("org" :components ("org-notes" "org-static"))))

What I expected: All off the above code is from
http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
except for the :html-preamble part. I want to add my own preamble by
using a function. :html-preamble sets org-html-preamble (the options
are: nil, t, string, function that must return a string). When using a
string (:html-preamble "Howdy") it works. When using a function that
returns a string (:html-preamble (concat "Howdy")) it doesn't work.

I'm not entirely sure if this is a bug or if I'm missing something but
hopefully the mailing-list can help me out :)

Thanks in advance, Pillow
------------------------------------------------------------------------



Emacs  : GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
 of 2015-10-09
Package: Org-mode version 8.3.2 (8.3.2-39-gd537a3-elpa @
/home/pillow/.emacs.d/elpa/org-20151123/)

current state:
==============
(setq
 org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa"
. artist) ("asymptote" . asy)
		      ("dot" . fundamental) ("sqlite" . sql) ("calc" . fundamental)
("C" . c) ("cpp" . c++)
		      ("C++" . c++) ("screen" . shell-script))
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
		      org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-sparse-tree-default-date-type 'scheduled-or-deadline
 org-latex-default-packages-alist '(("AUTO" "inputenc" t) ("T1"
"fontenc" t) ("" "fixltx2e" nil) ("" "graphicx" t)
				    ("" "longtable" nil) ("" "float" nil) ("" "wrapfig" nil) (""
"rotating" nil)
				    ("normalem" "ulem" t) ("" "amsmath" t) ("" "textcomp" t) (""
"marvosym" t)
				    ("" "wasysym" t) ("" "amssymb" t) ("" "hyperref" nil)
"\\tolerance=1000")
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-clock-into-drawer nil
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-text-markup-alist '((bold . "\\textbf{%s}") (code . verb)
(italic . "\\emph{%s}")
			       (strike-through . "\\sout{%s}") (underline . "\\uline{%s}")
			       (verbatim . protectedtexttt))
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-html-allow-name-attribute-in-anchors t
 org-latex-logfiles-extensions '("aux" "idx" "log" "out" "toc" "nav"
"snm" "vrb")
 org-export-copy-to-kill-ring 'if-interactive
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-show-block-all append
local] 5]
		 #[nil "\300\301\302\303\304$\207"
		   [org-add-hook change-major-mode-hook org-babel-show-result-all
append local] 5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-hide-inline-tasks
		  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-html-mathjax-template "<script type=\"text/javascript\"
src=\"%PATH\"></script>\n<script
type=\"text/javascript\">\n<!--/*--><![CDATA[/*><!--*/\n
MathJax.Hub.Config({\n        // Only one of the two following lines,
depending on user settings\n        // First allows browser-native
MathML display, second forces HTML/CSS\n        :MMLYES: config:
[\"MMLorHTML.js\"], jax: [\"input/TeX\"],\n        :MMLNO: jax:
[\"input/TeX\", \"output/HTML-CSS\"],\n        extensions:
[\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",\n
        \"TeX/noUndefined.js\"],\n        tex2jax: {\n
inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],\n            displayMath: [
['$$','$$'], [\"\\\\[\",\"\\\\]\"],
[\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],\n
skipTags:
[\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],\n
        ignoreClass: \"tex2jax_ignore\",\n            processEscapes:
false,\n            processEnvironments: true,\n            preview:
\"TeX\"\n        },\n        showProcessingMessages: true,\n
displayAlign: \"%ALIGN\",\n        displayIndent: \"%INDENT\",\n\n
  \"HTML-CSS\": {\n             scale: %SCALE,\n
availableFonts: [\"STIX\",\"TeX\"],\n             preferredFont:
\"TeX\",\n             webFont: \"TeX\",\n             imageFont:
\"TeX\",\n             showMathMenu: true,\n        },\n
MMLorHTML: {\n             prefer: {\n                 MSIE:
\"MML\",\n                 Firefox: \"MML\",\n                 Opera:
\"HTML\",\n                 other:   \"HTML\"\n             }\n
}\n    });\n/*]]>*///-->\n</script>"
 org-html-mathjax-options '((path
"http://orgmode.org/mathjax/MathJax.js") (scale "100") (align "center")
			    (indent "2em") (mathml nil))
 org-export-with-creator 'comment
 org-html-creator-string "<a
href=\"http://www.gnu.org/software/emacs/\">Emacs</a> 25.0.50.2 (<a
href=\"http://orgmode.org\">Org</a> mode 8.2.10)"
 org-latex-with-hyperref "\\hypersetup{\n pdfauthor={%a},\n
pdftitle={%t},\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c},
\n pdflang={%L}}\n"
 org-timer-default-timer 0
 org-babel-process-comment-text 'org-babel-trim
 org-babel-tangle-lang-exts '(("emacs-lisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-latex-listings-langs '((emacs-lisp "Lisp") (lisp "Lisp") (clojure
"Lisp") (c "C") (cc "C++")
			    (fortran "fortran") (perl "Perl") (cperl "Perl") (python
"Python") (ruby "Ruby")
			    (html "HTML") (xml "XML") (tex "TeX") (latex "[LaTeX]TeX")
(shell-script "bash")
			    (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") (sql "SQL")
(sqlite "sql"))
 org-effort-durations '(("h" . 60) ("d" . 480) ("w" . 2400) ("m" . 9600)
("y" . 96000))
 org-html-format-headline-function 'ignore
 org-structure-template-alist '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src
lang=\"?\">\n\n</src>")
				("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" "<example>\n?\n</example>")
				("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE" "<quote>\n?\n</quote>")
				("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" "<verse>\n?\n</verse>")
				("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM" "<verbatim>\n?\n</verbatim>")
				("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" "<center>\n?\n</center>")
				("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" "<literal
style=\"latex\">\n?\n</literal>")
				("L" "#+LaTeX: " "<literal style=\"latex\">?</literal>")
				("h" "#+BEGIN_HTML\n?\n#+END_HTML" "<literal
style=\"html\">\n?\n</literal>")
				("H" "#+HTML: " "<literal style=\"html\">?</literal>")
				("a" "#+BEGIN_ASCII\n?\n#+END_ASCII" "") ("A" "#+ASCII: " "")
				("i" "#+INDEX: ?" "#+INDEX: ?")
				("I" "#+INCLUDE: %file ?" "<include file=%file markup=\"?\">"))
 org-export-creator-string "Emacs 25.0.50.2 (Org mode 8.2.10)"
 org-html-format-inlinetask-function 'ignore
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-src-fontify-natively nil
 org-publish-project-alist '(("org-notes" :base-directory "~/org/"
:base-extension "org" :publishing-directory
			      "~/public_html/" :recursive t :publishing-function
org-html-publish-to-html
			      :headline-levels 4 :auto-preamble t :html-preamble (concat
"Howdy"))
			     ("org-static" :base-directory "~/org/" :base-extension
			      "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
:publishing-directory
			      "~/public_html/" :recursive t :publishing-function
org-publish-attachment)
			     ("org" :components ("org-notes" "org-static")))
 )

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)]
  2015-12-12 19:26 Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
@ 2015-12-15 13:14 ` Robert Klein
  2015-12-19 16:43   ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa <at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Klein @ 2015-12-15 13:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I only use a function name, e.g.

(defun my-html-preamble (options)
	"my preamble")

and

(setq org-publish-project-alist
      '(
	("org-notes"
	 :base-directory "~/org/"
	 :base-extension "org"
	 :publishing-directory "~/public_html/"
 	 :recursive t
	 :publishing-function org-html-publish-to-html
         :html-preamble my-html-preamble)))

Does this work for you?

Best regards
Robert


On 12/12/2015 08:26 PM, Pillow Kuda Sai wrote:
> My setup:
> ;;; Minimal setup to load latest 'org-mode'
> ;; activate debugging
> (setq debug-on-error t
>       debug-on-signal nil
>       debug-on-quit nil)
> 
> ;; add latest org-mode to load path
> (add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-20151123/"))
> (add-to-list 'load-path (expand-file-name
> "~/.emacs.d/elpa/org-20151123/" t))
> 
> What I did:
> (require 'ox-publish)
> (setq org-publish-project-alist
>       '(
> 	("org-notes"
> 	 :base-directory "~/org/"
> 	 :base-extension "org"
> 	 :publishing-directory "~/public_html/"
> 	 :recursive t
> 	 :publishing-function org-html-publish-to-html
> 	 :headline-levels 4             ; Just the default for this project.
> 	 :auto-preamble t
> 	 ;; :html-preamble "Howdy" ; does work
> 	 :html-preamble (concat "Howdy")
> 	 )
> 	("org-static"
> 	 :base-directory "~/org/"
> 	 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
> 	 :publishing-directory "~/public_html/"
> 	 :recursive t
> 	 :publishing-function org-publish-attachment
> 	 )
> 	("org" :components ("org-notes" "org-static"))))
> 
> What I expected: All off the above code is from
> http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
> except for the :html-preamble part. I want to add my own preamble by
> using a function. :html-preamble sets org-html-preamble (the options
> are: nil, t, string, function that must return a string). When using a
> string (:html-preamble "Howdy") it works. When using a function that
> returns a string (:html-preamble (concat "Howdy")) it doesn't work.
> 
> I'm not entirely sure if this is a bug or if I'm missing something but
> hopefully the mailing-list can help me out :)
> 
> Thanks in advance, Pillow
> ------------------------------------------------------------------------
> 
> 
> 
> Emacs  : GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
>  of 2015-10-09
> Package: Org-mode version 8.3.2 (8.3.2-39-gd537a3-elpa @
> /home/pillow/.emacs.d/elpa/org-20151123/)
> 
> current state:
> ==============
> (setq
>  org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa"
> . artist) ("asymptote" . asy)
> 		      ("dot" . fundamental) ("sqlite" . sql) ("calc" . fundamental)
> ("C" . c) ("cpp" . c++)
> 		      ("C++" . c++) ("screen" . shell-script))
>  org-tab-first-hook '(org-hide-block-toggle-maybe
> org-src-native-tab-command-maybe
> 		      org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
>  org-sparse-tree-default-date-type 'scheduled-or-deadline
>  org-latex-default-packages-alist '(("AUTO" "inputenc" t) ("T1"
> "fontenc" t) ("" "fixltx2e" nil) ("" "graphicx" t)
> 				    ("" "longtable" nil) ("" "float" nil) ("" "wrapfig" nil) (""
> "rotating" nil)
> 				    ("normalem" "ulem" t) ("" "amsmath" t) ("" "textcomp" t) (""
> "marvosym" t)
> 				    ("" "wasysym" t) ("" "amssymb" t) ("" "hyperref" nil)
> "\\tolerance=1000")
>  org-speed-command-hook '(org-speed-command-default-hook
> org-babel-speed-command-hook)
>  org-occur-hook '(org-first-headline-recenter)
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-html-format-drawer-function '(lambda (name contents) contents)
>  org-clock-into-drawer nil
>  org-latex-format-inlinetask-function 'ignore
>  org-confirm-shell-link-function 'yes-or-no-p
>  org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
>  org-latex-text-markup-alist '((bold . "\\textbf{%s}") (code . verb)
> (italic . "\\emph{%s}")
> 			       (strike-through . "\\sout{%s}") (underline . "\\uline{%s}")
> 			       (verbatim . protectedtexttt))
>  org-latex-format-headline-function
> 'org-latex-format-headline-default-function
>  org-after-todo-state-change-hook '(org-clock-out-if-current)
>  org-latex-format-drawer-function '(lambda (name contents) contents)
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer
> org-src-mode-configure-edit-buffer)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-html-allow-name-attribute-in-anchors t
>  org-latex-logfiles-extensions '("aux" "idx" "log" "out" "toc" "nav"
> "snm" "vrb")
>  org-export-copy-to-kill-ring 'if-interactive
>  org-mode-hook '(#[nil "\300\301\302\303\304$\207"
> 		   [org-add-hook change-major-mode-hook org-show-block-all append
> local] 5]
> 		 #[nil "\300\301\302\303\304$\207"
> 		   [org-add-hook change-major-mode-hook org-babel-show-result-all
> append local] 5]
> 		 org-babel-result-hide-spec org-babel-hide-all-hashes)
>  org-archive-hook '(org-attach-archive-delete-maybe)
>  org-ascii-format-drawer-function '(lambda (name contents width) contents)
>  org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
> org-babel-execute-safely-maybe)
>  org-cycle-hook '(org-cycle-hide-archived-subtrees
> org-cycle-hide-drawers org-cycle-hide-inline-tasks
> 		  org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
>  org-html-mathjax-template "<script type=\"text/javascript\"
> src=\"%PATH\"></script>\n<script
> type=\"text/javascript\">\n<!--/*--><![CDATA[/*><!--*/\n
> MathJax.Hub.Config({\n        // Only one of the two following lines,
> depending on user settings\n        // First allows browser-native
> MathML display, second forces HTML/CSS\n        :MMLYES: config:
> [\"MMLorHTML.js\"], jax: [\"input/TeX\"],\n        :MMLNO: jax:
> [\"input/TeX\", \"output/HTML-CSS\"],\n        extensions:
> [\"tex2jax.js\",\"TeX/AMSmath.js\",\"TeX/AMSsymbols.js\",\n
>         \"TeX/noUndefined.js\"],\n        tex2jax: {\n
> inlineMath: [ [\"\\\\(\",\"\\\\)\"] ],\n            displayMath: [
> ['$$','$$'], [\"\\\\[\",\"\\\\]\"],
> [\"\\\\begin{displaymath}\",\"\\\\end{displaymath}\"] ],\n
> skipTags:
> [\"script\",\"noscript\",\"style\",\"textarea\",\"pre\",\"code\"],\n
>         ignoreClass: \"tex2jax_ignore\",\n            processEscapes:
> false,\n            processEnvironments: true,\n            preview:
> \"TeX\"\n        },\n        showProcessingMessages: true,\n
> displayAlign: \"%ALIGN\",\n        displayIndent: \"%INDENT\",\n\n
>   \"HTML-CSS\": {\n             scale: %SCALE,\n
> availableFonts: [\"STIX\",\"TeX\"],\n             preferredFont:
> \"TeX\",\n             webFont: \"TeX\",\n             imageFont:
> \"TeX\",\n             showMathMenu: true,\n        },\n
> MMLorHTML: {\n             prefer: {\n                 MSIE:
> \"MML\",\n                 Firefox: \"MML\",\n                 Opera:
> \"HTML\",\n                 other:   \"HTML\"\n             }\n
> }\n    });\n/*]]>*///-->\n</script>"
>  org-html-mathjax-options '((path
> "http://orgmode.org/mathjax/MathJax.js") (scale "100") (align "center")
> 			    (indent "2em") (mathml nil))
>  org-export-with-creator 'comment
>  org-html-creator-string "<a
> href=\"http://www.gnu.org/software/emacs/\">Emacs</a> 25.0.50.2 (<a
> href=\"http://orgmode.org\">Org</a> mode 8.2.10)"
>  org-latex-with-hyperref "\\hypersetup{\n pdfauthor={%a},\n
> pdftitle={%t},\n pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c},
> \n pdflang={%L}}\n"
>  org-timer-default-timer 0
>  org-babel-process-comment-text 'org-babel-trim
>  org-babel-tangle-lang-exts '(("emacs-lisp" . "el"))
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-metadown-hook '(org-babel-pop-to-session-maybe)
>  org-latex-listings-langs '((emacs-lisp "Lisp") (lisp "Lisp") (clojure
> "Lisp") (c "C") (cc "C++")
> 			    (fortran "fortran") (perl "Perl") (cperl "Perl") (python
> "Python") (ruby "Ruby")
> 			    (html "HTML") (xml "XML") (tex "TeX") (latex "[LaTeX]TeX")
> (shell-script "bash")
> 			    (gnuplot "Gnuplot") (ocaml "Caml") (caml "Caml") (sql "SQL")
> (sqlite "sql"))
>  org-effort-durations '(("h" . 60) ("d" . 480) ("w" . 2400) ("m" . 9600)
> ("y" . 96000))
>  org-html-format-headline-function 'ignore
>  org-structure-template-alist '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src
> lang=\"?\">\n\n</src>")
> 				("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" "<example>\n?\n</example>")
> 				("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE" "<quote>\n?\n</quote>")
> 				("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" "<verse>\n?\n</verse>")
> 				("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM" "<verbatim>\n?\n</verbatim>")
> 				("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" "<center>\n?\n</center>")
> 				("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" "<literal
> style=\"latex\">\n?\n</literal>")
> 				("L" "#+LaTeX: " "<literal style=\"latex\">?</literal>")
> 				("h" "#+BEGIN_HTML\n?\n#+END_HTML" "<literal
> style=\"html\">\n?\n</literal>")
> 				("H" "#+HTML: " "<literal style=\"html\">?</literal>")
> 				("a" "#+BEGIN_ASCII\n?\n#+END_ASCII" "") ("A" "#+ASCII: " "")
> 				("i" "#+INDEX: ?" "#+INDEX: ?")
> 				("I" "#+INCLUDE: %file ?" "<include file=%file markup=\"?\">"))
>  org-export-creator-string "Emacs 25.0.50.2 (Org mode 8.2.10)"
>  org-html-format-inlinetask-function 'ignore
>  org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>  org-src-fontify-natively nil
>  org-publish-project-alist '(("org-notes" :base-directory "~/org/"
> :base-extension "org" :publishing-directory
> 			      "~/public_html/" :recursive t :publishing-function
> org-html-publish-to-html
> 			      :headline-levels 4 :auto-preamble t :html-preamble (concat
> "Howdy"))
> 			     ("org-static" :base-directory "~/org/" :base-extension
> 			      "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
> :publishing-directory
> 			      "~/public_html/" :recursive t :publishing-function
> org-publish-attachment)
> 			     ("org" :components ("org-notes" "org-static")))
>  )
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa <at> /home/pillow/.emacs.d/elpa/org-20151123/)]
  2015-12-15 13:14 ` Robert Klein
@ 2015-12-19 16:43   ` Pillow Kuda Sai
  2015-12-20  9:12     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Pillow Kuda Sai @ 2015-12-19 16:43 UTC (permalink / raw)
  To: emacs-orgmode

Hi Robert,

Thanks for the reply but my end goal is to insert the contents of another 
file as the preamble. Ultimately, I want something like this:

(insert-file-contents "~/Blog/html/preamble.html")

To be inserted as the preamble.

Your example works unmodified but once I try to insert the contents of my 
preamble.html it doesn't get included.

I tried:

(defun my-html-preamble (options)
  (insert-file-contents "~/Blog/html/preamble.html"))

but this does not include my preamble.html.

As far as I could tell from the documentation :html-preamble should accept 
any function that returns a string but so far no luck.

Kind regards,

pillow.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa <at> /home/pillow/.emacs.d/elpa/org-20151123/)]
  2015-12-19 16:43   ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa <at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
@ 2015-12-20  9:12     ` Nicolas Goaziou
  2015-12-20 10:06       ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa<at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2015-12-20  9:12 UTC (permalink / raw)
  To: Pillow Kuda Sai; +Cc: emacs-orgmode

Hello,

Pillow Kuda Sai <pillow.kuda.sai@gmail.com> writes:

> (defun my-html-preamble (options)
>   (insert-file-contents "~/Blog/html/preamble.html"))
>
> but this does not include my preamble.html.
>
> As far as I could tell from the documentation :html-preamble should accept 
> any function that returns a string but so far no luck.

  (insert-file-contents "~/Blog/html/preamble.html")

doesn't return a string, but a list when evaluated (see
`insert-file-contents' docstring).

You may try

  (org-file-contents "~/Blog/html/preamble.html")


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa<at> /home/pillow/.emacs.d/elpa/org-20151123/)]
  2015-12-20  9:12     ` Nicolas Goaziou
@ 2015-12-20 10:06       ` Pillow Kuda Sai
  2015-12-21  1:05         ` Robert Klein
  0 siblings, 1 reply; 6+ messages in thread
From: Pillow Kuda Sai @ 2015-12-20 10:06 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail <at> nicolasgoaziou.fr> writes:

> You may try
> 
>   (org-file-contents "~/Blog/html/preamble.html")

That worked! Should have figured out that insert-file-contents does not 
return a string. Thanks for the help Nicolas!

Happy holidays,

pillow.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa<at> /home/pillow/.emacs.d/elpa/org-20151123/)]
  2015-12-20 10:06       ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa<at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
@ 2015-12-21  1:05         ` Robert Klein
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Klein @ 2015-12-21  1:05 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

On 12/20/2015 11:06 AM, Pillow Kuda Sai wrote:
> Nicolas Goaziou <mail <at> nicolasgoaziou.fr> writes:
> 
>> You may try
>>
>>   (org-file-contents "~/Blog/html/preamble.html")
> 
> That worked! Should have figured out that insert-file-contents does not 
> return a string. Thanks for the help Nicolas!
> 
> Happy holidays,
> 
> pillow.
> 


ah, I'll try that, too.

My current solution is a function like


(defun my-html-preamble (options)
  (with-temp-buffer
    (insert-file-contents "~/Documents/myproject/html/preamble.html")
    (buffer-string)))


Best regards
Robert

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-21  1:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-12 19:26 Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa @ /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
2015-12-15 13:14 ` Robert Klein
2015-12-19 16:43   ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa <at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
2015-12-20  9:12     ` Nicolas Goaziou
2015-12-20 10:06       ` Bug: html-preamble doesn't work with a function [8.3.2 (8.3.2-39-gd537a3-elpa<at> /home/pillow/.emacs.d/elpa/org-20151123/)] Pillow Kuda Sai
2015-12-21  1:05         ` Robert Klein

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).