From: visayafan <visayafan@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: What's wrong with org-export-html-final-hook in 8.x
Date: Wed, 15 May 2013 01:12:35 +0800 [thread overview]
Message-ID: <8738tp1o58.fsf@gmail.com> (raw)
In-Reply-To: 87r4h9mvcs.fsf@pank.eu
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
--
next prev parent reply other threads:[~2013-05-14 17:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2013-05-14 18:10 ` visayafan
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=8738tp1o58.fsf@gmail.com \
--to=visayafan@gmail.com \
--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).