Mercurial > hgrepos > hgweb.cgi > yatex
comparison yahtml.el @ 396:2fc714f03ddf dev
Clarify which element the current class name completions for
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 16 Jan 2015 10:47:48 +0900 |
parents | 67fa6d791bc9 |
children | 781604df4cbd |
comparison
equal
deleted
inserted
replaced
395:5aa8208fbef0 | 396:2fc714f03ddf |
---|---|
1 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- | 1 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- |
2 ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] | 2 ;;; (c) 1994-2015 by HIROSE Yuuji [yuuji(@)yatex.org] |
3 ;;; Last modified Fri Jan 16 10:00:10 2015 on firestorm | 3 ;;; Last modified Fri Jan 16 10:44:54 2015 on firestorm |
4 ;;; $Id$ | 4 ;;; $Id$ |
5 | 5 |
6 (defconst yahtml-revision-number "1.77" | 6 (defconst yahtml-revision-number "1.78.1" |
7 "Revision number of running yahtml.el") | 7 "Revision number of running yahtml.el") |
8 | 8 |
9 ;;; Commentary: | 9 ;;; Commentary: |
10 | 10 |
11 ;;;[Installation] | 11 ;;;[Installation] |
893 ;;(indent-relative-maybe) | 893 ;;(indent-relative-maybe) |
894 (if (cdr (assoc form yahtml-form-table)) | 894 (if (cdr (assoc form yahtml-form-table)) |
895 (save-excursion (insert (format "</%s>" form)))) | 895 (save-excursion (insert (format "</%s>" form)))) |
896 (if (search-backward "\"\"" p t) (forward-char 1)))) | 896 (if (search-backward "\"\"" p t) (forward-char 1)))) |
897 | 897 |
898 (defun yahtml-read-css (alist) | 898 (defun yahtml-read-css (alist &optional element) |
899 (let ((completion-ignore-case t) (delim " ") | 899 (let ((completion-ignore-case t) (delim " ") |
900 (minibuffer-completion-table alist)) | 900 (minibuffer-completion-table alist) |
901 (quotekey (substitute-command-keys "\\[quoted-insert]"))) | |
901 (read-from-minibuffer-with-history | 902 (read-from-minibuffer-with-history |
902 (substitute-command-keys | 903 (if YaTeX-japan |
903 (if YaTeX-japan | 904 (format "%sクラス(複数指定は%s SPCで区切る): " |
904 "クラス(複数指定は\\[quoted-insert] SPCで区切る): " | 905 (if element (concat element "の") "") quotekey) |
905 "class(or class list delimited by \\[quoted-insert] SPC): ")) | 906 (format "class%s(multiple class can be delimited by %s SPC): " |
907 (if element (concat " for " element) "") quotekey)) | |
906 nil YaTeX-minibuffer-completion-map nil))) | 908 nil YaTeX-minibuffer-completion-map nil))) |
907 | 909 |
908 (defvar yahtml-newpage-command "newpage.rb" | 910 (defvar yahtml-newpage-command "newpage.rb" |
909 "*Command name to create new HTML file referring to index.html. | 911 "*Command name to create new HTML file referring to index.html. |
910 This command should create new HTML file named argument 1 and | 912 This command should create new HTML file named argument 1 and |
932 (and (setq a (yahtml-css-get-element-completion-alist form)) | 934 (and (setq a (yahtml-css-get-element-completion-alist form)) |
933 (not (equal (YaTeX-last-key) ?\C-j)) | 935 (not (equal (YaTeX-last-key) ?\C-j)) |
934 (memq yahtml-current-completion-type '(multiline inline)) | 936 (memq yahtml-current-completion-type '(multiline inline)) |
935 (not (string-match "#" form)) | 937 (not (string-match "#" form)) |
936 (yahtml-make-optional-argument ;should be made generic? | 938 (yahtml-make-optional-argument ;should be made generic? |
937 "class" (yahtml-read-css a))) | 939 "class" (yahtml-read-css a form))) |
938 (if (and (intern-soft addin) (fboundp (intern-soft addin)) | 940 (if (and (intern-soft addin) (fboundp (intern-soft addin)) |
939 (stringp (setq s (funcall (intern addin)))) | 941 (stringp (setq s (funcall (intern addin)))) |
940 (string< "" s)) | 942 (string< "" s)) |
941 (if (eq (aref s 0) ? ) s (concat " " s)) | 943 (if (eq (aref s 0) ? ) s (concat " " s)) |
942 "")))) | 944 "")))) |
2142 (insert href)))) | 2144 (insert href)))) |
2143 ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr | 2145 ((setq attr (yahtml-on-assignment-p)) ;if on the assignment to attr |
2144 (if (and (equal attr "class") ;treat "class" attribute specially | 2146 (if (and (equal attr "class") ;treat "class" attribute specially |
2145 (setq css (yahtml-css-get-element-completion-alist tag))) | 2147 (setq css (yahtml-css-get-element-completion-alist tag))) |
2146 | 2148 |
2147 (setq new (yahtml-read-css css)) | 2149 (setq new (yahtml-read-css css tag)) |
2148 ;;other than "class", read parameter normally | 2150 ;;other than "class", read parameter normally |
2149 (setq new (yahtml-read-parameter attr))) | 2151 (setq new (yahtml-read-parameter attr))) |
2150 (goto-char (car (get 'yahtml-on-assignment-p 'region))) | 2152 (goto-char (car (get 'yahtml-on-assignment-p 'region))) |
2151 (delete-region (point) (cdr (get 'yahtml-on-assignment-p 'region))) | 2153 (delete-region (point) (cdr (get 'yahtml-on-assignment-p 'region))) |
2152 (insert new)) | 2154 (insert new)) |