Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: bgplg: modernize html
To:
Clemens Gößnitzer <clemens@goessnitzer.info>
Cc:
"Anthony J. Bentley" <anthony@anjbe.name>, tech@openbsd.org
Date:
Mon, 5 Feb 2024 10:03:44 +0100

Download raw body.

Thread
On Mon, Feb 05, 2024 at 09:57:26AM +0100, Clemens Gößnitzer wrote:
> On Sun, 2024-02-04 at 15:24 -0700, Anthony J. Bentley wrote:
> > Clemens Gößnitzer writes:
> > > The attached diff modernizes the html output from bgplg(8):
> > > 
> > > * Switch to html 5
> > > * Unify usage of " vs ' in html tags
> > > * Drop trailing / for single tags, type=text/css and <!-- ... -->
> > > for
> > > css - not needed in html 5
> > > * Move style definitions from bgplg.head to bgplg.css
> > 
> > I see no point in unifying " vs ', they are entirely equivalent
> > in this case, and unlike ', " needs escaping in C strings.
> > 
> > > * Make screen scaling more friendly for mobile devices
> > 
> > Can't comment on this one. But I suggest leaving it out for now,
> > as unlike the other changes it makes the page render differently.
> > 
> > Everything else looks good to me.
> 
> Thank you for your feedback.  Attached, you find a diff that just
> converts everything to valid html 5.  I also left out moving the style
> definition from the elements to the css file, since that can be done by
> the admin if he wishes to do so.

I would not include the lang attribute on the html node.
While some text on those pages are indeed in english it is not required
and the output of bgpctl may include non-english text. This is unlike an
article where there is a lot of text.

Apart from that this is OK claudio@

> Index: bgplg.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/bgplg/bgplg.c,v
> retrieving revision 1.19
> diff -u -p -u -r1.19 bgplg.c
> --- bgplg.c	5 Mar 2018 10:53:37 -0000	1.19
> +++ bgplg.c	5 Feb 2024 08:51:46 -0000
> @@ -260,17 +260,15 @@ main(void)
>  
>  	printf("Content-Type: %s\n"
>  	    "Cache-Control: no-cache\n\n"
> -	    "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
> -	    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" "
> -	    "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
> -	    "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
> +	    "<!doctype html>\n"
> +	    "<html lang=\"en\">\n"
>  	    "<head>\n"
>  	    "<title>%s</title>\n",
>  	    CONTENT_TYPE, myname);
>  	if (stat(INC_STYLE, &st) == 0) {
> -		printf("<style type='text/css'><!--\n");
> +		printf("<style>\n");
>  		lg_incl(INC_STYLE);
> -		printf("--></style>\n");
> +		printf("</style>\n");
>  	}
>  	if (stat(INC_HEAD, &st) != 0 || lg_incl(INC_HEAD) != 0) {
>  		printf("</head>\n"
> @@ -308,8 +306,8 @@ main(void)
>  	}
>  
>  	printf("</select>\n"
> -	    "<input type='text' value='%s' name='req'/>\n"
> -	    "<input type='submit' value='submit'/>\n"
> +	    "<input type='text' value='%s' name='req'>\n"
> +	    "<input type='submit' value='submit'>\n"
>  	    "</div>\n"
>  	    "</form>\n"
>  	    "<pre>\n", req ? req : "");
> Index: bgplg.foot
> ===================================================================
> RCS file: /cvs/src/usr.bin/bgplg/bgplg.foot,v
> retrieving revision 1.1
> diff -u -p -u -r1.1 bgplg.foot
> --- bgplg.foot	11 Dec 2006 23:10:10 -0000	1.1
> +++ bgplg.foot	5 Feb 2024 08:51:46 -0000
> @@ -1,2 +1,2 @@
>  </div>
> -<hr/>
> +<hr>
> Index: bgplg.head
> ===================================================================
> RCS file: /cvs/src/usr.bin/bgplg/bgplg.head,v
> retrieving revision 1.3
> diff -u -p -u -r1.3 bgplg.head
> --- bgplg.head	30 Mar 2012 14:31:18 -0000	1.3
> +++ bgplg.head	5 Feb 2024 08:51:46 -0000
> @@ -2,5 +2,5 @@
>  <body style="text-align: center">
>  <div style="margin: 0px auto; text-align: left; width: 800px;">
>  <a href="http://www.openbgp.org/">
> -<img src="/bgplg/openbgpd.gif" alt="OpenBGPD"/>
> +<img src="/bgplg/openbgpd.gif" alt="OpenBGPD">
>  </a>
> 

-- 
:wq Claudio