Fix Box RunIn Head/Para

This commit is contained in:
Carol (Nichols || Goulding) 2022-09-13 11:12:37 -04:00 committed by Carol (Nichols || Goulding)
parent 324d8ba8e2
commit 82c3400344
2 changed files with 49 additions and 32 deletions

View File

@ -130,41 +130,44 @@ reference on how modules, paths, the `use` keyword, and the `pub` keyword work
in the compiler, and how most developers organize their code. Well be going
through examples of each of these rules throughout this chapter, but this is a
great place to refer to as a reminder of how modules work.
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
> * Inline, within curly brackets that replace the semicolon following
`mod garden`
>
> * **Start from the crate root**: When compiling a crate, the compiler first
looks in the crate root file (usually *src/lib.rs* for a library crate or
*src/main.rs* for a binary crate) for code to compile.
> * **Declaring modules**: In the crate root file, you can declare new modules;
say you declare a “garden” module with `mod garden;`. The compiler will look
for the modules code in these places:
>
> * Inline, within curly brackets that replace the semicolon following `mod
garden`
> * In the file *src/garden.rs.*
> * In the file *src/garden/mod.rs*
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
> * Inline, directly following `mod vegetables`, within curly brackets
instead of the semicolon
> * **Declaring submodules**: In any file other than the crate root, you can
declare submodules. For example, you might declare `mod vegetables;` in
*src/garden.rs*. The compiler will look for the submodules code within the
directory named for the parent module in these places:
>
> * Inline, directly following `mod vegetables`, within curly brackets instead
of the semicolon
> * In the file *src/garden/vegetables.rs*
> * In the file *src/garden/vegetables/mod.rs*
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
Unmatched: BoxRunInHead
Unmatched: BoxRunInPara
> Here, we create a binary crate named `backyard` that illustrates these
rules. The crates directory, also named `backyard`, contains these files and
> * **Paths to code in modules**: Once a module is part of your crate, you can
refer to code in that module from anywhere else in that same crate, as long as
the privacy rules allow, using the path to the code. For example, an
`Asparagus` type in the garden vegetables module would be found at
`crate::garden::vegetables::Asparagus`.
> * **Private vs. public**: Code within a module is private from its parent
modules by default. To make a module public, declare it with `pub mod` instead
of `mod`. To make items within a public module public as well, use `pub` before
their declarations.
> * **The use keyword**: Within a scope, the `use` keyword creates shortcuts to
items to reduce repetition of long paths. In any scope that can refer to
`crate::garden::vegetables::Asparagus`, you can create a shortcut with `use
crate::garden::vegetables::Asparagus;` and from then on you only need to write
`Asparagus` to make use of that type in the scope.
>
> Here, we create a binary crate named `backyard` that illustrates these rules.
The crates directory, also named `backyard`, contains these files and
directories:
>
> ```

View File

@ -231,7 +231,7 @@
<xsl:text>> </xsl:text>
<xsl:apply-templates select="*" />
<xsl:choose>
<xsl:when test="following-sibling::w:p[1][w:pPr/w:pStyle/@w:val = 'BlockText' or w:pPr/w:pStyle/@w:val = 'BoxBody' or w:pPr/w:pStyle/@w:val = 'BoxListBullet' or w:pPr/w:pStyle/@w:val = 'BoxCode']">
<xsl:when test="following-sibling::w:p[1][w:pPr/w:pStyle/@w:val = 'BlockText' or w:pPr/w:pStyle/@w:val = 'BoxBody' or w:pPr/w:pStyle/@w:val = 'BoxListBullet' or w:pPr/w:pStyle/@w:val = 'BoxCode' or w:pPr/w:pStyle/@w:val = 'BoxRunInHead']">
<xsl:text>&#10;>&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
@ -261,6 +261,20 @@
</xsl:if>
</xsl:template>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BoxRunInHead']">
<xsl:text>> * **</xsl:text>
<xsl:apply-templates select="*" />
<xsl:text>**: </xsl:text>
</xsl:template>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'BoxRunInPara']">
<xsl:apply-templates select="*" />
<xsl:text>&#10;</xsl:text>
<xsl:if test="following-sibling::w:p[1][w:pPr/w:pStyle/@w:val != 'BoxRunInHead']">
<xsl:text>>&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'CaptionLine']">
<xsl:apply-templates select="*" />
<xsl:text>&#10;&#10;</xsl:text>