discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Undesirable space after parenthesis in HTML output
@ 2018-11-05 20:03 Pali Rohár
  2018-11-22 14:08 ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2018-11-05 20:03 UTC (permalink / raw)
  To: discuss

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hi!

For following sequence in manpage

  Name (\fItest@example.org\fR)

mandoc's HTML output prints following:

  Name ( <i>test@example.org</i>)

It adds additional space after left parenthesis, which looks really
horrible.

In utf8, ps and pdf outputs it is correct without additional space:

  Name (test@example.org)

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Undesirable space after parenthesis in HTML output
  2018-11-05 20:03 Undesirable space after parenthesis in HTML output Pali Rohár
@ 2018-11-22 14:08 ` Ingo Schwarze
  2018-11-22 14:24   ` Pali Rohár
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2018-11-22 14:08 UTC (permalink / raw)
  To: Pali Rohar; +Cc: discuss

Hi Pali,

Pali Rohar wrote on Mon, Nov 05, 2018 at 09:03:00PM +0100:

> For following sequence in manpage
> 
>   Name (\fItest@example.org\fR)
> 
> mandoc's HTML output prints following:
> 
>   Name ( <i>test@example.org</i>)
> 
> It adds additional space after left parenthesis, which looks really
> horrible.

With -current mandoc code, i can't seem to reproduce your issue:

$ echo 'Name (\\fItest@example.org\\fR)' | mandoc -T html | grep Name
<div class="manual-text">Name (<i>test@example.org</i>)</div>

Which version of mandoc are you using?  Please state:
 - operating system name and version
 - whether contained in the base system, installed from a package,
   or compiled from source
 - if from a package, package manager name (e.g. pkgsrc, homebrew, dpkg)
   and package name and version number
 - if from source, tarball name or CVS checkout date and time

> In utf8, ps and pdf outputs it is correct without additional space:
> 
>   Name (test@example.org)

Yes, that is how it is supposed to look like.

Yours,
  Ingo
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Undesirable space after parenthesis in HTML output
  2018-11-22 14:08 ` Ingo Schwarze
@ 2018-11-22 14:24   ` Pali Rohár
  2018-11-23 19:30     ` Ingo Schwarze
  0 siblings, 1 reply; 5+ messages in thread
From: Pali Rohár @ 2018-11-22 14:24 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: discuss

On Thursday 22 November 2018 15:08:07 Ingo Schwarze wrote:
> Hi Pali,
> 
> Pali Rohar wrote on Mon, Nov 05, 2018 at 09:03:00PM +0100:
> 
> > For following sequence in manpage
> > 
> >   Name (\fItest@example.org\fR)
> > 
> > mandoc's HTML output prints following:
> > 
> >   Name ( <i>test@example.org</i>)
> > 
> > It adds additional space after left parenthesis, which looks really
> > horrible.
> 
> With -current mandoc code, i can't seem to reproduce your issue:
> 
> $ echo 'Name (\\fItest@example.org\\fR)' | mandoc -T html | grep Name
> <div class="manual-text">Name (<i>test@example.org</i>)</div>

Hi! Try this:

$ printf "%s\ntest test test test test %s\n" 'Name (\fItest@example.org\fR)' 'Name (\fItest@example.org\fR)' | mandoc -T html

I got following output:

<div class="manual-text">Name (<i>test@example.org</i>) test test test test test
  Name ( <i>test@example.org</i>)</div>
<table class="foot">

First Name is correct, second Name not.

Just for verification:

$ printf "%s\ntest test test test test %s\n" 'Name (\fItest@example.org\fR)' 'Name (\fItest@example.org\fR)'
Name (\fItest@example.org\fR)
test test test test test Name (\fItest@example.org\fR)

> Which version of mandoc are you using?  Please state:
>  - operating system name and version

Debian 9.6

>  - whether contained in the base system, installed from a package,
>    or compiled from source

Tested both which is available in the repository and also compiled from
source which is available from "Newest release tarball" at
https://mandoc.bsd.lv/

>  - if from a package, package manager name (e.g. pkgsrc, homebrew, dpkg)
>    and package name and version number

$ apt install mandoc

current package version is 1.13.3-3+b1

>  - if from source, tarball name or CVS checkout date and time

"Newest release tarball" downloaded 2018-11-22.

> > In utf8, ps and pdf outputs it is correct without additional space:
> > 
> >   Name (test@example.org)
> 
> Yes, that is how it is supposed to look like.
> 
> Yours,
>   Ingo

-- 
Pali Rohár
pali.rohar@gmail.com
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Undesirable space after parenthesis in HTML output
  2018-11-22 14:24   ` Pali Rohár
@ 2018-11-23 19:30     ` Ingo Schwarze
  2018-11-23 20:22       ` Pali Rohár
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Schwarze @ 2018-11-23 19:30 UTC (permalink / raw)
  To: Pali Rohar; +Cc: discuss

