yatex

diff yahtml.el @ 138:b7b54906ac3b

add newpage.rb
author yuuji@gentei.org
date Wed, 07 Jul 2010 22:27:25 +0900
parents 7919fbbb33c0
children efc3819f749b
line diff
     1.1 --- a/yahtml.el	Thu Jun 24 16:01:45 2010 +0900
     1.2 +++ b/yahtml.el	Wed Jul 07 22:27:25 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 Jun 24 16:00:42 2010 on firestorm
     1.7 +;;; Last modified Wed Jul  7 22:12:55 2010 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  (defconst yahtml-revision-number "1.74.2"
    1.11 @@ -880,6 +880,25 @@
    1.12  	"class(or class list delimited by \\[quoted-insert] SPC): "))
    1.13       nil YaTeX-minibuffer-completion-map nil)))
    1.14    
    1.15 +(defvar yahtml-newpage-command "newpage.rb"
    1.16 +  "*Command name to create new HTML file referring to index.html.
    1.17 +This command should create new HTML file named argument 1 and
    1.18 +output string like `<a href=\"newfile.html\">anchor tag</a>'.
    1.19 +This program should take -o option to overwrite existing HTML file.")
    1.20 +(defun yahtml-newpage (file ov)
    1.21 +  "Create newpage via newpage script"
    1.22 +  (interactive
    1.23 +   (list
    1.24 +    (let (insert-default-directory)
    1.25 +      (read-file-name "New webpage file name: " ""))
    1.26 +    current-prefix-arg))
    1.27 +  (if (and (file-exists-p file) (not ov))
    1.28 +      (error "%s already exists.  Call this with universal argument to force overwrite." file))
    1.29 +  (insert (substring
    1.30 +	   (YaTeX-command-to-string
    1.31 +	    (concat yahtml-newpage-command " " (if ov "-o ") file))
    1.32 +	   0 -1)))
    1.33 +
    1.34  ;;; ---------- Add-in ----------
    1.35  (defun yahtml-addin (form)
    1.36    "Check add-in function's existence and call it if exists."
    1.37 @@ -2463,9 +2482,9 @@
    1.38  ;;; ---------- Lint and Browsing ----------
    1.39  ;;; 
    1.40  (defun yahtml-browse-menu ()
    1.41 -  "Browsing menu"
    1.42 +  "Browsing or other external process invokation menu."
    1.43    (interactive)
    1.44 -  (message "J)weblint p)Browse R)eload...")
    1.45 +  (message "J)weblint p)Browse R)eload N)ewpage...")
    1.46    (let ((c (char-to-string (read-char))))
    1.47      (cond
    1.48       ((string-match "j" c)
    1.49 @@ -2473,7 +2492,9 @@
    1.50       ((string-match "[bp]" c)
    1.51        (yahtml-browse-current-file))
    1.52       ((string-match "r" c)
    1.53 -      (yahtml-browse-reload)))))
    1.54 +      (yahtml-browse-reload))
    1.55 +     ((string-match "n" c)
    1.56 +      (call-interactively 'yahtml-newpage)))))
    1.57  
    1.58  (if (fboundp 'wrap-function-to-control-ime)
    1.59      (wrap-function-to-control-ime 'yahtml-browse-menu t nil))