[wwwcvs] Patch to add a WARNTRHREF option to tagdiff

Antoine Jacoutot ajacoutot at bsdfrog.org
Fri Nov 4 16:04:55 CET 2011


On Fri, Nov 04, 2011 at 03:45:43PM +0100, Steffen Daode Nurpmeso wrote:
> Heya,
> 
> sorry that i will need to commit yet a second fixup for my initial
> package.  I finally checked out trtools for real to avoid such
> mess in the future.  And i now even changed href='s to be absolute
> instead of relative etc., to avoid as many warnings as possible.

No problem.

> The problem i had with tagdiff is that it produces so many
> warnings about translated files, since it cannot have a notion of
> "this is outdated" (and the Attic seems not to be an option at
> all, if i understood the mail from yesterday correctly).

True. Although it could be made aware of that since we use the "Originally" keyword that is in the translated file.
This is what I have in my syncer script (to sync steelix to openbsd cvs):

sub getoriginally
{
        my $file = shift;

        my $version = 0;

        return -1 if (!open FILE, "$file");

        while (<FILE>) {
                if (/^Originally \[OpenBSD: .*,v 1\.(.*)\s*]/) {
                        $version = $1;
                }
        }
        close FILE;

        return $version;
}


And then you can use
    getoriginally("$steelix/$off/$file")

> So this diff adds a new option to tagdiff, which can be used
> to toggle only those warnings.  I've taken only a very shallow
> look (grep(1)ed for warning message), but it works for me.
> de will as good as can be with this option set.
> 
> And thanks for your welcome.
> 
> P.S.: i'll hope from not too flat that some sympathetic person
> discovers that de is not yet available on openbsd.org. ;

It is, it's just not linked from the master site.
See http://www.openbsd.org/de/, it's there :)

This is how it works: when a maintainer assures me that the translation is up-to-date enough (that is at least base and faq) then I will link it.

>From what I see right you are making gratuitious changes which are _not_ OK, like:
Releases beziehen (engl.)

You do not want to append '(engl.)' here. When someone clicks on the link, it'll either get the translated version or if the link points to the original one, the English version. That is how it works.
As explained in the FAQ, translation is only about translating, not adding _anything_ else.
Also on the index I can see there are links to 'en cs fr lt nl pt' which is not the list that is on the original page.



That said, I have nothing against your diff as long as it does _not_ change the current default behavior which by reading the code it doesn't.


> --steffen
> 
> diff --git a/tagdiff b/tagdiff
> index c9fa817..c110580 100755
> --- a/tagdiff
> +++ b/tagdiff
> @@ -65,6 +65,7 @@ die "[Config] $configfile doesn't seem to be a valid configuration file.\n",
>      and $confparams{'CHECKQUOTES'}
>      and $confparams{'CHECKCOMMENTS'}
>      and $confparams{'CHECKHEAD'}
> +    and $confparams{'WARNTRHREF'}
>      );
>  
>  # now set some simpler var names for the configuration parameters
> @@ -80,6 +81,7 @@ my $Ncontext = $confparams{'CONTEXTLINES'};
>  my $check_quotes = $confparams{'CHECKQUOTES'} =~ /^yes$/i;
>  my $check_comments = $confparams{'CHECKCOMMENTS'} =~ /^yes$/i;
>  my $check_head = $confparams{'CHECKHEAD'} =~ /^yes$/i;
> +my $warn_tr_href = $confparams{'WARNTRHREF'} =~ /^yes$/i;
>  my @sections = split /\s* \s*/, $confparams{'SECTIONS'};
>  my @languages = split /\s* \s*/, $confparams{'LANGUAGES'};
>  
> @@ -952,7 +954,8 @@ sub href_check
>  				$warning = 'broken link';
>  				return ($checktag, $remarks, $warning, $remove);
>  			}
> -			if ($path !~ m!/?$language/! &&
> +			if ($warn_tr_href &&
> +				$path !~ m!/?$language/! &&
>  				$points_to_section ne 'papers' &&
>  				$points_to_section ne 'other_lang' &&
>  				$points_to_section ne 'cwd') {
> diff --git a/tagdiff.conf b/tagdiff.conf
> index b0ae666..6e6fd54 100644
> --- a/tagdiff.conf
> +++ b/tagdiff.conf
> @@ -63,3 +63,6 @@ CHECKCOMMENTS = No
>  
>  # check things inside <head>
>  CHECKHEAD = No
> +
> +# warn if a translated version exists but is not used as target of link
> +WARNTRHREF = Yes
> _______________________________________________
> wwwcvs mailing list
> wwwcvs at arcane-networks.net
> http://smtp0a.arcane-networks.net/mailman/listinfo.cgi/wwwcvs

-- 
Antoine


More information about the wwwcvs mailing list