Difference between revisions of "Command/selectblocks"

From ConTeXt wiki
m (Text replace - "\[\[cmd:(.*)\|(.*)\]\]" to "{{cmd|$1}}")
 
(4 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
}}
 
}}
  
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>selectblocks</syntax>
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
 
<table cellspacing="4" cellpadding="2" class="cmd">
 
<table cellspacing="4" cellpadding="2" class="cmd">
Line 11: Line 13:
 
   <tr valign="top" class="first">
 
   <tr valign="top" class="first">
 
     <td class="cmd">[...,...,...]</td>
 
     <td class="cmd">[...,...,...]</td>
     <td>name </td>
+
     <td>''block''</td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="second">
 
   <tr valign="top" class="second">
 
     <td class="cmd">[...,...,...]</td>
 
     <td class="cmd">[...,...,...]</td>
     <td>name </td>
+
     <td>''tag''</td>
 
   </tr>
 
   </tr>
 
   <tr valign="top" class="third">
 
   <tr valign="top" class="third">
Line 23: Line 25:
 
</table>
 
</table>
  
 +
== Description ==
 +
Like {{cmd|useblocks}}, prints blocks of type ''block'' tagged with ''tag''; but you can add an argument <code>[criterium=section]</code> to print only blocks defined in the current section. If the tags argument is missing, all blocks of type ''block'' are printed.
 +
 +
 +
== Example ==
 +
<context source=yes text="This gives:">
 +
\defineblock[myblock]
 +
\hideblocks[myblock]
  
== Description ==
+
\starttext
 +
 
 +
\section{A to B}
 +
\beginmyblock
 +
A is for Amy, who fell down the stairs.
 +
\endmyblock
 +
\beginmyblock
 +
B is for Basil, assaulted by bears.
 +
\endmyblock
 +
 
 +
\selectblocks[myblock][criterium=section]
 +
 
 +
 
 +
\section{C to D}
 +
\selectblocks[myblock][criterium=section]
  
 +
\beginmyblock
 +
C is for Claire, who wasted away.
 +
\endmyblock
 +
\beginmyblock
 +
D is for Desmond, thrown out of the sleigh.
 +
\endmyblock
  
 +
\section{All everything}
 +
\selectblocks[myblock]
  
== Example ==
+
\stoptext
<!-- Please fill in an example if you can -->
+
</context>
  
 
== See also ==
 
== See also ==
<!-- something like {{cmd|goto}} -->
+
* {{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 38: Line 79:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Commands|selectblocks]]
+
[[Category:Command/Blocks|selectblocks]]

Latest revision as of 13:24, 13 October 2019

\selectblocks

Syntax (autogenerated)

\selectblocks[...,...][...,...][...=...,...]
[...,...]name
[...,...]name
criteriumtext section


Syntax

\selectblocks[...,...,...][...,...,...][...=...]
[...,...,...] block
[...,...,...] tag
criterium all section

Description

Like \useblocks, prints blocks of type block tagged with tag; but you can add an argument [criterium=section] to print only blocks defined in the current section. If the tags argument is missing, all blocks of type block are printed.


Example

\defineblock[myblock]
\hideblocks[myblock]

\starttext

\section{A to B}
\beginmyblock
A is for Amy, who fell down the stairs.
\endmyblock
\beginmyblock
B is for Basil, assaulted by bears.
\endmyblock

\selectblocks[myblock][criterium=section]


\section{C to D}
\selectblocks[myblock][criterium=section]

\beginmyblock
C is for Claire, who wasted away.
\endmyblock
\beginmyblock
D is for Desmond, thrown out of the sleigh.
\endmyblock

\section{All everything}
\selectblocks[myblock]

\stoptext

This gives:

See also


Help from ConTeXt-Mailinglist/Forum

All issues with: