yatex

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 diff
     1.1 --- a/yahtml.el	Thu Dec 09 14:41:57 2010 +0900
     1.2 +++ b/yahtml.el	Thu Dec 09 15:24:02 2010 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; -*- Emacs-Lisp -*-
     1.5  ;;; (c) 1994-2010 by HIROSE Yuuji [yuuji(@)yatex.org]
     1.6 -;;; Last modified Thu Dec  9 14:40:52 2010 on firestorm
     1.7 +;;; Last modified Thu Dec  9 15:16:06 2010 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  (defconst yahtml-revision-number "1.74.2"
    1.11 @@ -2341,15 +2341,21 @@
    1.12    (let ((e (cond
    1.13  	    ((null e) "td")
    1.14  	    ((stringp e) e)
    1.15 -	    (t (read-string "Enclose with: " "td"))))
    1.16 -	p q (ws "[ \t]"))
    1.17 +	    (t (read-string "Enclose with(`thd' means th td td..): " "th"))))
    1.18 +	(ws "[ \t]")
    1.19 +	elm p i)
    1.20      (if (string= delim "") (setq delim " \t\n"))
    1.21 -    (setq delim (concat "[" delim "]+"))
    1.22 +    (setq delim (concat "[" delim "]+")
    1.23 +	  elm (if (string= "thd" e)
    1.24 +		  (cons "th" "td")
    1.25 +		(cons e e)))
    1.26      (save-excursion
    1.27        (save-restriction
    1.28  	(narrow-to-region beg end)
    1.29  	(goto-char (setq p (point-min)))
    1.30 +	(setq i 0 e (car elm))
    1.31  	(while (re-search-forward delim nil t)
    1.32 +	  (setq e (if (= (setq i (1+ i)) 1) (car elm) (cdr elm)))
    1.33  	  (goto-char (match-beginning 0))
    1.34  	  (insert "</" e ">")
    1.35  	  (save-excursion
    1.36 @@ -2366,7 +2372,9 @@
    1.37  (defun yahtml-tr-region (e delim beg end)
    1.38    "Enclose lines in a form tab-sv/csv with <tr><td>..</td></tr>."
    1.39    (interactive "P\nsDelimiter(s): \nr")
    1.40 -  (setq e (if (and e (listp e)) (read-string "Enclose with: " "th")))
    1.41 +  (setq e (if (and e (listp e))
    1.42 +	      (read-string "Enclose with(td or th, `thd' -> th td td td...: "
    1.43 +			   "th")))
    1.44    (save-excursion
    1.45      (save-restriction
    1.46        (narrow-to-region (point) (mark))