mirror of https://github.com/rust-lang/book
Fix italics and whitespace interactions
This commit is contained in:
parent
b2338dbc55
commit
4a96535873
|
@ -191,7 +191,7 @@ is a string type provided by the standard library that is a growable, UTF-8
|
|||
encoded bit of text.
|
||||
|
||||
The `::` syntax in the `::new` line indicates that `new` is an associated
|
||||
function of the `String` type. An *associated function is a function that’s
|
||||
function of the `String` type. An *associated function* is a function that’s
|
||||
implemented on a type, in this case `String`. This `new` function creates a
|
||||
new, empty string. You’ll find a `new` function on many types because it’s a
|
||||
common name for a function that makes a new value of some kind.
|
||||
|
@ -361,7 +361,7 @@ library. However, the Rust team does provide a `rand` crate at
|
|||
### Using a Crate to Get More Functionality
|
||||
|
||||
Remember that a crate is a collection of Rust source code files. The project
|
||||
we’ve been building is a *binary crate , which is an executable. The `rand`
|
||||
we’ve been building is a *binary crate*, which is an executable. The `rand`
|
||||
crate is a *library crate*, which contains code that is intended to be used in
|
||||
other programs and can’t be executed on its own.
|
||||
|
||||
|
|
|
@ -269,17 +269,17 @@ Unmatched: <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
|
|||
|
||||
<xsl:template match="w:r[w:rPr/w:rStyle[@w:val = 'EmphasisItalic' or @w:val = 'EmphasisItalicBox' or @w:val = 'EmphasisNote' or @w:val = 'EmphasisRevCaption' or @w:val = 'EmphasisRevItal' or @w:val = 'Italic' or @w:val = 'LinkURL']]">
|
||||
<xsl:choose>
|
||||
<xsl:when test="normalize-space(w:t) != ''">
|
||||
<xsl:when test="w:t and normalize-space(w:t) != ''">
|
||||
<xsl:if test="starts-with(w:t, ' ')">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(preceding-sibling::*[1][self::w:r]) or preceding-sibling::w:r[1][not(w:rPr/w:rStyle/@w:val = 'EmphasisItalic') and not(w:rPr/w:rStyle/@w:val = 'EmphasisItalicBox') and not(w:rPr/w:rStyle/@w:val = 'EmphasisNote') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevCaption') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevItal') and not(w:rPr/w:rStyle/@w:val = 'Italic') and not(w:rPr/w:rStyle/@w:val = 'LinkURL')]">
|
||||
<xsl:if test="not(preceding-sibling::*[1][self::w:r]) or preceding-sibling::w:r[1][not(w:t) or not(w:rPr/w:rStyle/@w:val = 'EmphasisItalic') and not(w:rPr/w:rStyle/@w:val = 'EmphasisItalicBox') and not(w:rPr/w:rStyle/@w:val = 'EmphasisNote') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevCaption') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevItal') and not(w:rPr/w:rStyle/@w:val = 'Italic') and not(w:rPr/w:rStyle/@w:val = 'LinkURL')]">
|
||||
<xsl:text>*</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:value-of select="normalize-space(w:t)" />
|
||||
|
||||
<xsl:if test="not(following-sibling::*[1][self::w:r]) or following-sibling::w:r[1][not(w:rPr/w:rStyle/@w:val = 'EmphasisItalic') and not(w:rPr/w:rStyle/@w:val = 'EmphasisItalicBox') and not(w:rPr/w:rStyle/@w:val = 'EmphasisNote') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevCaption') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevItal') and not(w:rPr/w:rStyle/@w:val = 'Italic') and not(w:rPr/w:rStyle/@w:val = 'LinkURL')]">
|
||||
<xsl:if test="not(following-sibling::*[1][self::w:r]) or following-sibling::w:r[1][not(w:t) or not(w:rPr/w:rStyle/@w:val = 'EmphasisItalic') and not(w:rPr/w:rStyle/@w:val = 'EmphasisItalicBox') and not(w:rPr/w:rStyle/@w:val = 'EmphasisNote') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevCaption') and not(w:rPr/w:rStyle/@w:val = 'EmphasisRevItal') and not(w:rPr/w:rStyle/@w:val = 'Italic') and not(w:rPr/w:rStyle/@w:val = 'LinkURL')]">
|
||||
<xsl:text>*</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
|
@ -287,9 +287,9 @@ Unmatched: <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
|
|||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:when test="w:t">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue