emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-publish producing <nil> element tags instead of honoring what is specified in :html-divs
@ 2023-03-30  5:27 Cooper Oscarfono
  2023-03-30  9:57 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Cooper Oscarfono @ 2023-03-30  5:27 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 2581 bytes --]

Greetings,

New to the list, and this is my first post.  I hope it's ok.

I'm experiencing an issue when trying to use org-publish.

In attempting to convert the divs generated for preamble, content, and 
postamble, by specifying, what I believe to be the appropriate setting 
within org-publish-project-alist :


    :html-divs '((preamble "header" :id "preamble")
               (content "main" :id "content")
              (postamble "footer" :id "postamble"))


Instead of generating <header id="preamble"...</header>, <main 
id="content">...</main>, and <footer id="postamble">...</footer>, as 
expected, I am generating: <nil id="nil" class="status">...</nil>, <nil 
id="nil" class="content">...</nil>, and <nil id="nil" 
class="status">...</nil>, respectively.

This also happens when I use this approach instead:


   :html-divs '((preamble . "<header id=\"preamble\">")
             (content "<main id=\"content\">")
             (postamble "<footer id=\"postamble\">"))


I am doing a slightly weird thing in that I am using the following code 
to pull in a header.org and footer.org file, and extract the html code 
contained within using org-export and add these values to the 
appropriate :html-{preamble,postamble} variables as shown below:

This is the function:

     (defun get-org-component-contents (component)
       "Retrieve the HTML contents of the specified org component."
       (with-temp-buffer
         (insert-file-contents (concat "./components/" component ".org"))
         (org-export-to-buffer 'html "*Org HTML Export*" nil nil nil t)
         ;; (insert-file-contents (concat "./components/" component 
".html"))
         (buffer-string)))

and I set the variables:


     (setq header-contents (get-org-component-contents "header"))
     (setq footer-contents (get-org-component-contents "footer"))


then define them into the org-publish-project-alist like so:

    :html-preamble ,header-contents
    :html-postamble ,footer-contents

This works seemlessly when I don't try to change the :html-div elements.


Is this me doing something wrong here or could this be a potential issue 
with org-publish?


I'm trying to achieve some modularity to the way i do things and must 
confess, i've only recently begun to start wrapping my head around 
emacs-lisp, so it's more likely to be a me problem.

Any pointers you can offer are appreciated.



Regards,



Cooper.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3191 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: org-publish producing <nil> element tags instead of honoring what is specified in :html-divs
  2023-03-30  5:27 org-publish producing <nil> element tags instead of honoring what is specified in :html-divs Cooper Oscarfono
@ 2023-03-30  9:57 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-03-30  9:57 UTC (permalink / raw)
  To: Cooper Oscarfono; +Cc: emacs-orgmode

Cooper Oscarfono <bleat@baaa.sh> writes:

> In attempting to convert the divs generated for preamble, content, and 
> postamble, by specifying, what I believe to be the appropriate setting 
> within org-publish-project-alist :
>
>
>     :html-divs '((preamble "header" :id "preamble")
>                (content "main" :id "content")
>               (postamble "footer" :id "postamble"))
>
>
> Instead of generating <header id="preamble"...</header>, <main 
> id="content">...</main>, and <footer id="postamble">...</footer>, as 
> expected, I am generating: <nil id="nil" class="status">...</nil>, <nil 
> id="nil" class="content">...</nil>, and <nil id="nil" 
> class="status">...</nil>, respectively.

Looks like double quoting.
You likely have something like
 (setq org-publish-project-alist '(... :html-divs '(...)) ...).

Because of nested "'", the actual value of :html-divs is set to
 (quote (...)) and Org is not able to get preamble/contents/postamble
part from there.

To illustrate try the following

(setq test '(:a '((preamble "a" "b"))))
(assq 'preamble (plist-get test :a))

and then the same but without double quoting

(setq test '(:a ((preamble "a" "b"))))
(assq 'preamble (plist-get test :a))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-03-30  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  5:27 org-publish producing <nil> element tags instead of honoring what is specified in :html-divs Cooper Oscarfono
2023-03-30  9:57 ` Ihor Radchenko

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).