changeset 10803:75780a2b0417

__makeinfo__.m: Add support to process @nopsell macro. Fix bug when more than one @seealso block exists.
author Rik <octave@nomad.inbox5.com>
date Mon, 19 Jul 2010 23:33:17 -0700
parents c7475803e0c0
children 3d5c6b84ddaf
files scripts/ChangeLog scripts/help/__makeinfo__.m
diffstat 2 files changed, 36 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Jul 19 22:26:09 2010 -0700
+++ b/scripts/ChangeLog	Mon Jul 19 23:33:17 2010 -0700
@@ -1,6 +1,11 @@
 2010-07-19  Rik <octave@nomad.inbox5.com>
 
-	* general/repmat.m: Add seealso to new repelems function
+	* help/__makeinfo__.m: Add support to process @nopsell macro.
+	Fix bug when more than one @seealso block exists.
+
+2010-07-19  Rik <octave@nomad.inbox5.com>
+
+	* general/repmat.m: Add seealso to new repelems function.
 
 2010-07-19  Jaroslav Hajek  <highegg@gmail.com>
 
--- a/scripts/help/__makeinfo__.m	Mon Jul 19 22:26:09 2010 -0700
+++ b/scripts/help/__makeinfo__.m	Mon Jul 19 23:33:17 2010 -0700
@@ -70,7 +70,7 @@
     error ("__makeinfo__: second input argument must be a string");
   endif
   
-  ## Define the @seealso macro
+  ## Define the function which expands @seealso macro
   if (isempty (see_also))
     if (strcmpi (output_type, "plain text"))
       see_also = @simple_see_also;
@@ -83,14 +83,14 @@
     error ("__makeinfo__: third input argument must be the empty matrix, or a function handle");
   endif
   
-  ## It seems like makeinfo sometimes gets angry if the character on a line is
-  ## a space, so we remove these.
+  ## It seems like makeinfo sometimes gets angry if the first character 
+  ## on a line is a space, so we remove these.
   text = strrep (text, "\n ", "\n");
   
   ## Handle @seealso macro
   SEE_ALSO = "@seealso";
   starts = strfind (text, SEE_ALSO);
-  for start = starts
+  for start = fliplr (starts)
     if (start == 1 || (text (start-1) != "@"))
       bracket_start = find (text (start:end) == "{", 1);
       stop = find (text (start:end) == "}", 1);
@@ -112,7 +112,31 @@
       text = strcat (text (1:start-1), expanded, text (stop+1:end));
     endif
   endfor
-  
+
+  ## Handle @nospell macro
+  NOSPELL = "@nospell";
+  starts = strfind (text, NOSPELL);
+  for start = fliplr (starts)
+    if (start == 1 || (text (start-1) != "@"))
+      bracket_start = find (text (start:end) == "{", 1);
+      stop = find (text (start:end) == "}", 1);
+      if (!isempty (stop) && !isempty (bracket_start))
+        stop += start - 1;
+        bracket_start += start - 1;
+      else
+        bracket_start = start + length (NOSPELL);
+        stop = find (text (start:end) == "\n", 1);
+        if (isempty (stop))
+          stop = length (text);
+        else
+          stop += start - 1;
+        endif
+      endif
+      text(stop) = [];
+      text(start:bracket_start) = [];
+    endif
+  endfor
+
   if (strcmpi (output_type, "texinfo"))
     status = 0;
     retval = text;
@@ -146,7 +170,7 @@
   
     ## Call makeinfo
     [status, retval] = system (cmd);
-   
+
   unwind_protect_cleanup
     if (exist (name, "file"))
       delete (name);