From: <ha...@us...> - 2010-03-02 00:40:10
|
Revision: 6979 http://octave.svn.sourceforge.net/octave/?rev=6979&view=rev Author: hauberg Date: 2010-03-02 00:39:59 +0000 (Tue, 02 Mar 2010) Log Message: ----------- Deal with keywords in @seealso's Modified Paths: -------------- trunk/octave-forge/extra/generate_html/inst/generate_operators.m trunk/octave-forge/extra/generate_html/inst/html_help_text.m trunk/octave-forge/extra/generate_html/inst/private/octave_forge_seealso.m trunk/octave-forge/extra/generate_html/inst/texi2html.m Modified: trunk/octave-forge/extra/generate_html/inst/generate_operators.m =================================================================== --- trunk/octave-forge/extra/generate_html/inst/generate_operators.m 2010-03-01 15:41:38 UTC (rev 6978) +++ trunk/octave-forge/extra/generate_html/inst/generate_operators.m 2010-03-02 00:39:59 UTC (rev 6979) @@ -51,16 +51,16 @@ fprintf (fid, "%s\n", header); fprintf (fid, "<h2 class=\"tbdesc\">Operators</h2>\n\n"); - write_list (__operators__, fid); + write_list (__operators__, fid, false); fprintf (fid, "<h2 class=\"tbdesc\">Keywords</h2>\n\n"); - write_list (__keywords__, fid); + write_list (__keywords__, fid, true); fprintf (fid, "\n%s\n", footer); fclose (fid); endfunction -function write_list (list, fid) +function write_list (list, fid, write_anchors) for k = 1:length (list) elem = list {k}; [text, format] = get_help_text (elem); @@ -68,8 +68,14 @@ text = strip_defs (text); text = __makeinfo__ (text, "plain text"); endif + if (write_anchors) + fprintf (fid, "<a name=\"%s\">\n", elem); + endif fprintf (fid, "<div class=\"func\"><b>%s</b></div>\n", elem); fprintf (fid, "<div class=\"ftext\">%s</div>\n", text); # XXX: don't use text + if (write_anchors) + fprintf (fid, "</a>\n\n"); + endif endfor endfunction Modified: trunk/octave-forge/extra/generate_html/inst/html_help_text.m =================================================================== --- trunk/octave-forge/extra/generate_html/inst/html_help_text.m 2010-03-01 15:41:38 UTC (rev 6978) +++ trunk/octave-forge/extra/generate_html/inst/html_help_text.m 2010-03-02 00:39:59 UTC (rev 6979) @@ -65,19 +65,10 @@ text = sprintf ("%s\n%s\n%s\n", start, text, stop); ## Handle @seealso - if (isfield (options, "seealso_prefix")) - seealso_prefix = options.seealso_prefix; - if (length (seealso_prefix) > 0 && seealso_prefix (end) != "/") - seealso_prefix (end+1) = "/"; - endif - else - seealso_prefix = ""; - endif - if (isfield (options, "seealso")) - seealso = options.seealso; + seealso = @(args) options.seealso (root, args); else - seealso = @(args) html_see_also_with_prefix (seealso_prefix, args {:}); + seealso = @(args) html_see_also_with_prefix (root, args {:}); endif ## Run makeinfo @@ -174,7 +165,7 @@ endfunction -function expanded = html_see_also_with_prefix (prefix, varargin) +function expanded = html_see_also_with_prefix (prefix, root, varargin) header = "@html\n<div class=\"seealso\">\n<b>See also</b>: "; footer = "\n</div>\n@end html\n"; Modified: trunk/octave-forge/extra/generate_html/inst/private/octave_forge_seealso.m =================================================================== --- trunk/octave-forge/extra/generate_html/inst/private/octave_forge_seealso.m 2010-03-01 15:41:38 UTC (rev 6978) +++ trunk/octave-forge/extra/generate_html/inst/private/octave_forge_seealso.m 2010-03-02 00:39:59 UTC (rev 6979) @@ -14,17 +14,26 @@ ## along with this program; see the file COPYING. If not, see ## <http://www.gnu.org/licenses/>. -function expanded = octave_forge_seealso (arg) +function expanded = octave_forge_seealso (root, arg) header = "@html\n<div class=\"seealso\">\n<b>See also</b>: "; footer = "\n</div>\n@end html\n"; - format = " <a href=\"../../find_function.php?fun=%s\">%s</a> "; + ## XXX: Deal properly with the root directory + format = sprintf (" <a href=\"%sfind_function.php?fun=%%s\">%%s</a> ", root); + kw_format = sprintf (" <a href=\"%soperators.html#%%s\">%%s</a> ", root); - arg2 = cell (1, 2*length (arg)); - arg2 (1:2:end) = arg; - arg2 (2:2:end) = arg; + keywords = __keywords__ (); - list = sprintf (format, arg2 {:}); + help_list = ""; + for k = 1:length (arg) + f = arg {k}; + if (any (strcmp (f, keywords))) + elem = sprintf (kw_format, f, f); + else + elem = sprintf (format, f, f); + endif + help_list = strcat (help_list, elem); + endfor - expanded = strcat (header, list, footer); + expanded = strcat (header, help_list, footer); endfunction Modified: trunk/octave-forge/extra/generate_html/inst/texi2html.m =================================================================== --- trunk/octave-forge/extra/generate_html/inst/texi2html.m 2010-03-01 15:41:38 UTC (rev 6978) +++ trunk/octave-forge/extra/generate_html/inst/texi2html.m 2010-03-02 00:39:59 UTC (rev 6979) @@ -54,19 +54,10 @@ text = sprintf ("%s\n%s\n%s\n", start, text, stop); ## Handle @seealso - if (isfield (options, "seealso_prefix")) - seealso_prefix = options.seealso_prefix; - if (length (seealso_prefix) > 0 && seealso_prefix (end) != "/") - seealso_prefix (end+1) = "/"; - endif - else - seealso_prefix = ""; - endif - if (isfield (options, "seealso")) seealso = options.seealso; else - seealso = @(args) html_see_also_with_prefix (seealso_prefix, args {:}); + seealso = @(args) html_see_also_with_prefix (root, args {:}); endif ## Run makeinfo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |