changeset 157:e3d7307f71e0 dev

yahtml-td-region(): `thd' means <th> for 1st column <td> for the rest.
author yuuji@gentei.org
date Thu, 09 Dec 2010 15:24:02 +0900
parents 9b5c19e860d8
children 2638644ff9a0
files yahtml.el
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/yahtml.el	Thu Dec 09 14:41:57 2010 +0900
+++ b/yahtml.el	Thu Dec 09 15:24:02 2010 +0900
@@ -1,6 +1,6 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; (c) 1994-2010 by HIROSE Yuuji [yuuji(@)yatex.org]
-;;; Last modified Thu Dec  9 14:40:52 2010 on firestorm
+;;; Last modified Thu Dec  9 15:16:06 2010 on firestorm
 ;;; $Id$
 
 (defconst yahtml-revision-number "1.74.2"
@@ -2341,15 +2341,21 @@
   (let ((e (cond
 	    ((null e) "td")
 	    ((stringp e) e)
-	    (t (read-string "Enclose with: " "td"))))
-	p q (ws "[ \t]"))
+	    (t (read-string "Enclose with(`thd' means th td td..): " "th"))))
+	(ws "[ \t]")
+	elm p i)
     (if (string= delim "") (setq delim " \t\n"))
-    (setq delim (concat "[" delim "]+"))
+    (setq delim (concat "[" delim "]+")
+	  elm (if (string= "thd" e)
+		  (cons "th" "td")
+		(cons e e)))
     (save-excursion
       (save-restriction
 	(narrow-to-region beg end)
 	(goto-char (setq p (point-min)))
+	(setq i 0 e (car elm))
 	(while (re-search-forward delim nil t)
+	  (setq e (if (= (setq i (1+ i)) 1) (car elm) (cdr elm)))
 	  (goto-char (match-beginning 0))
 	  (insert "</" e ">")
 	  (save-excursion
@@ -2366,7 +2372,9 @@
 (defun yahtml-tr-region (e delim beg end)
   "Enclose lines in a form tab-sv/csv with <tr><td>..</td></tr>."
   (interactive "P\nsDelimiter(s): \nr")
-  (setq e (if (and e (listp e)) (read-string "Enclose with: " "th")))
+  (setq e (if (and e (listp e))
+	      (read-string "Enclose with(td or th, `thd' -> th td td td...: "
+			   "th")))
   (save-excursion
     (save-restriction
       (narrow-to-region (point) (mark))

yatex.org