# HG changeset patch # User Soren Hauberg # Date 1232900715 -3600 # Node ID 540165304f00d10959e61255f3a2bd25ba86421d # Parent f07730ed561303175fbaa3f6c7f82aa10d09051f Allow displaying 'Contents.m' files. diff -r f07730ed5613 -r 540165304f00 scripts/ChangeLog --- a/scripts/ChangeLog Thu Jan 29 13:29:28 2009 -0500 +++ b/scripts/ChangeLog Sun Jan 25 17:25:15 2009 +0100 @@ -90,6 +90,10 @@ * sparse/svds.m: svds.m: skip tests if ARPACK is missing. +2009-01-25 Søren Hauberg + + * help/help.m: Allow displaying 'Contents.m' files. + 2009-01-23 Søren Hauberg * help/type.m: Make 'type X' work, when X is the name of a variable. diff -r f07730ed5613 -r 540165304f00 scripts/help/help.m --- a/scripts/help/help.m Thu Jan 29 13:29:28 2009 -0500 +++ b/scripts/help/help.m Sun Jan 25 17:25:15 2009 +0100 @@ -61,7 +61,10 @@ case "html" [text, status] = strip_html_tags (text); case "not found" - error ("help: `%s' not found\n", name); + [text, status] = do_contents (name); + if (status != 0) + error ("help: `%s' not found\n", name); + endif otherwise error ("help: internal error: unsupported help text format: '%s'\n", format); endswitch @@ -80,3 +83,31 @@ endif endfunction +function [text, status] = do_contents (name) + text = ""; + status = 1; + + d = find_dir_in_path (name); + if (!isempty (d)) + p = path (); + unwind_protect + ## Only include 'd' in the path, and then get the help text of 'Contents' + path (d); + [text, format] = get_help_text ("Contents"); + + ## Take action depending on help text format + switch (lower (format)) + case "plain text" + status = 0; + case "texinfo" + [text, status] = makeinfo (text, "plain text"); + case "html" + [text, status] = strip_html_tags (text); + endswitch + unwind_protect_cleanup + ## Restore path + path (p); + end_unwind_protect + endif +endfunction + diff -r f07730ed5613 -r 540165304f00 src/ChangeLog --- a/src/ChangeLog Thu Jan 29 13:29:28 2009 -0500 +++ b/src/ChangeLog Sun Jan 25 17:25:15 2009 +0100 @@ -80,6 +80,12 @@ * DLD-FUNCTIONS/eigs.cc: eigs.cc: skip tests if ARPACK is missing. +2009-01-25 Søren Hauberg + + * help.cc (raw_help_from_file): No longer search for files called + 'Contents.m', as this is moved to 'script/help.m'. + + 2009-01-23 John W. Eaton * toplev.cc (octave_call_stack::do_goto_caller_frame): diff -r f07730ed5613 -r 540165304f00 src/help.cc --- a/src/help.cc Thu Jan 29 13:29:28 2009 -0500 +++ b/src/help.cc Sun Jan 25 17:25:15 2009 +0100 @@ -659,18 +659,6 @@ if (h.length () > 0) retval = true; - else if (! symbol_found) - { - file = contents_file_in_path (nm); - - if (! file.empty ()) - { - h = get_help_from_file (file, symbol_found); - - if (h.length () > 0) - retval = true; - } - } return retval; }