On Sat, Jul 24, 2010 at 01:49:44PM +0200, David Maus wrote:
> 
> Hi Tomás,
> 
> Could I asked you to send the patch again as an attachment of type
> text/plain?  If you do so Org mode's patchtracker is able to pick it
> up for further review.

OK, I'll retry -- seems I made a mistake the first round. Here it
goes...

(BTW -- has anyone an idea why I can't subscribe to the list?)

Thanks
-- tomás
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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
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

Reply via email to