contents/glyph/book/macros/macros_block.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
----- title: "Glyph – Block Macros" content-type: page ----- <nav class="navigation"><a href="/glyph/book/macros/macros_core.html">← Core Macros</a> | <a href="/glyph/book/index.html">Contents</a> | <a href="/glyph/book/macros/macros_inline.html">Inline Macros →</a></nav> <section class="section"> <header><h1 id="m_box" class="toc"><code>box</code></h1></header> <p>Creates a titled box (<code><div></code> tag).</p> <section class="section"> <header><h1 id="h_217" class="notoc">Example</h1></header> <div class="CodeRay"> <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>box[Why boxes?| <span class="line-numbers"><a href="#n2" name="n2">2</a></span> Boxes can be used to make a section of text stand out from the rest of the document. <span class="line-numbers"><a href="#n3" name="n3">3</a></span>]</pre></div> </div> </section> <section class="section"> <header><h1 id="h_218" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The box title.</td> </tr> <tr> <td>1</td> <td>The box text.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_codeblock" class="toc"><code>codeblock</code></h1></header> <p>Used to render a block of code within <code><pre></code> and <code><code></code> tags.</p> <section class="section"> <header><h1 id="h_220" class="notoc">Example</h1></header> <div class="CodeRay"> <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>code[ <span class="line-numbers"><a href="#n2" name="n2">2</a></span> def hello <span class="line-numbers"><a href="#n3" name="n3">3</a></span> puts "Hello World" <span class="line-numbers"><a href="#n4" name="n4">4</a></span> end <span class="line-numbers"><a href="#n5" name="n5">5</a></span>]</pre></div> </div> </section> <section class="section"> <header><h1 id="h_221" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The code to be formatted.</td> </tr> </table> </section> <section class="section"> <header><h1 id="h_222" class="notoc">Remarks</h1></header> <p>For code highlighting, see the <a href="/glyph/book/macros/macros_filters.html#m_highlight"><code>highlight</code></a> macro.</p> </section> </section> <section class="section"> <header><h1 id="m_figure" class="toc"><code>figure</code></h1></header> <p>Includes an image in the document, with an optional caption (see <a href="/glyph/book/text_editing/images.html#img_fig">Images and Figures</a>).</p> <section class="section"> <header><h1 id="h_224" class="notoc">Example</h1></header> <div class="CodeRay"> <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>figure[ <span class="line-numbers"><a href="#n2" name="n2">2</a></span> graph.png|Monthly Pageviews <span class="line-numbers"><a href="#n3" name="n3">3</a></span> @width[90%] <span class="line-numbers"><a href="#n4" name="n4">4</a></span>]</pre></div> </div> </section> <section class="section"> <header><h1 id="h_225" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The name of the image file (relative to the <code>images/</code> folder).</td> </tr> <tr> <td>1</td> <td>The image caption <em>(optional)</em>.</td> </tr> </table> </section> <section class="section"> <header><h1 id="h_226" class="notoc">Attributes</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Attribute</th> <th>Description</th> </tr> <tr> <td>*</td> <td>Any attribute supported by the <a href="http://www.w3schools.com/tags/tag_IMG.asp">img tag</a>.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_image" class="toc"><code>image</code></h1></header> <p>Includes an image in the document</p> <section class="section"> <header><h1 id="h_228" class="notoc">Example</h1></header> <div class="CodeRay"> <div class="code"><pre><span class="line-numbers"><a href="#n1" name="n1">1</a></span>img[ <span class="line-numbers"><a href="#n2" name="n2">2</a></span> holidays/landscape.jpg <span class="line-numbers"><a href="#n3" name="n3">3</a></span> @class[photo] <span class="line-numbers"><a href="#n4" name="n4">4</a></span> @style[border: 1px solid black;] <span class="line-numbers"><a href="#n5" name="n5">5</a></span>]</pre></div> </div> </section> <section class="section"> <header><h1 id="h_229" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The name of the image file (relative to the <code>images/</code> folder).</td> </tr> </table> </section> <section class="section"> <header><h1 id="h_230" class="notoc">Attributes</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Attribute</th> <th>Description</th> </tr> <tr> <td>*</td> <td>Any attribute supported by the <a href="http://www.w3schools.com/tags/tag_IMG.asp">img tag</a>.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_navigation" class="toc"><code>navigation</code></h1></header> <p>Displays links to the document’s <span class="caps">TOC</span> and the previous/next topic (used only in <a href="/glyph/book/extending/layouts.html#layouts">layouts</a>).</p> <section class="section"> <header><h1 id="h_232" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The ID of the current topic.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_note" class="toc"><code>note</code></h1></header> <p>Creates a note <code>div</code> containing the value.</p> <strong>Aliases:</strong> <code>important, caution, tip</code> <p><strong>Example:</strong> <code>note[This is a note.]</code></p> <section class="section"> <header><h1 id="h_234" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>The text of the note.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_pubdate" class="toc"><code>pubdate</code></h1></header> <p>Evaluates to a date string (in the format: <em>current_month</em> <em>current_year</em>; i.e. <em>%B</em> <em>%Y</em>), within a <code><div></code> tag. If a parameter is supplied, its value is used instead of the current date.</p> <p><strong>Example:</strong> <code>pubdate[]</code></p> <section class="section"> <header><h1 id="h_236" class="notoc">Parameters</h1></header> <table style="width:100%;"> <tr> <th style="width:30%">Parameter</th> <th>Description</th> </tr> <tr> <td>0</td> <td>An alternative content for the _pubdate_ @div@.</td> </tr> </table> </section> </section> <section class="section"> <header><h1 id="m_revision" class="toc"><code>revision</code></h1></header> <p>Renders the revision of the document (based on the <a href="/glyph/book/config/document.html#s_document_revision"><code>document.revision</code></a> setting) within a <code><div></code> tag.</p> <p><strong>Example:</strong> <code>revision[]</code></p> </section> <section class="section"> <header><h1 id="m_subtitle" class="toc"><code>subtitle</code></h1></header> <p>Renders the subtitle of the document (based on the <a href="/glyph/book/config/document.html#s_document_subtitle"><code>document.subtitle</code></a> setting) within a <code><h2></code> tag.</p> <p><strong>Example:</strong> <code>subtitle[]</code></p> </section> <section class="section"> <header><h1 id="m_title" class="toc"><code>title</code></h1></header> <p>Renders the title of the document (based on the <a href="/glyph/book/config/document.html#s_document_title"><code>document.title</code></a> setting) within a <code><h1></code> tag.</p> <p><strong>Example:</strong> <code>title[]</code></p> </section> <nav class="navigation"><a href="/glyph/book/macros/macros_core.html">← Core Macros</a> | <a href="/glyph/book/index.html">Contents</a> | <a href="/glyph/book/macros/macros_inline.html">Inline Macros →</a></nav> |