Browse Source

ox-texinfo: Ensure detailed menu generation does not exceed maximum
recognized depth

* lisp/ox-texinfo.el (org-texinfo-max-toc-depth): Maximum depth
recognized by texinfo for nodes and sectioning. Left as a constant
to be updated if ever necessary.
(org-texinfo--generate-detailed): Use the smaller between
org-texinfo-max-toc-depth and headline levels (H: )

Jonathan Leech-Pepin 12 years ago
parent
commit
0f6cb7f850
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lisp/ox-texinfo.el

+ 8 - 1
lisp/ox-texinfo.el

@@ -369,6 +369,12 @@ file name, %b by the file base name \(i.e without extension) and
   :type '(repeat :tag "Shell command sequence"
 		 (string :tag "Shell command")))
 
+;;; Constants
+(defconst org-texinfo-max-toc-depth 4
+  "Maximum depth for creation of detailed menu listings.  Beyond
+  this depth texinfo will not recognize the nodes and will cause
+  errors.  Left as a constant in case this value ever changes.")
+
 
 ;;; Internal Functions
 
@@ -501,7 +507,8 @@ MENU is the parse-tree to work with.  LEVEL is the starting level
 for the menu headlines and from which recursion occurs.  INFO is
 a plist containing contextual information."
   (when level
-    (let ((max-depth (plist-get info :headline-levels)))
+    (let ((max-depth (min org-texinfo-max-toc-depth
+		      (plist-get info :headline-levels))))
       (when (> max-depth level)
 	(loop for headline in menu append
 	      (let* ((title (org-texinfo--menu-headlines headline info))