Skip to content

Commit

Permalink
changes in related functions to get a method's texinfo from the class…
Browse files Browse the repository at this point in the history
…def file as a workaround of the behavior of 'get_help_text', see bug #65220
  • Loading branch information
pr0m1th3as committed Jan 28, 2024
1 parent 92d9ba3 commit f39cbe9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
14 changes: 12 additions & 2 deletions inst/classdef_texi2html.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ function classdef_texi2html (clsname, pkgfcns, info)
## Add try catch to help identify classdef file that caused an issue
## during batch processing all functions in a package with package_texi2html
try
## Get help text from constructor
[text, format] = get_help_text (MTDS{1});

## Build the HTML code for class constructor
cls_text = __texi2html__ (MTDS{1}, pkgfcns);
cls_text = __texi2html__ (text, MTDS{1}, pkgfcns);

## Find the category the classdef belongs to
fcn_idx = find (strcmp (pkgfcns(:,1), clsname));
Expand All @@ -120,7 +123,14 @@ function classdef_texi2html (clsname, pkgfcns, info)
for m = 2:numel (MTDS)
method_name = [clsname "." MTDS{m}];
try
mtds_text = __texi2html__ (method_name, pkgfcns);
## Use custom get_help_text to get help text from methods contained in
## the classdef file, because core get_help_text returns help text from
## parrent class methods instead of the shadowing methods in the classdef
text = get_methods_texinfo (clsname, MTDS{m});

## Build the HTML code for class method
mtds_text = __texi2html__ (text, method_name, pkgfcns);

## Load methods template
mtds_template = fileread (fullfile ("_layouts", "method_template.html"));
mtds_template = strrep (mtds_template, "{{METHOD_NAME}}", MTDS{m});
Expand Down
9 changes: 6 additions & 3 deletions inst/function_texi2html.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Copyright (C) 2023 Andreas Bertsatos <abertsatos@biol.uoa.gr>
## Copyright (C) 2023-2024 Andreas Bertsatos <abertsatos@biol.uoa.gr>
##
## This file is part of the statistics package for GNU Octave.
##
Expand Down Expand Up @@ -90,8 +90,11 @@ function function_texi2html (fcnname, pkgfcns, info)
## Add try catch to help identify function file that caused an issue
## during batch processing all functions in a package with package_texi2html
try
## Get HTML code from function's texinfo
fcn_text = __texi2html__ (fcnname, pkgfcns);
## Get help text from function
[text, format] = get_help_text (fcnname);

## Build HTML code from function's texinfo
fcn_text = __texi2html__ (text, fcnname, pkgfcns);

## Find the function's category
fcn_idx = find (strcmp (pkgfcns(:,1), fcnname));
Expand Down
7 changes: 2 additions & 5 deletions inst/private/__texi2html__.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {pkg-octave-doc} {@var{html_txt} =} __texi2html__ (@var{fcnname}, @var{pkgfcns})
## @deftypefn {pkg-octave-doc} {@var{html_txt} =} __texi2html__ (@var{text}, @var{fcnname}, @var{pkgfcns})
##
## Private function to generate HTML text from texinfo.
##
## @end deftypefn

function html_txt = __texi2html__ (fcnname, pkgfcns)

## Get help text
[text, format] = get_help_text (fcnname);
function html_txt = __texi2html__ (text, fcnname, pkgfcns)

## Scan text for @tex and @end tex tags and replace their bodies with
## a random string to be replaced later on, since fprintf will not process
Expand Down

2 comments on commit f39cbe9

@noproblemwiththat
Copy link

@noproblemwiththat noproblemwiththat commented on f39cbe9 Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this -- fixes the bad documentation for delete and version in my package, now looking ever-so pretty !

@pr0m1th3as
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your welcome. Glad to see this package being useful to other package maintainers as well.

Please sign in to comment.