changeset 27566:b86adf277734

Display documentation cross-references more clearly in plaintext format (bug #56929). * __makeinfo__.m: Use regexprep to replace @ref, @xref, @pxref macros with link text directly rather than relying on Texinfo for expansion. Add '--plaintext' argument to mkinfo call when output is plaintext.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 26 Oct 2019 05:31:40 -0700
parents 74173f04d2a3
children 51c2e46e9a36
files scripts/help/__makeinfo__.m
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/help/__makeinfo__.m	Sat Oct 26 10:56:13 2019 +0200
+++ b/scripts/help/__makeinfo__.m	Sat Oct 26 05:31:40 2019 -0700
@@ -96,6 +96,13 @@
   text = regexprep (text, '^ +@end tex', '@end tex', 'lineanchors');
   text = regexprep (text, '@seealso', '@xseealso');
 
+  ## We don't want *ref macros to clutter plain text output with "Note ..."
+  if (strcmp (output_type, "plain text"))
+    text  = regexprep (text, '@ref{(?:[^}]*?),?(?:XREF)?([^,}]+)}', '$1');
+    text  = regexprep (text, '@xref{(?:[^}]*?),?(?:XREF)?([^,}]+)}', 'See $1');
+    text  = regexprep (text, '@pxref{(?:[^}]*?),?(?:XREF)?([^,}]+)}', 'see $1');
+  endif
+
   file = texi_macros_file ();
   fid = fopen (file, "r");
   if (fid < 0)
@@ -128,7 +135,7 @@
     ## Take action depending on output type
     switch (lower (output_type))
       case "plain text"
-        cmd = sprintf ('%s --no-headers --no-warn --force --no-validate --output=- "%s"',
+        cmd = sprintf ('%s --no-headers --no-warn --force --no-validate --plaintext --output=- "%s"',
                        makeinfo_program (), name);
       case "html"
         cmd = sprintf ('%s --no-headers --html --no-warn --no-validate --force --output=- "%s"',