emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* What's wrong with org-export-html-final-hook in 8.x
@ 2013-05-14 14:16 visayafan
  2013-05-14 15:31 ` Rasmus
  0 siblings, 1 reply; 4+ messages in thread
From: visayafan @ 2013-05-14 14:16 UTC (permalink / raw)
  To: emacs-orgmode


Recently I upgrade my Org Mode from 7.8.11 to the latest 8.0.2 and find
org-export-html-final-hook doesn't work.

------------------------------
(add-hook 'org-export-html-final-hook 'org-delete-!!!)
(defun org-delete-!!! ()
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "AAAAA" nil t)
    (replace-match "<"))
  (goto-char (point-min))
  (while (re-search-forward "BBBBB" nil t)
    (replace-match ">")))
------------------------------

I need this piece of code because when I export my org note to html I
want something like   AAAAAfont color="red"BBBBBthis is
redAAAAA/fontBBBBB change to  <font color="red">this is red</font> then
I will have red color. but now it doen't work.

I find this org-hook link
http://orgmode.org/worg/org-configs/org-hooks.html, but this page
doesn't seem to help, it says nothing about the upgrade thing.

So, can anybody help about this? Any help would be very appreciated.

Sorry for my broken English :)

visayafan
--

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

* Re: What's wrong with org-export-html-final-hook in 8.x
  2013-05-14 14:16 What's wrong with org-export-html-final-hook in 8.x visayafan
@ 2013-05-14 15:31 ` Rasmus
  2013-05-14 17:12   ` visayafan
  0 siblings, 1 reply; 4+ messages in thread
From: Rasmus @ 2013-05-14 15:31 UTC (permalink / raw)
  To: emacs-orgmode

Hi Visayafan,

> Recently I upgrade my Org Mode from 7.8.11 to the latest 8.0.2 and find
> org-export-html-final-hook doesn't work.

This variable no longer exists, since quite I while I think (check the
git log if interested).  

You could switch to filters.  Here's an ugly hack for removing titles
on my web-site (the title is already inserted in a shared preamble).

#+BEGIN_SRC emacs-lisp
  (defun rasmus/org-html-ignore-title-if-present (string backend info)
      "Strip title if it's already there. Ignore BACKEND and INFO."
      (when (and (org-export-derived-backend-p backend 'html)
                 (string-match "h1 class=\"mytitle\"" string))
        (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))

  (add-to-list 'org-export-filter-final-output-functions
               'rasmus/org-html-ignore-title-if-present)
#+END_SRC

Hope it helps,
Rasmus

-- 
Summon the Mothership!

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

* Re: What's wrong with org-export-html-final-hook in 8.x
  2013-05-14 15:31 ` Rasmus
@ 2013-05-14 17:12   ` visayafan
  2013-05-14 18:10     ` visayafan
  0 siblings, 1 reply; 4+ messages in thread
From: visayafan @ 2013-05-14 17:12 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> You could switch to filters.  Here's an ugly hack for removing titles
> on my web-site (the title is already inserted in a shared preamble).
>
> #+BEGIN_SRC emacs-lisp
>   (defun rasmus/org-html-ignore-title-if-present (string backend info)
>       "Strip title if it's already there. Ignore BACKEND and INFO."
>       (when (and (org-export-derived-backend-p backend 'html)
>                  (string-match "h1 class=\"mytitle\"" string))
>         (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))
>
>   (add-to-list 'org-export-filter-final-output-functions
>                'rasmus/org-html-ignore-title-if-present)
> #+END_SRC
>

Thank you very much Rasmus, your code perfectly does the trick.

#+BEGIN_SRC emacs-lisp
(add-to-list 'org-export-filter-final-output-functions
             'fan/org-html-produce-inline-html)
(defun fan/org-html-produce-inline-html (string backend info)
  "replace !!!!! to < and @@@@@ to >"
  (when (and (org-export-derived-backend-p backend 'html)
             (string-match "!!!!!" string))
    (replace-regexp-in-string (rx  (= 5 "!")
                                   (group (+? anything))
                                   (= 5 "@"))
                              "<\\1>"
                              string)))
#+END_SRC

Now with this code and the macro below I can have colorful font inside a
paragraph.

#+BEGIN_SRC org
#+macro: color !!!!!font color="$1"@@@@@$2!!!!!/font@@@@@
before {{{color(red,this is red)}}} after
#+END_SRC

visayafan
--

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

* Re: What's wrong with org-export-html-final-hook in 8.x
  2013-05-14 17:12   ` visayafan
@ 2013-05-14 18:10     ` visayafan
  0 siblings, 0 replies; 4+ messages in thread
From: visayafan @ 2013-05-14 18:10 UTC (permalink / raw)
  To: emacs-orgmode



#+BEGIN_SRC emacs-lisp
(eval-after-load 'ox-html
  '(add-to-list 'org-export-filter-final-output-functions
             'fan/org-html-produce-inline-html))
#+END_SRC

----

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

end of thread, other threads:[~2013-05-14 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14 14:16 What's wrong with org-export-html-final-hook in 8.x visayafan
2013-05-14 15:31 ` Rasmus
2013-05-14 17:12   ` visayafan
2013-05-14 18:10     ` visayafan

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