Hi Pali,

Pali Rohar wrote on Thu, Nov 22, 2018 at 03:24:28PM +0100:

> $ printf "%s\ntest test test test test %s\n" \
>   'Name (\fItest@example.org\fR)' 'Name (\fItest@example.org\fR)' \
>   | mandoc -T html
> 
> I got following output:
> 
> <div class="manual-text">Name (<i>test@example.org</i>) test test test test test
>   Name ( <i>test@example.org</i>)</div>
> <table class="foot">
> 
> First Name is correct, second Name not.

Ah.  Yes, i can reproduce that on -current.

It wasn't even related to parentheses.  The bug simply caused output
of whitespace in the middle of words when there were font escape
sequences - though not always.  Whether the bug hit depended on the
spacing mode before the word containing the font escape, which made
it a bit elusive.

Fixed in the following commit.

Thanks for reporting the bug,
  Ingo


Log Message:
-----------
When a font escape appears in the middle of a string, 
make sure it doesn't cause output of bogus whitespace.
Fixing a bug reported by Pali dot Rohar at gmail dot com.

Modified Files:
--------------
    mandoc:
        html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -Lhtml.c -Lhtml.c -u -p -r1.242 -r1.243
--- html.c
+++ html.c
@@ -416,8 +416,11 @@ print_encode(struct html *h, const char 
 		case ESCAPE_FONTBI:
 		case ESCAPE_FONTCW:
 		case ESCAPE_FONTROMAN:
-			if (0 == norecurse)
+			if (0 == norecurse) {
+				h->flags |= HTML_NOSPACE;
 				print_metaf(h, esc);
+				h->flags &= ~HTML_NOSPACE;
+			}
 			continue;
 		case ESCAPE_SKIPCHAR:
 			h->flags |= HTML_SKIPCHAR;
--
 To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Undesirable space after parenthesis in HTML output
  2018-11-23 19:30     ` Ingo Schwarze
@ 2018-11-23 20:22       ` Pali Rohár
  0 siblings, 0 replies; 5+ messages in thread
From: Pali Rohár @ 2018-11-23 20:22 UTC (permalink / raw)
  To: Ingo Schwarze; +Cc: discuss

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

On Friday 23 November 2018 20:30:09 Ingo Schwarze wrote:
> Hi Pali,
> 
> Pali Rohar wrote on Thu, Nov 22, 2018 at 03:24:28PM +0100:
> 
> > $ printf "%s\ntest test test test test %s\n" \
> >   'Name (\fItest@example.org\fR)' 'Name (\fItest@example.org\fR)' \
> >   | mandoc -T html
> > 
> > I got following output:
> > 
> > <div class="manual-text">Name (<i>test@example.org</i>) test test test test test
> >   Name ( <i>test@example.org</i>)</div>
> > <table class="foot">
> > 
> > First Name is correct, second Name not.
> 
> Ah.  Yes, i can reproduce that on -current.
> 
> It wasn't even related to parentheses.

I just spotted it on lot of places around email addresses generated by
pod2man, therefore I thought it is related to parentheses around.

> The bug simply caused output
> of whitespace in the middle of words when there were font escape
> sequences - though not always.  Whether the bug hit depended on the
> spacing mode before the word containing the font escape, which made
> it a bit elusive.
> 
> Fixed in the following commit.
> 
> Thanks for reporting the bug,
>   Ingo

Thanks for fix!

> 
> Log Message:
> -----------
> When a font escape appears in the middle of a string, 
> make sure it doesn't cause output of bogus whitespace.
> Fixing a bug reported by Pali dot Rohar at gmail dot com.
> 
> Modified Files:
> --------------
>     mandoc:
>         html.c
> 
> Revision Data
> -------------
> Index: html.c
> ===================================================================
> RCS file: /home/cvs/mandoc/mandoc/html.c,v
> retrieving revision 1.242
> retrieving revision 1.243
> diff -Lhtml.c -Lhtml.c -u -p -r1.242 -r1.243
> --- html.c
> +++ html.c
> @@ -416,8 +416,11 @@ print_encode(struct html *h, const char 
>  		case ESCAPE_FONTBI:
>  		case ESCAPE_FONTCW:
>  		case ESCAPE_FONTROMAN:
> -			if (0 == norecurse)
> +			if (0 == norecurse) {
> +				h->flags |= HTML_NOSPACE;
>  				print_metaf(h, esc);
> +				h->flags &= ~HTML_NOSPACE;
> +			}
>  			continue;
>  		case ESCAPE_SKIPCHAR:
>  			h->flags |= HTML_SKIPCHAR;

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-23 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 20:03 Undesirable space after parenthesis in HTML output Pali Rohár
2018-11-22 14:08 ` Ingo Schwarze
2018-11-22 14:24   ` Pali Rohár
2018-11-23 19:30     ` Ingo Schwarze
2018-11-23 20:22       ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).