aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-11-26 15:22:27 +0000
committerStefan Monnier2009-11-26 15:22:27 +0000
commit85e0a5363c644d8886b7b14a864491f3776fac03 (patch)
treec257d62a4af839b79564f6c6f06f7beb86423485
parent62ccc42c60626e4816da02f1e1db89fa0fad156d (diff)
downloademacs-85e0a5363c644d8886b7b14a864491f3776fac03.tar.gz
emacs-85e0a5363c644d8886b7b14a864491f3776fac03.zip
Various minor fixes.
* htmlfontify.el (hfy-default-header): Add toggle_invis since Javascript belongs in the header, not the body. (hfy-javascript): Remove. (hfy-fontify-buffer): Don't insert it any more. (hfy-face-at): Handle (face0 face1 face2) style face properties. Fix bug in invis handling when there were no invis props in a chunk.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/htmlfontify.el57
2 files changed, 36 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c437b242389..4e7266feda1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12009-11-26 Vivek Dasmohapatra <vivek@etla.org>
2
3 Various minor fixes.
4 * htmlfontify.el (hfy-default-header): Add toggle_invis since
5 Javascript belongs in the header, not the body.
6 (hfy-javascript): Remove.
7 (hfy-fontify-buffer): Don't insert it any more.
8 (hfy-face-at): Handle (face0 face1 face2) style face properties.
9 Fix bug in invis handling when there were no invis props in a chunk.
10
12009-11-26 Stefan Monnier <monnier@iro.umontreal.ca> 112009-11-26 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * vc-bzr.el (vc-bzr-annotate-command): Make operation asynchronous. 13 * vc-bzr.el (vc-bzr-annotate-command): Make operation asynchronous.
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index f60e7e87d47..a46ad334278 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -693,6 +693,28 @@ STYLE is the inline CSS stylesheet (or tag referring to an external sheet)."
693 } 693 }
694 } 694 }
695 } 695 }
696
697 function toggle_invis( name )
698 {
699 var filter =
700 { acceptNode:
701 function( node )
702 { var classname = node.id;
703 if( classname )
704 { var classbase = classname.substr( 0, name.length );
705 if( classbase == name ) { return NodeFilter.FILTER_ACCEPT; } }
706 return NodeFilter.FILTER_SKIP; } };
707 var walker = document.createTreeWalker( document.body ,
708 NodeFilter.SHOW_ELEMENT ,
709 filter ,
710 false );
711 while( walker.nextNode() )
712 {
713 var e = walker.currentNode;
714 if( e.style.display == \"none\" ) { e.style.display = \"inline\"; }
715 else { e.style.display = \"none\"; }
716 }
717 }
696--> </script> 718--> </script>
697 </head> 719 </head>
698 <body onload=\"stripe('index'); return true;\">\n" 720 <body onload=\"stripe('index'); return true;\">\n"
@@ -1216,7 +1238,8 @@ return a defface style list of face properties instead of a face symbol."
1216 (if (listp f) ;; for things like (variable-pitch (:foreground "red")) 1238 (if (listp f) ;; for things like (variable-pitch (:foreground "red"))
1217 (setq extra-props (cons f extra-props)) 1239 (setq extra-props (cons f extra-props))
1218 (setq extra-props (cons :inherit (cons f extra-props))))) 1240 (setq extra-props (cons :inherit (cons f extra-props)))))
1219 (setq face-name nil)) 1241 (setq base-face (car face-name)
1242 face-name nil))
1220 ;; text-properties-at => (face (:foreground "red" ...)) 1243 ;; text-properties-at => (face (:foreground "red" ...))
1221 ;; or => (face (compilation-info underline)) list of faces 1244 ;; or => (face (compilation-info underline)) list of faces
1222 ;; overlay-properties 1245 ;; overlay-properties
@@ -1230,7 +1253,7 @@ return a defface style list of face properties instead of a face symbol."
1230 (progn 1253 (progn
1231 ;;(message "· %d: %s; %S; %s" 1254 ;;(message "· %d: %s; %S; %s"
1232 ;; p face-name extra-props text-props) 1255 ;; p face-name extra-props text-props)
1233 face-name) ;; no overlays or extra properties 1256 (or face-name base-face)) ;; no overlays or extra properties
1234 ;; collect any face data and any overlay data for processing: 1257 ;; collect any face data and any overlay data for processing:
1235 (when text-props 1258 (when text-props
1236 (setq overlay-data (cons text-props overlay-data))) 1259 (setq overlay-data (cons text-props overlay-data)))
@@ -1243,7 +1266,7 @@ return a defface style list of face properties instead of a face symbol."
1243 (lambda (P) 1266 (lambda (P)
1244 (let ((iprops (cadr (memq 'invisible P)))) 1267 (let ((iprops (cadr (memq 'invisible P))))
1245 ;;(message "(hfy-prop-invisible-p %S)" iprops) 1268 ;;(message "(hfy-prop-invisible-p %S)" iprops)
1246 (when (hfy-prop-invisible-p iprops) 1269 (when (and iprops (hfy-prop-invisible-p iprops))
1247 (setq extra-props 1270 (setq extra-props
1248 (cons :invisible (cons t extra-props))) )) 1271 (cons :invisible (cons t extra-props))) ))
1249 (let ((fprops (cadr (or (memq 'face P) 1272 (let ((fprops (cadr (or (memq 'face P)
@@ -1495,33 +1518,6 @@ Uses `hfy-link-style-fun' to do this."
1495 " --></style>\n")) 1518 " --></style>\n"))
1496 (funcall hfy-page-header file stylesheet))) 1519 (funcall hfy-page-header file stylesheet)))
1497 1520
1498(defconst hfy-javascript "
1499 <script type=\"text/javascript\">
1500 // <![CDATA[
1501function toggle_invis( name )
1502{
1503 var filter =
1504 { acceptNode:
1505 function( node )
1506 { var classname = node.id;
1507 if( classname )
1508 { var classbase = classname.substr( 0, name.length );
1509 if( classbase == name ) { return NodeFilter.FILTER_ACCEPT; } }
1510 return NodeFilter.FILTER_SKIP; } };
1511 var walker = document.createTreeWalker( document.body ,
1512 NodeFilter.SHOW_ELEMENT ,
1513 filter ,
1514 false );
1515 while( walker.nextNode() )
1516 {
1517 var e = walker.currentNode;
1518 if( e.style.display == \"none\" ) { e.style.display = \"inline\"; }
1519 else { e.style.display = \"none\"; }
1520 }
1521}
1522 // ]]>
1523 </script>\n")
1524
1525;; tag all the dangerous characters we want to escape 1521;; tag all the dangerous characters we want to escape
1526;; (ie any "<> chars we _didn't_ put there explicitly for css markup) 1522;; (ie any "<> chars we _didn't_ put there explicitly for css markup)
1527(defun hfy-html-enkludge-buffer () 1523(defun hfy-html-enkludge-buffer ()
@@ -1749,7 +1745,6 @@ FILE, if set, is the file name."
1749 (goto-char (point-min)) 1745 (goto-char (point-min))
1750 ;;(message "inserting stylesheet") 1746 ;;(message "inserting stylesheet")
1751 (insert (hfy-sprintf-stylesheet css-sheet file)) 1747 (insert (hfy-sprintf-stylesheet css-sheet file))
1752 (insert hfy-javascript)
1753 (if (hfy-opt 'div-wrapper) (insert "<div class=\"default\">")) 1748 (if (hfy-opt 'div-wrapper) (insert "<div class=\"default\">"))
1754 (insert "\n<pre>") 1749 (insert "\n<pre>")
1755 (goto-char (point-max)) 1750 (goto-char (point-max))