emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [New exporter] custom emphasis in org-emphasis-alist


From: Nicolas Goaziou
Subject: Re: [O] [New exporter] custom emphasis in org-emphasis-alist
Date: Sun, 10 Feb 2013 09:37:08 +0100

Hello,

Gregor Kappler <address@hidden> writes:

> I am currently migrating my system and contribute my first stop:
> custom emphasis characters that I use extensively:
> - "!" is used for exclamations,
> - "?" for questions, and
> - "#" for in-text comments that I do not want exported.

Emphasis characters are now hard-coded. You cannot change them, though,
you can change how each back-end interprets them.

We are solidifying Org syntax for parsing purposes. Allowing variable
markup is asking for trouble. The plan is to make `org-emphasis-alist'
a defconst.

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


Regards,

-- 
Nicolas Goaziou



reply via email to

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