yatex

changeset 466:c7b93cfceb1b dev

Support iframe
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 19 Jul 2017 13:17:23 +0859
parents e9299b77df1f
children 4f8551386af2
files yahtml.el
diffstat 1 files changed, 28 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/yahtml.el	Mon Jun 12 08:41:27 2017 +0859
     1.2 +++ b/yahtml.el	Wed Jul 19 13:17:23 2017 +0859
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*-
     1.5  ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji(@)yatex.org]
     1.6 -;;; Last modified Mon Jun 12 08:40:51 2017 on firestorm
     1.7 +;;; Last modified Wed Jul 19 13:10:28 2017 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  (defconst yahtml-revision-number "1.79.3"
    1.11 @@ -444,7 +444,7 @@
    1.12      ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del")
    1.13      ("option") ("datalist")
    1.14      ;;HTML5
    1.15 -    ("video") ("audio") ("figure")
    1.16 +    ("video") ("audio") ("figure") ("iframe")
    1.17      ))
    1.18  
    1.19  (if yahtml-html4-strict
    1.20 @@ -1002,7 +1002,7 @@
    1.21  	(min (if (fboundp 'field-beginning) (field-beginning) (point-min))))
    1.22      (setq initial (YaTeX-minibuffer-string))
    1.23      (cond
    1.24 -     ((string-match "^http:" initial)
    1.25 +     ((string-match "^htt" initial)
    1.26        (setq cmpl (try-completion initial yahtml-urls)
    1.27  	    listfunc (list 'lambda nil
    1.28  			   (list 'all-completions initial 'yahtml-urls))
    1.29 @@ -1138,26 +1138,30 @@
    1.30        (set-marker e nil))))
    1.31  ;; ab%defgls/.|
    1.32  
    1.33 -(defun yahtml:a ()
    1.34 -  "Add-in function for <a>"
    1.35 +(defun yahtml-read-url (prompt)
    1.36    (let ((href ""))
    1.37      (setq yahtml-completing-buffer (current-buffer)
    1.38  	  yahtml-urls (append yahtml-urls-private yahtml-urls-local)
    1.39  	  href (yahtml-escape-chars-string
    1.40  		(read-from-minibuffer-with-history
    1.41 -		 "href: " "" yahtml-url-completion-map)))
    1.42 +		 prompt "" yahtml-url-completion-map)))
    1.43      (prog1
    1.44 -	(concat (yahtml-make-optional-argument
    1.45 -		 "href" href)
    1.46 -		(yahtml-make-optional-argument
    1.47 -		 "name" (read-string-with-history "name: ")))
    1.48 -      (if (and (string-match "^http://" href)
    1.49 +	href
    1.50 +      (if (and (string-match "^https?://" href)
    1.51  	       (null (assoc href yahtml-urls-private))
    1.52  	       (null (assoc href yahtml-urls-local)))
    1.53  	  (YaTeX-update-table
    1.54  	   (list href)
    1.55  	   'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local)))))
    1.56  
    1.57 +(defun yahtml:a ()
    1.58 +  "Add-in function for <a>"
    1.59 +  (let ((href (yahtml-read-url "href: ")))
    1.60 +    (concat (yahtml-make-optional-argument
    1.61 +	     "href" href)
    1.62 +	    (yahtml-make-optional-argument
    1.63 +	     "name" (read-string-with-history "name: ")))))
    1.64 +
    1.65  (defvar yahtml-parameters-completion-alist
    1.66    '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center"))
    1.67      ("clear" ("left") ("right") ("center") ("all") ("none"))
    1.68 @@ -1831,6 +1835,15 @@
    1.69  (defun yahtml:figure ()
    1.70    (setq yahtml-last-typeface-cmd "figcaption"))
    1.71  
    1.72 +(defun yahtml:iframe ()
    1.73 +  (let ((src (yahtml-read-url "src: ")))
    1.74 +    (concat
    1.75 +     (yahtml-make-optional-argument "src" src)
    1.76 +     (yahtml-make-optional-argument
    1.77 +      "width" (YaTeX-read-string-or-skip "width: "))
    1.78 +     (yahtml-make-optional-argument
    1.79 +      "height" (YaTeX-read-string-or-skip "height: ")))))
    1.80 +
    1.81  ;;; ---------- Jump ----------
    1.82  (defun yahtml-on-href-p ()
    1.83    "Check if point is on href clause."
    1.84 @@ -2838,7 +2851,7 @@
    1.85  	(if (file-directory-p (car (car list)))
    1.86  	    (progn
    1.87  	      (setq url (cdr (car list)))
    1.88 -	      (if (string-match "\\(http://[^/]*\\)/" url)
    1.89 +	      (if (string-match "\\(https?://[^/]*\\)/" url)
    1.90  		  (setq docroot (substring url (match-end 1)))
    1.91  		(setq docroot url))
    1.92  	      (cond
    1.93 @@ -3056,6 +3069,9 @@
    1.94        )))
    1.95  (fset 'yahtml-intelligent-newline-video 'yahtml-intelligent-newline-audio)
    1.96  
    1.97 +(defun yahtml-intelligent-newline-iframe ()
    1.98 +  (insert "<p>Your browser does not support iframes.</p>"))
    1.99 +
   1.100  ;;; ---------- Marking ----------
   1.101  (defun yahtml-mark-begend ()
   1.102    "Mark current tag"