Difference between revisions of "Command/defineblock"
< Command
Jump to navigation
Jump to search
m (Text replace - "\[\[cmd:(.*)\|(.*)\]\]" to "{{cmd|$1}}") |
|||
Line 11: | Line 11: | ||
<tr valign="top" class="first"> | <tr valign="top" class="first"> | ||
<td class="cmd">[...]</td> | <td class="cmd">[...]</td> | ||
− | <td>name </td> | + | <td>''name''</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 17: | Line 17: | ||
== Description == | == Description == | ||
+ | Blocks are reusable pieces of text. Once a block type is defined with <code>\defineblock[''name'']</code>, the blocks can be defined (with or without displaying them) using <code>\begin''name''[''tags'']</code> ... <code>\end''name''</code>. (Yes, that is <code>\begin...</code> and <code>\end...</code>, not <code>\start...</code> and <code>\stop...</code>.) There are a number of commands to display all or some of the blocks defined in the document; see the See Also section for a list with descriptions. | ||
+ | == Example == | ||
+ | <context source=yes text="This gives:> | ||
+ | \defineblock[question] | ||
+ | \hideblocks[question] % We don't want to print blocks where we define them | ||
+ | \beginquestion[first] | ||
+ | To be, or not to be? | ||
+ | \endquestion | ||
− | + | \section{Let's see what blocks we've got.} | |
− | < | + | \useblocks[question] |
+ | |||
+ | \section{We've seen what blocks we've got. Let's take another look at that last question.} | ||
+ | \useblocks[question][first] | ||
+ | |||
+ | \beginquestion[last] | ||
+ | Mais o\`u sont les neiges d'antan? | ||
+ | \endquestion | ||
+ | |||
+ | </context> | ||
== See also == | == See also == | ||
− | + | * {{cmd|defineblock}} to define a new kind of block. | |
+ | * {{cmd|setupblock}} to set up block style. | ||
+ | * {{cmd|keepblocks}} to start displaying blocks where they are defined. | ||
+ | * {{cmd|hideblocks}} to stop displaying blocks where they are defined. | ||
+ | * {{cmd|useblocks}} to display blocks. | ||
+ | * {{cmd|selectblocks}} to display only blocks mentioned in the current section. | ||
+ | * {{cmd|processblocks}} to process blocks without printing them. | ||
+ | * {{cmd|forceblocks}} | ||
+ | * {{cmd|nomoreblocks}} to allow one-pass compilation under certain conditions. | ||
== Help from ConTeXt-Mailinglist/Forum == | == Help from ConTeXt-Mailinglist/Forum == | ||
Line 31: | Line 56: | ||
[[Category:Commands|defineblock]] | [[Category:Commands|defineblock]] | ||
+ | td class="cmd">[...] | ||
+ | span class="first" >[...] |
Revision as of 16:25, 24 April 2012
\defineblock
Syntax
\defineblock[...] | |
[...] | name |
Description
Blocks are reusable pieces of text. Once a block type is defined with \defineblock[name]
, the blocks can be defined (with or without displaying them) using \beginname[tags]
... \endname
. (Yes, that is \begin...
and \end...
, not \start...
and \stop...
.) There are a number of commands to display all or some of the blocks defined in the document; see the See Also section for a list with descriptions.
Example
\defineblock[question] \hideblocks[question] % We don't want to print blocks where we define them \beginquestion[first] To be, or not to be? \endquestion \section{Let's see what blocks we've got.} \useblocks[question] \section{We've seen what blocks we've got. Let's take another look at that last question.} \useblocks[question][first] \beginquestion[last] Mais o\`u sont les neiges d'antan? \endquestion
This gives:
See also
- \defineblock to define a new kind of block.
- \setupblock to set up block style.
- \keepblocks to start displaying blocks where they are defined.
- \hideblocks to stop displaying blocks where they are defined.
- \useblocks to display blocks.
- \selectblocks to display only blocks mentioned in the current section.
- \processblocks to process blocks without printing them.
- \forceblocks
- \nomoreblocks to allow one-pass compilation under certain conditions.
Help from ConTeXt-Mailinglist/Forum
All issues with:
- defineblock on the mailing list (all results)
- defineblock on the mailing list (subject only)
- defineblock on stack exchange
- defineblock in ConTeXt's source
td class="cmd">[...] span class="first" >[...]