Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: <tomas <at> tuxteam.de>
Subject: Re: [PATCH] org-export-generic, "text markup" -- and a request
Newsgroups: gmane.emacs.orgmode
Date: Friday 23rd July 2010 11:19:31 UTC (over 6 years ago)
Hi,

I tried contacting the author of org-export-generic, but don't know
whether I succeeded. Since this little patch might be useful, here it
is.

I'm in the enviable situation of transforming some docs (which I've
written in org) to mediawiki (why some people enjoy using their browser
as a doc editor escapes me, but that's for another day :)

For this, I'll have to transform the "text markup" (as I'd call that)
(what org calls "emphasis"), i.e. *foo* would become **foo**, =grumble=
would become ''grumble'' and +mumble+ would become mumble.

You get the idea.

I've come up with a little patch which "works for me". If that seems
useful for you, please accept it; I'd be willing to beat it into shape
if you give me some advice wrt which shape is desirable :-)

Some notes:

The "translation mapping" (org markup -> target markup) lives in the
org-generic-alist under the symbol :markup, like so (this would be for
doku-wiki):

   (org-set-generic-type
      "doku-wiki"
      '(:key-binding   ?K
  [... many lines elided ...]
	:markup (("*" . "**%s**")
                ("/" . "//%s//")
                ("_" . "__%s__")
                ("=" . "''%s''")
                ("~" . "''%s''")
                ("+" . "%s"))))

that is, an alist mapping the (org) markup char to a (target) format
string.

I generated the patch with the -b option. Because I wrapped a
considerable chunk of code with unwind-protect, the white space noise
obscures the patch. As I don't think the patch is final, I preferred to
keep it (human) readable.

The working is fairly straightforward: it tacks the function
org-export-generic-process-markup onto the org-export-preprocess-hook
for the whole duration off org-export-generic (the unwind-protect is
there to take this function off the hook when finished). This
org-e-g-process-markup then makes a pass through the buffer (with
org-emph-re), doing its substitutions. Some fiddling was necessary since
org-emph-re matches (possibly) a bit more than strictly the marked-up
span (I think it would have been better to use zero-width assertions for
the prefix and suffix part of org-emph-re).

Patch attached.

Now the request: I tried (several times) subscribing to this list -- but
didn't succeed (I used -- or rather tried to use -- the web interface at
<http://lists.gnu.org/mailman/listinfo/emacs-orgmode>).
So please keep
me in Cc, at least as long as I wrangle with the subscriptions.

If anyone has a hint as to what I could try to subscribe, I'd be glad.

Thanks again, and regards
-- tomás
 
CD: 3ms