emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: [PATCH] org-export-generic, "text markup" -- and a req


From: tomas
Subject: Re: [Orgmode] Re: [PATCH] org-export-generic, "text markup" -- and a request
Date: Sat, 24 Jul 2010 10:23:29 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----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 via email to

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