[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] using flet to suppress meta generation in html export?

From: Matt Price
Subject: [O] using flet to suppress meta generation in html export?
Date: Tue, 6 Nov 2018 09:16:05 -0500


I was writing a function to quickly post the ocntents of subtrees to the Canvas Learning Management System.  I was trying to strip down the exported HTML to an absolute minimum and had forgotten about the body-only paramter to org-export-as (!!). So, my solution was to try to rebind 'org-html--build-meta-info to always just return "".   However, I can't seem to do it properly and I'm wondering if someone can help me figure out what's wrong. It's my first time using cl-flet! And I know there are various approaches, but I odn't understnad whyt this is notworking, when for instance, this does work for me:

(cl-flet ((+
           (lambda (&rest args) (message "no plus!"))))
  (+ "whoops"))
;; "no plus!"

Meanwhile, here's my  non-functional code:

(defun org-lms-headline-to-announcement (&optional course)
  (unless course
    (setq course org-lms-course))
  (cl-flet ((org-html--build-meta-info
            (lambda (&rest args) "")))
          ;; (prin1 (symbol-function  'org-html--build-meta-info))
          (let* ((org-export-with-toc nil)
                 (org-export-with-smart-quotes nil)
                 (org-html-postamble nil)
                 (org-html-preamble nil)
                 (org-html-xml-declaration nil)
                 (org-html-head-include-scripts nil)
                 (org-html-head-include-default-style nil)
                 ;;(atext (org-export-as 'html t))
                 (atitle (nth 4 (org-heading-components)))
                 (org-html-klipsify-src nil)
                 (org-export-with-title nil)
                 (courseid (plist-get course :id))
                 (atitle (nth 4 (org-heading-components)))
                 (atext (org-export-as 'html t nil t))
            ;; (message "BUILDMETA DEFN")
            ;; (prin1 (symbol-function  'org-html--build-meta-info))
            (message "%s" atext)
             (format  "courses/%s/discussion_topics" courseid) "POST"
             `(("title" . ,atitle)
               ("message" . ,atext)
               ("is_published" . t)
               ("is_announcement" . t))))))

(well, I mean, it works now that I am doing body-only! doh!

I appreciate any hints, thank you!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]