# HG changeset patch # User HIROSE Yuuji # Date 1500437870 -32373 # Node ID c7b93cfceb1b6fcb66d675347f6e4cccf4a29949 # Parent e9299b77df1fbbbfb3331f7796dd1d87df51902d Support iframe diff -r e9299b77df1f -r c7b93cfceb1b yahtml.el --- a/yahtml.el Mon Jun 12 08:41:27 2017 +0859 +++ b/yahtml.el Wed Jul 19 13:17:23 2017 +0859 @@ -1,6 +1,6 @@ ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Mon Jun 12 08:40:51 2017 on firestorm +;;; Last modified Wed Jul 19 13:10:28 2017 on firestorm ;;; $Id$ (defconst yahtml-revision-number "1.79.3" @@ -444,7 +444,7 @@ ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del") ("option") ("datalist") ;;HTML5 - ("video") ("audio") ("figure") + ("video") ("audio") ("figure") ("iframe") )) (if yahtml-html4-strict @@ -1002,7 +1002,7 @@ (min (if (fboundp 'field-beginning) (field-beginning) (point-min)))) (setq initial (YaTeX-minibuffer-string)) (cond - ((string-match "^http:" initial) + ((string-match "^htt" initial) (setq cmpl (try-completion initial yahtml-urls) listfunc (list 'lambda nil (list 'all-completions initial 'yahtml-urls)) @@ -1138,26 +1138,30 @@ (set-marker e nil)))) ;; ab%defgls/.| -(defun yahtml:a () - "Add-in function for " +(defun yahtml-read-url (prompt) (let ((href "")) (setq yahtml-completing-buffer (current-buffer) yahtml-urls (append yahtml-urls-private yahtml-urls-local) href (yahtml-escape-chars-string (read-from-minibuffer-with-history - "href: " "" yahtml-url-completion-map))) + prompt "" yahtml-url-completion-map))) (prog1 - (concat (yahtml-make-optional-argument - "href" href) - (yahtml-make-optional-argument - "name" (read-string-with-history "name: "))) - (if (and (string-match "^http://" href) + href + (if (and (string-match "^https?://" href) (null (assoc href yahtml-urls-private)) (null (assoc href yahtml-urls-local))) (YaTeX-update-table (list href) 'yahtml-urls-private 'yahtml-urls-private 'yahtml-urls-local))))) +(defun yahtml:a () + "Add-in function for " + (let ((href (yahtml-read-url "href: "))) + (concat (yahtml-make-optional-argument + "href" href) + (yahtml-make-optional-argument + "name" (read-string-with-history "name: "))))) + (defvar yahtml-parameters-completion-alist '(("align" ("top") ("middle") ("bottom") ("left") ("right") ("center")) ("clear" ("left") ("right") ("center") ("all") ("none")) @@ -1831,6 +1835,15 @@ (defun yahtml:figure () (setq yahtml-last-typeface-cmd "figcaption")) +(defun yahtml:iframe () + (let ((src (yahtml-read-url "src: "))) + (concat + (yahtml-make-optional-argument "src" src) + (yahtml-make-optional-argument + "width" (YaTeX-read-string-or-skip "width: ")) + (yahtml-make-optional-argument + "height" (YaTeX-read-string-or-skip "height: "))))) + ;;; ---------- Jump ---------- (defun yahtml-on-href-p () "Check if point is on href clause." @@ -2838,7 +2851,7 @@ (if (file-directory-p (car (car list))) (progn (setq url (cdr (car list))) - (if (string-match "\\(http://[^/]*\\)/" url) + (if (string-match "\\(https?://[^/]*\\)/" url) (setq docroot (substring url (match-end 1))) (setq docroot url)) (cond @@ -3056,6 +3069,9 @@ ))) (fset 'yahtml-intelligent-newline-video 'yahtml-intelligent-newline-audio) +(defun yahtml-intelligent-newline-iframe () + (insert "

Your browser does not support iframes.

")) + ;;; ---------- Marking ---------- (defun yahtml-mark-begend () "Mark current tag"