## -*- texinfo -*- ## @deftypefn {Function File} @var{retval} = makeinfo (@var{text}, @var{output_type}, ...) ## This help text is broken for testing purposes function [retval, status] = makeinfo (text, output_type, varargin) ## Define the @seealso macro see_also = "@macro seealso {list}\n\ @iftex\n\ @vskip 2pt\n\ @end iftex\n\ @ifnottex\n\ @sp 1\n\ @end ifnottex\n\ @noindent\n\ See also: \\list\\.\n\ @end macro\n"; ## Create the final TeXinfo input string orig_text = text; text = strrep(text, '"', '\"'); text = sprintf ("\\input address@hidden", see_also, text); ## Take action depending on output type switch (lower(output_type)) case "plaintext" cmd = sprintf ("echo \"%s\" | %s --no-headers --no-warn", text, makeinfo_program ()); case "html" cmd = sprintf ("echo \"%s\" | %s --no-headers --html --no-warn", text, makeinfo_program ()); case "custom" cmd = sprintf ("echo \"%s\" | %s %s", text, makeinfo_program (), varargin{1}); otherwise error ("makeinfo: unsupported output type: '%s'", output_type); endswitch ## Call makeinfo [status, retval] = system (cmd); if (status != 0) warning("makeinfo: Texinfo formatting filter exited abnormally"); warning("makeinfo: raw Texinfo source of help text follows...\n"); disp(orig_text); endif endfunction