emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Cooper Oscarfono <bleat@baaa.sh>
To: emacs-orgmode@gnu.org
Subject: org-publish producing <nil> element tags instead of honoring what is specified in :html-divs
Date: Thu, 30 Mar 2023 18:27:46 +1300	[thread overview]
Message-ID: <08517f41-7998-68cb-d544-60cc36392567@baaa.sh> (raw)


[-- 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 --]

             reply	other threads:[~2023-03-30  5:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  5:27 Cooper Oscarfono [this message]
2023-03-30  9:57 ` org-publish producing <nil> element tags instead of honoring what is specified in :html-divs Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08517f41-7998-68cb-d544-60cc36392567@baaa.sh \
    --to=bleat@baaa.sh \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).