[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Third input argument to __makeinfo__
From: |
c. |
Subject: |
Re: Third input argument to __makeinfo__ |
Date: |
Sun, 11 Sep 2011 11:58:37 +0200 |
Rik,
On 10 Sep 2011, at 18:43, Rik wrote:
> On 09/09/2011 04:10 PM, Carlo de Falco wrote:
>> After a bit more testing, the attached is the best I managed to come up with.
>> I'll wait longer before pushing this time ;)
>> c
> 9/10/11
> <...>
> 3) The for loop over patterns won't work as intended
>
> + args = regexp (text, see_also_pat, 'tokens');
> + for ii = 1:numel (args)
> + if (! isempty (args{ii}))
> + expanded = feval (see_also, strtrim (strsplit (args{ii}{:}, ',',
> true)));
> + text = regexprep (text, see_also_pat, expanded);
> + endif
> + endfor
>
> The first time through the loop, args{1}{:} will be expanded into a
> replacement string. But the regexprep will replace all @seealso references
> with the expanded string from the first instance. The second time through
> the loop the regexprep will match nothing.
oops, you are right!
I used this instead:
see_also_pat = '@seealso *\{([^}]*)\}';
args = regexp (text, see_also_pat, 'tokens');
for ii = 1:numel (args)
expanded = fsee_also (strtrim (strsplit (args{ii}{:}, ',', true)));
text = regexprep (text, see_also_pat, expanded, 'once');
endfor
> On the other hand, it occurred to me that we never have more than 1
> @seealso reference per function. Thus, I took out the for loop and just
> put in a check to make sure that we never exceed 1 @seealso reference per
> function. I think this is a fair tradeoff because this function is not a
> general purpose one and does not need to be written to handle any generic
> input.
from a quick grep it seems this happens in some octave-forge functions
> Feel free to use this patch or merge it with your own. I'm off on vacation
> for a week so go ahead and check in a solution to Mercurial whenever you
> have one. I won't be around for review.
I merged in all your suggestions except removing the handling of multiple
@seealsos
and pushed a changeset.
c.
- Re: Third input argument to __makeinfo__, Rik, 2011/09/09
- Re: Third input argument to __makeinfo__, c., 2011/09/09
- Re: Third input argument to __makeinfo__, Carlo de Falco, 2011/09/09
- Re: Third input argument to __makeinfo__, Carlo de Falco, 2011/09/09
- Re: Third input argument to __makeinfo__, Rik, 2011/09/09
- Re: Third input argument to __makeinfo__, c., 2011/09/09
- Re: Third input argument to __makeinfo__, Carlo de Falco, 2011/09/09
- Re: Third input argument to __makeinfo__, Rik, 2011/09/10
- Re: Third input argument to __makeinfo__,
c. <=
Re: Third input argument to __makeinfo__, Carlo de Falco, 2011/09/09