Mercurial > hg > octave-nkf
changeset 8630:540165304f00
Allow displaying 'Contents.m' files.
author | Soren Hauberg <hauberg@gmail.com> |
---|---|
date | Sun, 25 Jan 2009 17:25:15 +0100 |
parents | f07730ed5613 |
children | 52956d669506 |
files | scripts/ChangeLog scripts/help/help.m src/ChangeLog src/help.cc |
diffstat | 4 files changed, 42 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -90,6 +90,10 @@ * sparse/svds.m: svds.m: skip tests if ARPACK is missing. +2009-01-25 Søren Hauberg <hauberg@gmail.com> + + * help/help.m: Allow displaying 'Contents.m' files. + 2009-01-23 Søren Hauberg <hauberg@gmail.com> * help/type.m: Make 'type X' work, when X is the name of a variable.
--- a/scripts/help/help.m +++ b/scripts/help/help.m @@ -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 +
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -80,6 +80,12 @@ * DLD-FUNCTIONS/eigs.cc: eigs.cc: skip tests if ARPACK is missing. +2009-01-25 Søren Hauberg <hauberg@gmail.com> + + * 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 <jwe@octave.org> * toplev.cc (octave_call_stack::do_goto_caller_frame):
--- a/src/help.cc +++ b/src/help.cc @@ -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; }