line breaks in </lineannotation>

View: New views
5 Messages — Rating Filter:   Alert me  

line breaks in </lineannotation>

by Sam Steingold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
if you look at
http://clisp.podval.org/impnotes/mt.html#mt-unsafe
you will see a spurious line break:

(INCF (GETHASH x global-ht 0)) ; see Section 32.5.2.5, “Hash Tables,
Sequences, and other
  mutable objects”

there should not be a line break between "other" and "mutable".

the sources (http://clisp.podval.org/impnotes-src.zip) impext.xml:

-----------------------------------
<section id="mt-mutable"><title>Hash Tables, Sequences, and other
  mutable objects</title>
...
<programlisting language="lisp">
(&incf; (&gethash; x global-ht 0))<lineannotation>see <xref
linkend="mt-mutable"/></lineannotation>
....
-----------------------------------

template:

-----------------------------------
<xsl:template match="programlisting[@language = 'lisp']/lineannotation">
 <strong> ; </strong> <!-- TAB + ; +   -->
 <xsl:apply-imports/>
</xsl:template>
-----------------------------------

my question is: should I use normalize-space myself
(the following is probably wrong, I hope you will correct that for me):

-----------------------------------
<xsl:template match="programlisting[@language = 'lisp']/lineannotation">
 <strong> ; </strong> <!-- TAB + ; +   -->
 <xsl:value-of select="normalize-space(.)"><xsl:apply-imports/></xsl:value-of>
</xsl:template>
-----------------------------------

or is this a bug which could be fixed at the source?

thanks!

--
Sam Steingold <http://sds.podval.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: line breaks in </lineannotation>

by Bob Stayton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sam,
I don't think using normalize-space() would be satisfactory, because that
function returns text only, and would remove the html markup that makes it a
cross reference.   Applying normalize-space to the xref would return
nothing, because an xref element is empty.

You don't want to mess with the markup, only with the text nodes of cross
reference targets that contain carriage returns.  There is no specific mode
for that, but the no.anchor.mode comes close.  It is used when generating
cross references because it prevents nested links (i.e., no link anchors
inside the link text).  Since that is a mode, you can use it to match only
the text nodes in titles as follows to map any line feeds in the title to
spaces:

<xsl:template match="title/text()" mode="no.anchor.mode">
  <xsl:value-of select="translate(., ' ', ' ')"/>
</xsl:template>

This seems to work, and I haven't noticed any side effects, but be sure to
test it.

Bob Stayton
Sagehill Enterprises
bobs@...


----- Original Message -----
From: "Sam Steingold" <sds@...>
To: <docbook-apps@...>
Sent: Friday, June 26, 2009 8:22 AM
Subject: [docbook-apps] line breaks in </lineannotation>


Hi,
if you look at
http://clisp.podval.org/impnotes/mt.html#mt-unsafe
you will see a spurious line break:

(INCF (GETHASH x global-ht 0)) ; see Section 32.5.2.5, “Hash Tables,
Sequences, and other
  mutable objects”

there should not be a line break between "other" and "mutable".

the sources (http://clisp.podval.org/impnotes-src.zip) impext.xml:

-----------------------------------
<section id="mt-mutable"><title>Hash Tables, Sequences, and other
  mutable objects</title>
...
<programlisting language="lisp">
(&incf; (&gethash; x global-ht 0))<lineannotation>see <xref
linkend="mt-mutable"/></lineannotation>
....
-----------------------------------

template:

-----------------------------------
<xsl:template match="programlisting[@language = 'lisp']/lineannotation">
 <strong> ; </strong> <!-- TAB + ; +   -->
 <xsl:apply-imports/>
</xsl:template>
-----------------------------------

my question is: should I use normalize-space myself
(the following is probably wrong, I hope you will correct that for me):

-----------------------------------
<xsl:template match="programlisting[@language = 'lisp']/lineannotation">
 <strong> ; </strong> <!-- TAB + ; +   -->
 <xsl:value-of
select="normalize-space(.)"><xsl:apply-imports/></xsl:value-of>
</xsl:template>
-----------------------------------

or is this a bug which could be fixed at the source?

thanks!

--
Sam Steingold <http://sds.podval.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...




---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: line breaks in </lineannotation>

by Sam Steingold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bob,

On Sun, Jun 28, 2009 at 2:35 PM, Bob Stayton<bobs@...> wrote:
>
> <xsl:template match="title/text()" mode="no.anchor.mode">
>  <xsl:value-of select="translate(., ' ', ' ')"/>
> </xsl:template>

Thanks a lot! Indeed, this is a huge improvement, see:
http://clisp.podval.org/impnotes/mt.html#mt-unsafe
however, programlisting/lineannot is a fixed width environment,
i.e., each extra space is seen on the screen, observe
the spaces between "other" and "mutable" in:
“Hash Tables, Sequences, and other   mutable objects”

Cannot expect perfection :-)

--
Sam Steingold <http://sds.podval.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: line breaks in </lineannotation>

by Bob Stayton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sam,
I noticed the extra space, and it is caused by a trailing space in the
section title text, not the stylesheet.

Bob Stayton
Sagehill Enterprises
bobs@...


----- Original Message -----
From: "Sam Steingold" <sds@...>
To: "Bob Stayton" <bobs@...>
Cc: <docbook-apps@...>
Sent: Tuesday, June 30, 2009 12:14 PM
Subject: Re: [docbook-apps] line breaks in </lineannotation>


Hi Bob,

On Sun, Jun 28, 2009 at 2:35 PM, Bob Stayton<bobs@...> wrote:
>
> <xsl:template match="title/text()" mode="no.anchor.mode">
>  <xsl:value-of select="translate(., ' ', ' ')"/>
> </xsl:template>

Thanks a lot! Indeed, this is a huge improvement, see:
http://clisp.podval.org/impnotes/mt.html#mt-unsafe
however, programlisting/lineannot is a fixed width environment,
i.e., each extra space is seen on the screen, observe
the spaces between "other" and "mutable" in:
“Hash Tables, Sequences, and other   mutable objects”

Cannot expect perfection :-)

--
Sam Steingold <http://sds.podval.org>



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...


Re: line breaks in </lineannotation>

by Sam Steingold :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Bob,

On Tue, Jun 30, 2009 at 4:50 PM, Bob Stayton<bobs@...> wrote:
> I noticed the extra space, and it is caused by a trailing space in the
> section title text, not the stylesheet.

actually, it is caused by the indentation in the original text.
you are right - it does come from the source, not inserted by the stylesheet.
however, I think it would be nice if the stylesheet removed the extra spaces,
like with `sed 's/  */ /g'`

--
Sam Steingold <http://sds.podval.org>

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...