From: Glenn Morris Date: Sat, 4 Jan 2014 02:31:56 +0000 (-0800) Subject: Yet more Texinfo 5 tweaks for admin.el's make-manuals X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~77 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d16ec91efb551c2a3181d2ae494f8af28d7f254b;p=emacs.git Yet more Texinfo 5 tweaks for admin.el's make-manuals * admin.el (manual-html-fix-node-div): Handle Texinfo 5's movable
. (manual-html-fix-index-2): Tweak Texinfo 5 table format. --- diff --git a/admin/ChangeLog b/admin/ChangeLog index 7695391bada..d43c95d386b 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2014-01-04 Glenn Morris + + * admin.el (manual-html-fix-node-div): Handle Texinfo 5's movable
. + (manual-html-fix-index-2): Tweak Texinfo 5 table format. + 2014-01-03 Glenn Morris * admin.el: More Texinfo 5 updates. diff --git a/admin/admin.el b/admin/admin.el index 119d7202805..bc7e3cbd824 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -372,7 +372,7 @@ the @import directive." ;; Close the div id="content" that fix-index-1 added. (insert "\n\n")) ;; For normal nodes, give the header div a blue bg. - (manual-html-fix-node-div)) + (manual-html-fix-node-div t)) (save-buffer)))))) (defun manual-pdf (texi-file dest) @@ -426,17 +426,38 @@ the @import directive." (search-backward "\\)" nil t) + (setq type (match-string 1)) + ;; NB it is this that makes the bg of non-header cells in the + ;; index tables be blue. Is that intended? + ;; Also, if you don't remove the
, the color of the first + ;; row in the table will be wrong. + ;; This all seems rather odd to me... (replace-match " style=\"background-color:#DDDDFF\">" t t nil 2) (setq opoint (point)) - (re-search-forward "") - (setq div-end (match-beginning 0)) - (goto-char opoint) - (if (search-forward "
" div-end 'move) - (replace-match "" t t))))) + (when (or split (equal type "node")) + ;; In Texinfo 4, the
(and anchor) comes after the
. + (re-search-forward "
") + (setq div-end (if (equal type "node") + (match-beginning 0) + (line-end-position 2))) + (goto-char opoint) + (if (search-forward "
" div-end 'move) + (replace-match "" t t) + (if split (forward-line -1)))) + ;; In Texinfo 5, the
(and anchor) comes before the
(?). + ;; Except in split output, where it comes on the line after + ;; the
. But only sometimes. I have no clue what the + ;; logic of where it goes is. + (when (equal type "header") + (goto-char opoint) + (when (re-search-backward "^
$" (line-beginning-position -3) t) + (replace-match "") + (goto-char opoint)))))) + (defun manual-html-fix-index-1 () "Remove the h1 header, and the short and long contents lists. @@ -453,42 +474,63 @@ Also start a \"content\" div." (insert "
\n\n"))) (defun manual-html-fix-index-2 (&optional table-workaround) - "Replace the index list in the current buffer with a HTML table." + "Replace the index list in the current buffer with a HTML table. +Leave point after the table." (if (re-search-forward "" nil t) - ;; It seems that Texinfo 5 already uses a table. - ;; Tweak it a bit. TODO is this worth it? + ;; Texinfo 5 already uses a table. Tweak it a bit. (let (opoint done) (replace-match " style=\"float:left\" width=\"100%\"" nil t nil 1) - ;; Not all manuals have the detailed menu. - ;; If it is there, split it into a separate table. - (when (re-search-forward ".*The Detailed Node Listing *" nil t) - (setq opoint (match-beginning 0)) - (while (and (looking-at " *—") - (zerop (forward-line 1)))) - (delete-region opoint (point)) - (insert "
\n\n\ -

Detailed Node Listing

\n") - (search-forward "") - (delete-region (match-beginning 0) (match-end 0)) - (forward-line -1) - (or (looking-at "^$") (error "Parse error 1")) - (forward-line -1) - (if (looking-at "^$") (error "Parse error 2")) - (forward-line -1) - (or (looking-at "^$") (error "Parse error 3")) - (forward-line 1) - (insert "\n\ -") - ;; Get rid of ugly
 formatting of chapter headings.
-	  (while (and (not done)
-		      (re-search-forward "\\(
\n\\|\
-\n
\\|\\)\ +:
\\(.*\\)" (line-end-position) t) + (replace-match (format "\\1\n") + (forward-line 1)) + ((looking-at "\n") + (replace-match "") + (replace-match "\n")) + ;; Not all manuals have the detailed menu. + ;; If it is there, split it into a separate table. + ((re-search-forward ".*The Detailed Node Listing *" + (line-end-position) t) + (setq opoint (match-beginning 0)) + (while (and (looking-at " *—") + (zerop (forward-line 1)))) + (delete-region opoint (point)) + (insert "
\n\ -") - (forward-line 1) - (insert "
  
\\2" + (if table-workaround + " bgcolor=\"white\"" ""))) + (search-forward "
") + (search-forward "
\n\n\ +

Detailed Node Listing

\n\n

") + ;; FIXME Fragile! + ;; The Emacs and Elisp manual have some text at the + ;; start of the detailed menu that is not part of the menu. + ;; Other manuals do not. + ;; FIXME Texinfo 4 branch does not handle this correctly. + ;; See eg s/emacs/manual/html_node/eintr/index.html + ;; start of "Detailed Node Listing". + (if (re-search-forward "in one step:" (line-end-position 3) t) + (forward-line 1)) + (insert "

\n") + (search-forward "") + (delete-region (match-beginning 0) (match-end 0)) + (forward-line -1) + (or (looking-at "^$") (error "Parse error 1")) + (forward-line -1) + (if (looking-at "^$") (error "Parse error 2")) + (forward-line -1) + (or (looking-at "^$") (error "Parse error 3")) + (forward-line 1) + (insert "\n\ +") + (forward-line 1)) + ((looking-at ".*" nil t) @@ -512,8 +554,6 @@ Also start a \"content\" div." (insert " \n ") (if table-workaround ;; This works around a Firefox bug in the mono file. - ;; FIXME Is this still needed? - ;; If so, the Texinfo 5 branch needs to add it too. (insert "\n
\n") + (forward-line 1) + (insert "
") (insert "")) (insert tag "" (or desc ""))