From 517f20c53356753d00f6df952318ef11d8bf7adc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 2 Jan 2014 19:24:27 -0800 Subject: [PATCH] More Texinfo 5 updates for make-manuals (not yet finished) * admin/admin.el (manual-html-fix-headers): Tweak Texinfo 5 body. (manual-html-fix-node-div): Treat "header" like "node". (manual-html-fix-index-1): Handle Texinfo 5 top heading. (manual-html-fix-index-2): Tweak Texinfo 5 listing tables. --- admin/ChangeLog | 8 ++ admin/admin.el | 195 ++++++++++++++++++++++++++++++------------------ 2 files changed, 131 insertions(+), 72 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 9f160e9604f..7695391bada 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,11 @@ +2014-01-03 Glenn Morris + + * admin.el: More Texinfo 5 updates. + (manual-html-fix-headers): Tweak Texinfo 5 body. + (manual-html-fix-node-div): Treat "header" like "node". + (manual-html-fix-index-1): Handle Texinfo 5 top heading. + (manual-html-fix-index-2): Tweak Texinfo 5 listing tables. + 2014-01-02 Xue Fuqiao * check-doc-strings: Replace `perl -w' with `use warnings;'. diff --git a/admin/admin.el b/admin/admin.el index 58e5b0c830e..119d7202805 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -328,6 +328,7 @@ the @import directive." (manual-html-fix-node-div) (goto-char (point-max)) (re-search-backward "[\n \t]*") + ;; Close the div id="content" that fix-index-1 added. (insert "\n\n") (save-buffer))) @@ -368,6 +369,7 @@ the @import directive." (manual-html-fix-index-2) (if copyright-text (insert copyright-text)) + ;; 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)) @@ -407,22 +409,28 @@ the @import directive." (setq opoint (match-beginning 0)) (unless texi5 (search-forward "")) - ((looking-at "

[- ]*The Detailed Node Listing[- \n]*") - (replace-match " \n + (if (re-search-forward "" nil t) + ;; It seems that Texinfo 5 already uses a table. + ;; Tweak it a bit. TODO is this worth it? + (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
\\|" nil t) + ;; FIXME? The following search seems dangerously lax. + (search-forward "
    ")) + (replace-match "
\n\ +") + (forward-line 1) + (insert "
") + (forward-line 1) + (while (not done) + (cond + ((or (looking-at "
  • \\(\\):[ \t]+\\(.*\\)$") + (looking-at "
  • \\(\\)$")) + (setq tag (match-string 1)) + (setq desc (match-string 2)) + (replace-match "" t t) + (when open-td + (save-excursion + (forward-char -1) + (skip-chars-backward " ") + (delete-region (point) (line-end-position)) + (insert "\n "))) + (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
    ") + (insert "")) + (insert tag "" (or desc "")) + (setq open-td t)) + ((eq (char-after) ?\n) + (delete-char 1) + ;; Negate the following `forward-line'. + (forward-line -1)) + ((looking-at "")) + ((looking-at "

    [- ]*The Detailed Node Listing[- \n]*") + (replace-match "

    \n

    Detailed Node Listing

    \n\n" t t) - (search-forward "

    ") - (search-forward "

    " nil t) - (goto-char (match-beginning 0)) - (skip-chars-backward "\n ") - (setq open-td nil) - (insert "

    \n\n")) - ((looking-at "") - (replace-match "" t t)) - ((looking-at "

    ") - (replace-match "" t t) - (when open-td - (insert " ") - (setq open-td nil)) - (insert "

    + (search-forward "

    ") + (search-forward "

    " nil t) + (goto-char (match-beginning 0)) + (skip-chars-backward "\n ") + (setq open-td nil) + (insert "

    \n\n
    ")) + ((looking-at "") + (replace-match "" t t)) + ((looking-at "

    ") + (replace-match "" t t) + (when open-td + (insert " ") + (setq open-td nil)) + (insert "

    "))) - ((looking-at "[ \t]*[ \t]*$") - (replace-match - (if open-td - " \n
    ") - (if (re-search-forward "

    [ \t\n]*
      " nil t) - (replace-match "
    " - "") t t) - (setq done t)) - (t - (if (eobp) - (error "Parse error in %s" - (file-name-nondirectory buffer-file-name))) - (unless open-td - (setq done t)))) - (forward-line 1)))) + (if (re-search-forward "

    [ \t\n]*
      " nil t) + (replace-match " "))) + ((looking-at "[ \t]*
    [ \t]*$") + (replace-match + (if open-td + " \n" + "") t t) + (setq done t)) + (t + (if (eobp) + (error "Parse error in %s" + (file-name-nondirectory buffer-file-name))) + (unless open-td + (setq done t)))) + (forward-line 1))))) ;; Stuff to check new `defcustom's got :version tags. -- 2.39.2