texi2html
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texi2html] Feature request: use non-breaking hyphens in @w


From: Mark Polesky
Subject: Re: [Texi2html] Feature request: use non-breaking hyphens in @w
Date: Thu, 25 Feb 2010 22:46:45 -0800 (PST)

Mark Polesky wrote:
> Similarly, when @allowcodebreaks is false, blocks of @code
> (and related @-commands) could aquire the same style
> attribute in their associated html tags, eg:
>
> The <command style="white-space:pre">apt-get</command>
> command.

Okay, what I wrote is almost correct, but not quite.  The
Texinfo manual says that setting @allowcodebreaks to false
should prevent line breaks at hyphens and underscores, but
says nothing about preventing line breaks at spaces.  My
proposal above would prevent line breaks at spaces, so it's
not ideal.

To accurately implement the Texinfo specification, texi2html
would have to use an algorithm like this:

* If @allowcodebreaks is currently set to false,
* and we are *not* currently inside a @w{...} block,
* and we come across a @code block (or something related),
* then we need to look inside the @code block for lexical
  tokens that contain one or more hyphens/underscores (and
  no whitespace)
* and mark any matching tokens to be wrapped in:
    <span style="white-space:pre">...</span>

Of course, CSS can streamline things:

<style type="text/css">
.nocodebreak {white-space:pre}
</style>

<span class="nocodebreak">...</span>


So, given the following hypothetical texinfo input...
____________

@allowcodebreaks false

To install the fnurbles manual, run @code{sudo apt-get
install fnurbles_doc} at the command line.
____________


...the tokens to find would be "apt-get" and "fnurbles_doc".
The result would be something like this:

____________

<html>

<head>
<style type="text/css">
.nocodebreak {white-space:pre}
</style>
</head>

<body>
<p>
To install the fnurbles manual, run <code>sudo
<span class="nocodebreak">apt-get</span> install
<span class="nocodebreak">fnurbles_doc</span></code>
at the command line.
</p>
</body>

</html>
____________


Clearly this is a little more work to implement, and using a
regex to find and match strings might add a tiny bit of
overhead.  Furthermore, I don't know any browser that breaks
lines at underscores, but doing it this way should guarantee
that the texi2html behavior follows the texinfo
specification for address@hidden false', which (for my
purposes) would be awesome.

Let me know what you guys think.

Thanks!
- Mark


      




reply via email to

[Prev in Thread] Current Thread [Next in Thread]