emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tomas@tuxteam.de
To: Daniel Bausch <DanielBausch@gmx.de>
Cc: tomas@tuxteam.de, emacs-orgmode@gnu.org
Subject: Re: Re: [PATCH] org-export-generic, "text markup" -- and a request
Date: Sat, 24 Jul 2010 10:23:29 +0200	[thread overview]
Message-ID: <20100724082329.GA21627@tomas> (raw)
In-Reply-To: <201007240839.53358.DanielBausch@gmx.de>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Jul 24, 2010 at 08:39:53AM +0200, Daniel Bausch wrote:
> Hi Tomas!
> 
> I have nothing to contribute to the real topic, but I wanted to inform you 
> that there is a software called dokuwiki - so I got a bit irritated, whether 
> you are reffering to that or to mediawiki, as you first stated.

No, that was a typo. In my special case it's actually dokuwiki (wasn't
my choice). But the patch itself isnt dependent on that.

> And (at least on the mailinglist) your patch is delivered as an empty file.

Whoops! thanks for the heads-up.

Here it is, inline (remember that I filtered out whitespace diffs -- the
indentation after patching isn't right, but the patch is more readable):

Usage is in my original mail.

- ------------------------------------------------------------------------
diff --git a/contrib/lisp/org-export-generic.el b/contrib/lisp/org-export-generic.el
index 1b099dd..88c6169 100644
- --- a/contrib/lisp/org-export-generic.el
+++ b/contrib/lisp/org-export-generic.el
@@ -473,6 +473,8 @@ The prefix ARG specifies how many levels of the outline should become
 underlined headlines.  The default is 3."
   (interactive "P")
   (setq-default org-todo-line-regexp org-todo-line-regexp)
+  (unwind-protect
+      (add-hook 'org-export-preprocess-hook 'org-export-generic-process-markup)
   (let* ((opt-plist (org-combine-plists (org-default-export-plist)
 					(org-infile-export-plist)))
 	 (region-p (org-region-active-p))
@@ -541,6 +543,8 @@ underlined headlines.  The default is 3."
 		  (if (equal ass "default") org-generic-export-type ass)
 		  org-generic-alist))))
 
+	   (markup-table (plist-get export-plist :markup)) ; Need this early
+
 	 (custom-times org-display-custom-times)
 	 (org-generic-current-indentation '(0 . 0))
 	 (level 0) (old-level 0) line txt lastwastext
@@ -1021,8 +1025,23 @@ underlined headlines.  The default is 3."
 	(setq end (next-single-property-change beg 'org-cwidth))
 	(delete-region beg end)
 	(goto-char beg)))
- -    (goto-char (point-min))))
+      (goto-char (point-min)))
+    ;; Unwind:
+    (remove-hook 'org-export-preprocess-hook 'org-export-generic-process-markup)))
 
+(defun org-export-generic-process-markup ()
+  (save-excursion
+    (goto-char (point-min))
+    (while (re-search-forward org-emph-re nil t)
+      (let* ((mpre (match-string 1))  ; match prefix...
+	     (msuf (match-string 5))  ; and suffix: leave alone
+	     (mchar (match-string 3)) ; org's "markup charater"
+	     (mtext (match-string 4)) ; the marked-up text
+	     (fmt (or (cdr (assoc mchar markup-table))  ; found?
+		      (concat mchar "%s" mchar)))) ; no: leave alone
+	(replace-match
+	 (format (concat "%s" fmt "%s") mpre mtext msuf)))
+      (backward-char))))
 
 (defun org-export-generic-format (export-plist prop &optional len n reverse)
   "converts a property specification to a string given types of properties
- ------------------------------------------------------------------------

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFMSqMBBcgs9XrR2kYRArNHAJwKtIEHDAY3F6+o7mhT9pKLreJHPQCcDM7w
fgjepSJwjsZqm3lv7903Caw=
=pbVQ
-----END PGP SIGNATURE-----

  reply	other threads:[~2010-07-24  8:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20100724082329.GA21627@tomas \
    --to=tomas@tuxteam.de \
    --cc=DanielBausch@gmx.de \
    --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).