New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] v5.8.8 pod2html -- incorrect treatment of non-manual page refs like "this(c)" #8816
Comments
From @jaaltoCreated by jaalto@cante.cante.netIn POD, when there is text like: http(s) call The pod2html thinks this is a reference to <code>http(s)</code> call SUGGESTION Please add stricter check how to detect the manual page \S+(\d[A-Za-z]) Which will match ls(3C) PATCH below fixes this: === modified file 'Html.pm' Inline Patch--- Html.pm 2007-03-03 16:52:07 +0000
+++ Html.pm 2007-03-03 16:59:48 +0000
@@ -1433,7 +1433,7 @@
# skip space runs
next if $word =~ /^\s*$/;
# see if we can infer a link
- if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) {
+ if( $notinIS && $word =~ /^(\w+)\((\d[a-zA-Z]])\)$/ ) {
# has parenthesis so should have been a C<> ref
## try for a pagename (perlXXX(1))?
my( $func, $args ) = ( $1, $2 ); Perl Info
|
From @iabynOn Sat, Mar 03, 2007 at 09:05:11AM -0800, Jari Aalto wrote:
Um, I thought it was detecting a function call, not a man page. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @janduboisOn Sat, 03 Mar 2007, Dave Mitchell wrote:
That is correct, and should not be changed. Cheers, |
From @jaaltojand@activestate.com ("Jan Dubois") writes:
It is better to add an option to control this, because this is Jari |
From @jaaltoA slightly corrected patch. The a-z is not required, but it's === modified file 'Html.pm' Inline Patch--- Html.pm 2007-03-05 08:02:39 +0000
+++ Html.pm 2007-03-05 13:39:38 +0000
@@ -1433,7 +1433,7 @@
# skip space runs
next if $word =~ /^\s*$/;
# see if we can infer a link
- if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) {
+ if( $notinIS && $word =~ /^(\w+)\((\d[a-zA-Z]?)\)$/ ) {
# has parenthesis so should have been a C<> ref
## try for a pagename (perlXXX(1))?
my( $func, $args ) = ( $1, $2 ); |
From @jaaltojand@activestate.com ("Jan Dubois") writes:
Another counter argument: The code "tires to guess" a missing C<> call around a point, like in: function(arg) This is very bad behavior. The code should do minimal guessing and do It is a user's mistake to forget to do write request for special C<function(arg)> Jari |
From @jaaltojand@activestate.com ("Jan Dubois") writes:
In closer inpection, it's not trying to detect function call, but a # see if we can infer a link
Jari |
From @AbigailOn Mon, Mar 05, 2007 at 03:38:07PM +0200, Jari Aalto wrote:
No, it's not. Here's the relevant quote from 'perlpod', which has been The Intent The intent is simplicity of use, not power of expression. It's a _feature_, intended from the beginning, that POD does a lot of Abigail |
From @jaaltoabigail@abigail.be (Abigail) writes:
In this case it is not a feature. The pod2html code was trying to find The patch corrects this manual page reference finding "feature". Jari |
From @janduboisOn Mon, 05 Mar 2007, Jari Aalto wrote:
The Pod translators have always been supposed to catch function calls | Finally, as a general note, try not to use an excessive amount of Note the reference to "function names". Cheers, |
From @jaaltojand@activestate.com ("Jan Dubois") writes:
Hm. But is this really the common practise? I mean that the natural You explain soemthign imprtant her. discuss the issues involved Then you kick in a verbatim para to show some real code I would rather leave the automatic guessin for the manual pages only C<call, that, functions> Anyway, the existing pod2html does ot handle the function names at all http(s) And it does not try to deal with substr($string, 1, 2) Can we please drop the issue and accept the patch which does it the Jari
|
From @janduboisOn Mon, 05 Mar 2007, Jari Aalto wrote:
Yes, it is. While perlfunc.pod has a lot of redundant C<> markup, it | binmode() is not only important for readline() and print() operations, All these empty parenthesis make sure that these will be correctly
Note that the auto-markup does *not* apply to verbatim sections, only
I don't understand what you are saying. The code is already disabled in
I agree that this is silly, so please leave things as they are! If you want to change anything, please see if you can auto-detect functions Please don't bother trying to change POD to become just like HTML. Cheers, |
From @jaaltojand@activestate.com ("Jan Dubois") writes:
Touche. Heh.
Argh. You're now requesting a feature and I was trying to fix broken I propose middle ground: - Mark manual pages (as the code was supposed to be doing)
I'm using POD for generating the manual pages *.1 and accompanyong Jari |
From @rgarciaOn 06/03/07, Jari Aalto <jari.aalto@cante.net> wrote:
I would like to markup also automatically function($foo) and the like.
Several O'Reilly books have been written in POD. I've reread some :) |
From @jaaltorgarciasuarez@gmail.com ("Rafael Garcia-Suarez") writes:
Here is reworked patch. - Mark function(), function($foo), function($foo,1,2,3,...) Jari === modified file 'Html.pm' Inline Patch--- Html.pm 2007-03-05 08:02:39 +0000
+++ Html.pm 2007-03-07 08:39:13 +0000
@@ -1432,15 +1432,20 @@
foreach my $word (@words) {
# skip space runs
next if $word =~ /^\s*$/;
- # see if we can infer a link
- if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) {
+
+ # see if we can infer a link or function call "substr($var,1,2)"
+ #
+ # NOTE: BEcause this is word based search, it won't automatically
+ # mark "substr($var, 1, 2)" because the 1st word is "substr($var"
+
+ if( $notinIS && $word =~ /^([a-z]\w+)\((\d[a-z]?|[^)]*)\)[.,;]?$/i ) {
# has parenthesis so should have been a C<> ref
## try for a pagename (perlXXX(1))?
my( $func, $args ) = ( $1, $2 );
if( $args =~ /^\d+$/ ){
my $url = page_sect( $word, '' );
if( defined $url ){
- $word = "<a href=\"$url\">the $word manpage</a>";
+ $word = qq(<a href=\"$url\" class="man">the $word manpage</a>);
next;
}
} |
From @jaalto"Jari Aalto via RT" <perlbug-followup@perl.org> writes:
It mistakenly matched "See http(s)". Here is more readable and tighter regexp. Jari === modified file 'Html.pm' Inline Patch--- Html.pm 2007-03-05 08:02:39 +0000
+++ Html.pm 2007-03-07 09:07:21 +0000
@@ -1432,20 +1432,37 @@
foreach my $word (@words) {
# skip space runs
next if $word =~ /^\s*$/;
- # see if we can infer a link
- if( $notinIS && $word =~ /^(\w+)\((.*)\)$/ ) {
+
+ # see if we can infer a link or function call "substr($var,1,2)"
+ #
+ # NOTE: This is a word based search, it won't automatically
+ # mark "substr($var, 1, 2)" because the 1st word would be "substr($var"
+ # User has to enclose those with proper C<>
+
+ if( $notinIS && $word =~
+ /
+ ^([a-z]\w+) # The function name
+ \(
+ (\d[a-z]? # Manual page(1) or page(1M)
+ |
+ [^)]*[\$\@\%][^)]+) # ($foo), (1, @foo), (%hash)
+ \)
+ ([.,;]?)$ # a possible punctuation follows
+ /xi
+
+ ) {
# has parenthesis so should have been a C<> ref
## try for a pagename (perlXXX(1))?
- my( $func, $args ) = ( $1, $2 );
+ my( $func, $args, $rest ) = ( $1, $2, $3 || '');
if( $args =~ /^\d+$/ ){
my $url = page_sect( $word, '' );
if( defined $url ){
- $word = "<a href=\"$url\">the $word manpage</a>";
+ $word = qq(<a href=\"$url\" class="man">the $word manpage</a>$rest);
next;
}
}
## try function name for a link, append tt'ed argument list
- $word = emit_C( $func, '', "($args)");
+ $word = emit_C( $func, '', "($args)") . $rest;
#### disabled. either all (including $\W, $\w+{.*} etc.) or nothing.
## } elsif( $notinIS && $word =~ /^[\$\@%&*]+\w+$/) { |
@rgs - Status changed from 'open' to 'resolved' |
From @rgarciaOn 07/03/07, Jari Aalto <jari.aalto@cante.net> wrote:
Thanks, I've applied this patch with a few adjustments to the regexp, |
Migrated from rt.perl.org#41683 (status was 'resolved')
Searchable as RT41683$
The text was updated successfully, but these errors were encountered: