emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] What's wrong with org-export-html-final-hook in 8.x


From: visayafan
Subject: Re: [O] What's wrong with org-export-html-final-hook in 8.x
Date: Wed, 15 May 2013 01:12:35 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Rasmus <address@hidden> 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
--




reply via email to

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