From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Gregor Kappler <g.kappler@gmx.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [New exporter] custom emphasis in org-emphasis-alist
Date: Sun, 10 Feb 2013 10:45:37 +0100 [thread overview]
Message-ID: <87sj54fqny.fsf@gmail.com> (raw)
In-Reply-To: <876220h8ej.fsf@gmail.com> (Nicolas Goaziou's message of "Sun, 10 Feb 2013 09:37:08 +0100")
Completing myself,
> On the other hand, you may be able to parse custom markup with the help
> of a filter:
>
> #+begin_src emacs-lisp
> (defun my-special-markup (text backend info)
> (when (and (org-export-derived-backend-p backend 'html)
> (string-match "\\([ ('\"{]\\|^\\)\\(\\([?!#]\\)\\([^
> ,\"']\\|[^
> ,\"'].*?\\(?:
> .*?\\)\\{0,1\\}[^
> ,\"']\\)\\3\\)\\([- .,:!?;'\")}\\]\\|$\\)"
> text))
> (format (cond ((equal (match-string 3 text) "?")
> "<span class=\"org-question\">%s</span>")
> ((equal (match-string 3 text) "#") "<!--%s-->")
> (t "<span class=\"org-exclamation\">%s</span>"))
> (match-string 4 text))))
> (add-to-list 'org-export-filter-plain-text-functions 'my-special-markup)
> #+end_src
This solution will not work but in the simplest cases (no special
markup allowed within the tags).
For additional syntax, a better option would be to define a macro:
#+MACRO: excl @@html:<span class="org-exclamation">@@$1@@html:</span>@@
Then use it within the buffer:
A paragraph and {{{excl(some *bold* text within a special
container)}}}.
This allow for some flexibility. You can even define a babel block and
call it within a paragraph for more complicated (i.e. conditional)
stuff.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2013-02-10 9:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-10 0:32 [New exporter] custom emphasis in org-emphasis-alist Gregor Kappler
2013-02-10 0:55 ` François Pinard
2013-02-10 8:37 ` Nicolas Goaziou
2013-02-10 9:45 ` Nicolas Goaziou [this message]
2013-02-14 17:42 ` Gregor Kappler
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=87sj54fqny.fsf@gmail.com \
--to=n.goaziou@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=g.kappler@gmx.net \
/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).