emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [PATCH] org-export-generic, "text markup" -- and a request
@ 2010-07-23 11:19 tomas
  2010-07-24  6:39 ` Daniel Bausch
  2010-08-02 13:54 ` Orgmode[PATCH] org-export-generic, "text markup" " Wes Hardaker
  0 siblings, 2 replies; 20+ messages in thread
From: tomas @ 2010-07-23 11:19 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 2618 bytes --]

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 <del>mumble</del>.

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''")
                ("+" . "<del>%s</del>"))))

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

[-- Attachment #1.1.2: org-export-markup.patch --]
[-- Type: text/x-diff, Size: 0 bytes --]



[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-08-23 14:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23 11:19 [PATCH] org-export-generic, "text markup" -- and a request tomas
2010-07-24  6:39 ` Daniel Bausch
2010-07-24  8:23   ` tomas
2010-07-24 11:49     ` David Maus
2010-07-24 14:07       ` tomas
2010-07-25 14:47         ` David Maus
2010-07-25 16:35           ` tomas
2010-07-26 14:41             ` [PATCH] org-export-generic, &quot; text markup&quot; " Robert Goldman
2010-07-31  8:29               ` Bastien
2010-08-02  3:02                 ` Robert Goldman
2010-08-02 13:54 ` Orgmode[PATCH] org-export-generic, "text markup" " Wes Hardaker
2010-08-02 17:29   ` tomas
2010-08-13 20:35   ` Carsten Dominik
2010-08-19  3:04     ` Robert Goldman
2010-08-20 14:09       ` Carsten Dominik
2010-08-20 17:05         ` Robert Goldman
2010-08-21  3:25           ` Carsten Dominik
2010-08-23 14:16             ` Wes Hardaker
2010-08-23 14:24               ` Robert Goldman
2010-08-23 14:15           ` Wes Hardaker

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).