├── .github └── FUNDING.yml ├── LICENSE ├── README.md ├── Specification.pod6 └── assets ├── LICENSE ├── bigtitle-social-logo.png ├── podlite_logo.pdf ├── podlite_logo.png └── podlite_logo_256x256.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | open_collective: podlite 3 | github: zag 4 | patreon: # Replace with a single Patreon username 5 | 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 | polar: # Replace with a single Polar username 13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 | thanks_dev: # Replace with a single thanks.dev username 15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Artistic License 2.0 2 | 3 | Copyright (c) 2000-2015, The Perl Foundation. 4 | 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | This license establishes the terms under which a given free software 11 | Package may be copied, modified, distributed, and/or redistributed. 12 | The intent is that the Copyright Holder maintains some artistic 13 | control over the development of that Package while still keeping the 14 | Package available as open source and free software. 15 | 16 | You are always permitted to make arrangements wholly outside of this 17 | license directly with the Copyright Holder of a given Package. If the 18 | terms of this license do not permit the full use that you propose to 19 | make of the Package, you should contact the Copyright Holder and seek 20 | a different licensing arrangement. 21 | 22 | Definitions 23 | 24 | "Copyright Holder" means the individual(s) or organization(s) 25 | named in the copyright notice for the entire Package. 26 | 27 | "Contributor" means any party that has contributed code or other 28 | material to the Package, in accordance with the Copyright Holder's 29 | procedures. 30 | 31 | "You" and "your" means any person who would like to copy, 32 | distribute, or modify the Package. 33 | 34 | "Package" means the collection of files distributed by the 35 | Copyright Holder, and derivatives of that collection and/or of 36 | those files. A given Package may consist of either the Standard 37 | Version, or a Modified Version. 38 | 39 | "Distribute" means providing a copy of the Package or making it 40 | accessible to anyone else, or in the case of a company or 41 | organization, to others outside of your company or organization. 42 | 43 | "Distributor Fee" means any fee that you charge for Distributing 44 | this Package or providing support for this Package to another 45 | party. It does not mean licensing fees. 46 | 47 | "Standard Version" refers to the Package if it has not been 48 | modified, or has been modified only in ways explicitly requested 49 | by the Copyright Holder. 50 | 51 | "Modified Version" means the Package, if it has been changed, and 52 | such changes were not explicitly requested by the Copyright 53 | Holder. 54 | 55 | "Original License" means this Artistic License as Distributed with 56 | the Standard Version of the Package, in its current version or as 57 | it may be modified by The Perl Foundation in the future. 58 | 59 | "Source" form means the source code, documentation source, and 60 | configuration files for the Package. 61 | 62 | "Compiled" form means the compiled bytecode, object code, binary, 63 | or any other form resulting from mechanical transformation or 64 | translation of the Source form. 65 | 66 | 67 | Permission for Use and Modification Without Distribution 68 | 69 | (1) You are permitted to use the Standard Version and create and use 70 | Modified Versions for any purpose without restriction, provided that 71 | you do not Distribute the Modified Version. 72 | 73 | 74 | Permissions for Redistribution of the Standard Version 75 | 76 | (2) You may Distribute verbatim copies of the Source form of the 77 | Standard Version of this Package in any medium without restriction, 78 | either gratis or for a Distributor Fee, provided that you duplicate 79 | all of the original copyright notices and associated disclaimers. At 80 | your discretion, such verbatim copies may or may not include a 81 | Compiled form of the Package. 82 | 83 | (3) You may apply any bug fixes, portability changes, and other 84 | modifications made available from the Copyright Holder. The resulting 85 | Package will still be considered the Standard Version, and as such 86 | will be subject to the Original License. 87 | 88 | 89 | Distribution of Modified Versions of the Package as Source 90 | 91 | (4) You may Distribute your Modified Version as Source (either gratis 92 | or for a Distributor Fee, and with or without a Compiled form of the 93 | Modified Version) provided that you clearly document how it differs 94 | from the Standard Version, including, but not limited to, documenting 95 | any non-standard features, executables, or modules, and provided that 96 | you do at least ONE of the following: 97 | 98 | (a) make the Modified Version available to the Copyright Holder 99 | of the Standard Version, under the Original License, so that the 100 | Copyright Holder may include your modifications in the Standard 101 | Version. 102 | 103 | (b) ensure that installation of your Modified Version does not 104 | prevent the user installing or running the Standard Version. In 105 | addition, the Modified Version must bear a name that is different 106 | from the name of the Standard Version. 107 | 108 | (c) allow anyone who receives a copy of the Modified Version to 109 | make the Source form of the Modified Version available to others 110 | under 111 | 112 | (i) the Original License or 113 | 114 | (ii) a license that permits the licensee to freely copy, 115 | modify and redistribute the Modified Version using the same 116 | licensing terms that apply to the copy that the licensee 117 | received, and requires that the Source form of the Modified 118 | Version, and of any works derived from it, be made freely 119 | available in that license fees are prohibited but Distributor 120 | Fees are allowed. 121 | 122 | 123 | Distribution of Compiled Forms of the Standard Version 124 | or Modified Versions without the Source 125 | 126 | (5) You may Distribute Compiled forms of the Standard Version without 127 | the Source, provided that you include complete instructions on how to 128 | get the Source of the Standard Version. Such instructions must be 129 | valid at the time of your distribution. If these instructions, at any 130 | time while you are carrying out such distribution, become invalid, you 131 | must provide new instructions on demand or cease further distribution. 132 | If you provide valid instructions or cease distribution within thirty 133 | days after you become aware that the instructions are invalid, then 134 | you do not forfeit any of your rights under this license. 135 | 136 | (6) You may Distribute a Modified Version in Compiled form without 137 | the Source, provided that you comply with Section 4 with respect to 138 | the Source of the Modified Version. 139 | 140 | 141 | Aggregating or Linking the Package 142 | 143 | (7) You may aggregate the Package (either the Standard Version or 144 | Modified Version) with other packages and Distribute the resulting 145 | aggregation provided that you do not charge a licensing fee for the 146 | Package. Distributor Fees are permitted, and licensing fees for other 147 | components in the aggregation are permitted. The terms of this license 148 | apply to the use and Distribution of the Standard or Modified Versions 149 | as included in the aggregation. 150 | 151 | (8) You are permitted to link Modified and Standard Versions with 152 | other works, to embed the Package in a larger work of your own, or to 153 | build stand-alone binary or bytecode versions of applications that 154 | include the Package, and Distribute the result without restriction, 155 | provided the result does not expose a direct interface to the Package. 156 | 157 | 158 | Items That are Not Considered Part of a Modified Version 159 | 160 | (9) Works (including, but not limited to, modules and scripts) that 161 | merely extend or make use of the Package, do not, by themselves, cause 162 | the Package to be a Modified Version. In addition, such works are not 163 | considered parts of the Package itself, and are not subject to the 164 | terms of this license. 165 | 166 | 167 | General Provisions 168 | 169 | (10) Any use, modification, and distribution of the Standard or 170 | Modified Versions is governed by this Artistic License. By using, 171 | modifying or distributing the Package, you accept this license. Do not 172 | use, modify, or distribute the Package, if you do not accept this 173 | license. 174 | 175 | (11) If your Modified Version has been derived from a Modified 176 | Version made by someone other than you, you are nevertheless required 177 | to ensure that your Modified Version complies with the requirements of 178 | this license. 179 | 180 | (12) This license does not grant you the right to use any trademark, 181 | service mark, tradename, or logo of the Copyright Holder. 182 | 183 | (13) This license includes the non-exclusive, worldwide, 184 | free-of-charge patent license to make, have made, use, offer to sell, 185 | sell, import and otherwise transfer the Package with respect to any 186 | patent claims licensable by the Copyright Holder that are necessarily 187 | infringed by the Package. If you institute patent litigation 188 | (including a cross-claim or counterclaim) against any party alleging 189 | that the Package constitutes direct or contributory patent 190 | infringement, then this Artistic License to you shall terminate on the 191 | date that such litigation is filed. 192 | 193 | (14) Disclaimer of Warranty: 194 | THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS 195 | IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED 196 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR 197 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL 198 | LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL 199 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 200 | DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF 201 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | [![Podlite](https://github.com/zag/specs/raw/podlite-specification/assets/podlite_logo_256x256.png)](https://podlite.org) 5 | 6 |
7 | 8 | **Podlite is a lightweight block-based markup language designed for flexibility and ease of use.** 9 | 10 | Unbound by any specific domain, programming language, or concept, Podlite stands out as a universal markup language. It's versatile enough to be successfully implemented across various development fields, from web development to scientific research. 11 | 12 | Podlite is not limited to any specific application domain, programming language, or concept. 13 | 14 | In addition, the support for Markdown markup as a standard block adds convenience and allows for the use of familiar syntax for text formatting. 15 | 16 | One of the key features of Podlite is its extensibility. This allows for defining unique and domain-specific blocks and expanding the language's functionality according to the requirements of your project. 17 | 18 | Its flexibility makes it an ideal tool for creating documentation, blogs, educational materials, and much more. 19 | 20 | Podlite aims to provide users with a means for creativity and expressing ideas in a structured form, while ensuring ease of use and high flexibility in content creation. 21 | 22 | Supported file extensions: 23 | 24 | | Processor mode | Extensions 25 | | ------------------| ----------- 26 | | `Pod` mode | `.podlite`, `.pod6` (supported through history) 27 | | | `*.*` - processes files under supported MIME types and/or extracts Podlite markup 28 | | `Markdown` mode | `.md`, `.markdown` 29 | 30 | [The specification](https://github.com/podlite/podlite-specs/blob/main/Specification.pod6) for the Podlite markup language is written using Podlite markup itself. 31 | 32 |
33 |
34 | 35 | ##### specification 36 | 37 |
38 | 39 | * [Source](https://github.com/podlite/podlite-specs) 40 | * [in HTML](https://podlite.org/specification) 41 | * [Discussions](https://github.com/podlite/podlite-specs/discussions) 42 | * [Implementation](https://github.com/podlite/podlite) 43 | 44 |
45 | 46 | ##### publishing system 47 | 48 |
49 | 50 | * [Podlite-web](https://github.com/podlite/podlite-web) 51 | * [How-to article](https://zahatski.com/2022/8/23/1/start-you-own-blog-site-with-podlite-for-web) 52 | * [Issues](https://github.com/podlite/podlite-specs/issues) 53 | 54 |
55 | 56 | ##### desktop viewer/editor 57 | 58 |
59 | 60 | * [Podlite-desktop](https://github.com/podlite/podlite-desktop) 61 | * [Releases](https://github.com/podlite/podlite-desktop/releases) 62 | * [Issues](https://github.com/podlite/podlite-desktop/issues) 63 | 64 |
65 | 66 | ##### online resurces 67 | 68 |
69 | 70 | 71 | * [podlite.org](https://podlite.org) 72 | * [pod6.in](https://pod6.in/) 73 | * [github.com/podlite](https://github.com/podlite/) 74 | 75 |
76 |
77 | -------------------------------------------------------------------------------- /Specification.pod6: -------------------------------------------------------------------------------- 1 | =begin pod :puburl('/specification') :pubdate('2023-11-15 18:14:00') 2 | 3 | =comment 4 | This file is deliberately specified in Podlite format 5 | 6 | =TITLE Podlite - a lightweight markup language 7 | 8 | =begin nested :notify :caption('Work on the next release continues!') 9 | 10 | If you have any ideas to make it better, or if you have any questions, 11 | you're welcome to suggest changes or start a conversation on 12 | our L. 13 | 14 | Looking forward to working on the next release with your valuable input. 15 | =end nested 16 | 17 | =toc head1, head2, head3 18 | 19 | =begin AUTHORS 20 | =item Damian Conway |mailto:damian@conway.org>> 21 | =item Aliaksandr Zahatski |mailto:zag@cpan.org>> 22 | =end AUTHORS 23 | 24 | =VERSION 1.0 25 | 26 | =begin CHANGES 27 | =head2 v1.0 28 | =head3 New: 29 | =item Notification blocks, C<:notify> attribute for C<=nested> blocks, 30 | =item C<:folded> attribute, 31 | =item C<:folded-levels> for C<=toc> block, 32 | =item Refactor Named custom blocks and markup custom codes, C>, 33 | =item embedding binary data into documents, C<=data>, C<:filename>, C<:encoding>, 34 | =item C<:mime-type> attribute for C<=include> and C<=data> blocks, 35 | =item introduce C schema for use in C<=picture> and C<=table>, 36 | =item render tables from CSV files, C<=table>, 37 | =item new markdown mode for parser, 38 | =item C> - extends inline markup features, 39 | =item add C<:id>, C<:caption>, C<:lang> attributes, 40 | =item task lists, C<=item> and C<:checked> attribute, 41 | =item intro Selectors, 42 | =item table of contents, C<=toc>, 43 | =item include block, C<=include>, 44 | =item inserting pictures, C<=picture>, C>, 45 | =item mathematical formulas, C<=formula>, C>, 46 | =item Markdown support, C<=markdown>, 47 | =item mistake marking, C>, 48 | =item text positioning, C>, C>, 49 | =item Emoji, C>, 50 | =item contextual backlinks, C>, 51 | =item advanced table format, C<=row>,C<=cell> blocks, 52 | C<:header>, C<:rowspan>, C<:colspan> attributes. 53 | =head3 Deprecated/removed: 54 | =item Contextual aliases, 55 | =item C<=finish>, 56 | =item markers in comments, 57 | =item C<:margin> attribute, 58 | =item C<=encoding> directive, 59 | =item C> due to C<=toc> block, 60 | =item C>, C> due to C<=include> block, 61 | =item C> - placement links, 62 | =item Declarator block, 63 | =item C<:formatted> attribute, 64 | =item C<:like> attribute. 65 | =end CHANGES 66 | 67 | =head1 Podlite 68 | 69 | D is an easy-to-use markup language with a simple, consistent 70 | underlying document object model. Podlite can be used for writing language 71 | documentation, for documenting programs and modules, as well as for 72 | other types of document composition. 73 | 74 | The Podlite is a purely descriptive mark-up notation, with no presentational 75 | components. 76 | 77 | 78 | =head2 General syntactic structure 79 | 80 | Podlite documents are specified using D, which are 81 | used to declare configuration information and to delimit blocks of 82 | textual content. 83 | 84 | Every directive starts either with an equals sign (C<=>) followed 85 | immediately by an identifier. 86 | 87 | An D composed of an alphabetical character followed by 88 | any combination of alphanumeric characters. Alphabetic and numeric 89 | definitions encompass relevant Unicode characters. The underscore 90 | is consistently treated as alphabetic. Additionally, an identifier 91 | can include isolated apostrophes or hyphens, given that the subsequent 92 | character is alphabetic. 93 | 94 | Directives that start with C<=> can be indented like the code they 95 | interleave, but their initial C<=> must still be the first non-whitespace 96 | character on their line. 97 | 98 | An indented Podlite block is considered to have a I, 99 | determined by the indentation of its opening delimiter. 100 | 101 | In other words, if a directive is indented from the left margin, the 102 | column at which the first character of its opening delimiter appears is 103 | thereafter considered the first column of the entire block's contents. 104 | 105 | The virtual margin treats leading tabs as aligning to tabstops spaced 106 | every C<($?TABSTOP // 8)> characters. 107 | 108 | =head2 Podlite blocks 109 | 110 | The content of a document is specified within one or more D. 111 | Every Podlite block may be declared in any of three forms: 112 | I>, I>, or I>. 114 | All of these forms are equivalent. 115 | 116 | Anything in a document that is neither a Podlite directive nor contained 117 | within a Podlite block is treated as "ambient" material. Typically this 118 | would be the source code of the program that the Podlite is documenting. 119 | Podlite parsers still parse this text into the internal representation of the 120 | file, representing it as a "ambient" block. Renderers 121 | will I ignore such blocks. 122 | This is the D of the parser. 123 | 124 | All directives have a defined terminator and the Podlite parser always reverts to 125 | D<"ambient"|Ambient mode; parser modes> at the end of each Podlite directive or 126 | block. 127 | 128 | The C<=pod> block puts the parser in D<"pod" mode|Pod mode; parser modes>, 129 | treating all text between blocks as implicit paragraph Podlite, even if 130 | it's not inside an explicit block. 131 | 132 | To keep the parser in "pod" mode, enclose the desired Podlite region 133 | in a C<=pod> block: 134 | 135 | =begin code :allow 136 | B<=begin pod> 137 | 138 | =head1 A heading 139 | 140 | This is Podlite too. Specifically, this is a simple C block 141 | 142 | $this = pod('also'); # Specifically, a code block 143 | 144 | B<=end pod> 145 | =end code 146 | 147 | The contents of files with the extensions C<.podlite> and C<.pod6> are 148 | implicitly wrapped in a C<=pod> directive. 149 | 150 | For C<.md> and C<.markdown> files, the parser operates in D<"Markdown" 151 | mode|Markdown mode; parser modes> for the entire file, treating all 152 | text as markdown even if it is not inside an C<=markdown> block. 153 | 154 | Any other file extension puts the parser in default mode. The L 155 | block|#Include block > has a mechanism to override this behavior by using 156 | the C<:mime-type> attribute for the included files. 157 | 158 | 159 | =head3 Delimited blocks 160 | 161 | Delimited blocks are bounded by C<=begin> and C<=end> markers, both of 162 | which are followed by a valid Podlite identifier, which is the 163 | D of the block. Typenames that are entirely lowercase (for 164 | example: C<=begin head1>) or entirely uppercase (for example: C<=begin 165 | SYNOPSIS>) are reserved. 166 | 167 | After the typename, the rest of the C<=begin> marker line is treated as 168 | configuration information for the block. This information is used in 169 | different ways by different types of blocks, but is always specified using 170 | any of: 171 | 172 | =for table :nested :caption("Block configuration syntax") :id 173 | Value is... Specify with... Or with... 174 | =============== =================== ============== 175 | Boolean (true) C«:key» C«:key(1)» 176 | Boolean (false) C«:!key» C«:key(0)» 177 | String C«:key» C«:key('str')» 178 | List C«:key<1 2 3>» C«:key[1,2,3]» 179 | Hash C«:key{a=>1, b=>2}» 180 | 181 | All option keys and values must, of course, be constants since Podlite is a 182 | specification language, not a programming language. Specifically, option 183 | values cannot be closures. 184 | 185 | The configuration section may be extended over subsequent lines by 186 | starting those lines with an C<=> in the first (virtual) column followed 187 | by a whitespace character. 188 | 189 | The lines following the opening delimiter and configuration are the 190 | data or contents of the block, which continue until the block's matching 191 | C<=end> marker line. For most block types, these contents may be 192 | indented if you wish, without them being treated as L. Indented text is only treated as code within 194 | C<=pod>, L|#Nesting blocks>, L|#Lists>, C<=code>, 195 | and L blocks. 196 | 197 | The general syntax is: 198 | 199 | =begin code :allow< R > 200 | =begin R R 201 | = R 202 | R 203 | =end R 204 | =end code 205 | 206 | For example: 207 | 208 | =begin code 209 | =begin table :caption 210 | Constants 1 211 | 212 | Variables 10 213 | 214 | Subroutines 33 215 | 216 | Everything else 57 217 | =end table 218 | 219 | =begin Name :required 220 | = :width(50) 221 | The applicant's full name 222 | =end Name 223 | 224 | =begin Contact :optional 225 | The applicant's contact details 226 | =end Contact 227 | =end code 228 | 229 | Note that no blank lines are required around the directives; blank 230 | lines within the contents are always treated as part of the contents. 231 | This is a universal feature of Podlite. 232 | 233 | Note also that in the following specifications, a "blank line" is a line 234 | that is either empty or that contains only whitespace characters. That 235 | is, a blank line matches the following pattern: C. Podlite uses 236 | blank lines as delimiters, rather than empty lines, to minimize unpleasant 237 | surprises when stray spaces or tabs mysteriously turn up in hitherto 238 | empty lines. 239 | 240 | 241 | =head3 Paragraph blocks 242 | 243 | Paragraph blocks are introduced by a C<=for> marker and terminated by 244 | the next Podlite directive or the first blank line (which is I 245 | considered to be part of the block's contents). The C<=for> marker is 246 | followed by the name of the block and optional configuration 247 | information. The general syntax is: 248 | 249 | =begin code :allow< R > 250 | =for R R 251 | = R 252 | R 253 | =end code 254 | 255 | For example: 256 | 257 | =begin code 258 | =for table :caption
259 | Constants 1 260 | Variables 10 261 | Subroutines 33 262 | Everything else 57 263 | 264 | =for Name :required 265 | = :width(50) 266 | The applicant's full name 267 | 268 | =for Contact :optional 269 | The applicant's contact details 270 | 271 | =end code 272 | 273 | 274 | =head3 Abbreviated blocks 275 | 276 | Abbreviated blocks are introduced by an C<'='> sign in the 277 | first column, which is followed immediately by the typename of the 278 | block. The rest of the line is treated as block data, rather than as 279 | configuration. The content terminates at the next Podlite directive or the 280 | first blank line (which is not part of the block data). The general 281 | syntax is: 282 | 283 | =begin code :allow< R > 284 | =R R 285 | R 286 | 287 | =end code 288 | 289 | For example: 290 | 291 | =begin code 292 | =table 293 | Constants 1 294 | Variables 10 295 | Subroutines 33 296 | Everything else 57 297 | 298 | =Name The applicant's full name 299 | =Contact The applicant's contact details 300 | 301 | =end code 302 | 303 | Note that abbreviated blocks cannot specify configuration information. If 304 | configuration is required, use a C<=for> or C<=begin>/C<=end> instead. 305 | 306 | 307 | =head3 Block equivalence 308 | 309 | The underlying documentation model treats all block 310 | specifications (delimited, paragraph, and abbreviated) the same way. 311 | It is possible to choose the form is most convenient for a particular 312 | documentation task. In the descriptions that follow, the abbreviated 313 | form will generally be used, but should be read as standing for all 314 | three forms equally. 315 | 316 | For example, although L<#Headings> shows only: 317 | 318 | =begin code 319 | =head1 Top Level Heading 320 | =end code 321 | 322 | this automatically implies that you could also write that block as: 323 | 324 | =begin code 325 | =for head1 326 | Top Level Heading 327 | =end code 328 | 329 | or: 330 | 331 | =begin code 332 | =begin head1 333 | Top Level Heading 334 | =end head1 335 | =end code 336 | 337 | 338 | =head3 Standard configuration options 339 | 340 | Podlite predefines a small number of standard configuration options that can be 341 | applied uniformly to any built-in block type. These include: 342 | 343 | =begin defn 344 | C<:caption> 345 | 346 | This option assigns a title to the given block, which is typically used to create 347 | a L
. 348 | 349 | =end defn 350 | 351 | =begin defn 352 | C<:id> 353 | 354 | This option enables the explicit definition of identifiers for blocks and use those 355 | IDs for linking purposes (see L<#Links>). 356 | 357 | =end defn 358 | 359 | =begin defn 360 | C<:nested> 361 | 362 | This option specifies that the block is to be nested within its current 363 | context. For example, nesting might be applied to block quotes, to textual 364 | examples, or to commentaries. In addition the L|#Code blocks>, 365 | L|#Lists>, L|#I/O blocks>, and L|#I/O blocks> 366 | blocks all have implicit nesting. 367 | 368 | Nesting of blocks is usually rendered by adding extra indentation to the 369 | block contents, but may also be indicated in other ways: 370 | by boxing the contents, by changing the font or size of the nested text, 371 | or even by folding the text (so long as a visible placeholder is provided). 372 | 373 | Occasionally it is desirable to nest content by more than one level: 374 | 375 | =begin code 376 | =begin para :nested 377 | =begin para :nested 378 | =begin para :nested 379 | "We're going deep, deep, deep undercover!" 380 | =end para 381 | =end para 382 | =end para 383 | =end code 384 | 385 | This can be simplified by giving the C<:nested> option a positive integer 386 | value: 387 | 388 | =begin code :allow 389 | =begin para B<:nested(3)> 390 | "We're going deep, deep, deep undercover!" 391 | =end para 392 | =end code 393 | 394 | You can also give the option a value of zero, to defeat any implicit 395 | nesting that might normally be applied to a paragraph. For example, to 396 | specify a block of code that should appear I its usual 397 | nesting: 398 | 399 | =begin code :allow 400 | =comment Don't nest this code block in the usual way... 401 | B<=begin code :nested(0)> 402 | 403 | 1 2 3 4 5 6 404 | 123456789012345678901234567890123456789012345678901234567890 405 | |------|-----------------------|---------------------------| 406 | line instruction comments 407 | number code 408 | 409 | V<=end code> 410 | =end code 411 | 412 | Note that C<:!nested> could also be used for this purpose: 413 | 414 | =begin code 415 | =Z<>begin code :!nested 416 | =end code 417 | 418 | =end defn 419 | 420 | =begin defn 421 | C<:numbered> 422 | 423 | This option specifies that the block is to be numbered. The most common 424 | use of this option is to create L and 425 | L, but it can be applied to any block. 426 | 427 | The numbering conventions for headings and lists are specified in those 428 | sections, but it is up to individual renderers to decide how to display 429 | any numbering associated with other types of blocks. 430 | 431 | Note that numbering is never explicit; it is always implied by context. 432 | 433 | =end defn 434 | 435 | =begin defn 436 | C<:checked> 437 | 438 | This attribute indicates that a checkbox should be added to that block. 439 | It is possible to apply a C<:checked> attributes to any block. 440 | The most common use of this option is to create L. 441 | 442 | For an unchecked checkbox the C<:!checked> is used. 443 | 444 | The task list item marker (checkbox) is added to the output. 445 | In HTML output, this would be represented as an 446 | C<> element. 447 | 448 | The specification does not define how these checkboxes are interacted with. 449 | Implementors are free to choose whether they render them as disabled, 450 | unchangeable elements, or handle dynamic interactions like checking and unchecking 451 | in the final rendered document. 452 | 453 | =end defn 454 | 455 | =begin defn 456 | C<:folded> 457 | 458 | This option specifies whether the block is foldable and, if specified, 459 | whether it should be collapsed or expanded by default. This feature is 460 | useful in managing the length of documents and focusing the reader's 461 | attention on certain sections as needed. 462 | 463 | A C<:!folded> or C<:folded(0)> expands the callout by default, and a 464 | C<:folded> or C<:folded(1)> collapses it instead. 465 | 466 | =begin code :allow 467 | =for table B<:folded> :caption('Culinary Techniques for Sustainability') 468 | Sous-vide Low energy consumption 469 | ---------- ------------------------- 470 | Steaming Preserves nutrients 471 | Baking Efficient for batch cooking 472 | =end code 473 | 474 | When applied to a block element, such as a heading, the attribute typically 475 | affects all headings with lower-level content, creating a hierarchical 476 | folding effect. 477 | 478 | For example: 479 | 480 | =begin code :allow 481 | =for B 482 | Green Energy Overview 483 | =end code 484 | 485 | =begin comment 486 | TODO: my be it may sense to add a C<:folded-caption> attribute to 487 | define a custom title for the collapsed block. 488 | 489 | The C<:folded-caption> attribute enables the definition of a custom title 490 | for the collapsed block. If no caption is provided, rendering systems 491 | may automatically use the C<:caption> attribute. In the absence of 492 | the C<:caption> attribute, the first line or paragraph of the block 493 | serves as the default title. For semantic blocks, the name of the block 494 | may be used as the default title. 495 | 496 | 497 | =begin code 498 | =picture :folded(1) :folded-caption("Wind Turbine Fields") 499 | Images/wind_turbines.jpg 500 | Wind turbines stand tall against the sky, harnessing 501 | the power of the wind to generate energy 502 | =end code 503 | =end comment 504 | =end defn 505 | 506 | =begin defn 507 | C<:lang> 508 | 509 | This option is used to L about the programming language used in a specific code block. 511 | This helps ensure that the code is displayed and interpreted correctly 512 | by rendering engines or syntax highlighters. 513 | 514 | Here's a table that lists a few programming languages along with their possible 515 | values for the C<:lang> attribute: 516 | 517 | =begin table :caption("Matching languages and lang attribute values") 518 | 519 | Programming language Possible C<:lang> values 520 | -------------------- ------------------------- 521 | C++ cpp 522 | CSS css 523 | HTML html 524 | Java java 525 | JavaScript javascript 526 | Python python 527 | Raku raku 528 | 529 | =end table 530 | 531 | If the language is not specified, the default language is used based 532 | on the file extension or mime type of the current document. 533 | 534 | =end defn 535 | 536 | =begin defn 537 | C<:allow> 538 | 539 | This option expects a list of markup codes that are to be recognized 540 | within any C> codes that appear in (or are implicitly applied to) 541 | the current block. The option is most often used on C<=code> blocks to 542 | allow mark-up within those otherwise verbatim blocks, though it can be 543 | used in I block that contains verbatim text. See L<#Formatting 544 | within code blocks>. 545 | 546 | =end defn 547 | 548 | =head2 Selectors 549 | 550 | Selectors consist of patterns that help identify and filter specific blocks 551 | within documents. Each pattern contains optional source of blocks and block names. 552 | 553 | The general syntax is: 554 | 555 | =begin code :allow< R > 556 | R 557 | or 558 | [ R | ] R 559 | =end code 560 | 561 | ...where 562 | 563 | =item EXTERNAL_SOURCE - optional source of blocks for filtering, default current document, 564 | =item BLOCK_SELECTOR - list of block names, filter for 565 | 566 | For example: 567 | 568 | =begin table :nested 569 | 570 | Selector Description 571 | _______________________________________ ___________________________________________________ 572 | head1, head2, item1 all head1, head2 and item1 blocks from document 573 | 574 | file:article.pod6 | head1, head2 all head1 and head2 blocks from article.pod6 file 575 | 576 | file:./includes/*.pod6 | head1, head2 all head1 and head2 blocks from pod6 files placed 577 | in includes directory 578 | 579 | doc:Data::Dumper | code all code blocks from a module documentation 580 | 581 | file:/docs/**/*.md | head1 search headers with first level for all ".md" files 582 | within the "docs" directory and its subdirectories. 583 | 584 | =end table 585 | 586 | Please note that while the Selector blocks provide a way to query and filter specific elements 587 | within Markdown files, Markdown itself doesn't have formal named blocks like the Podlite syntax. 588 | Instead, Markdown uses a lightweight markup to structure content. The above table provides a mapping 589 | between Podlite block names and their corresponding Markdown elements. 590 | 591 | =begin table :nested :caption("A table of correspondences for some Podlite blocks and markdown blocks") 592 | 593 | Podlite Markdown Describtion 594 | _______________________________________ ______________ _____________________________________ 595 | C<=head1>, C<=head2>, ... #, ##, ... Heading level 1,2... 596 | 597 | C<=nested> ">" blockquote 598 | 599 | C<=para> block of text paragraph 600 | 601 | C> [^1]: footnote. footnote 602 | 603 | C<=Html> text HTML block 604 | 605 | C> ~~text~~ Strikethrough, "O for Overstrike" 606 | 607 | C> ^text^ Superscript, "H for High text" 608 | 609 | C> ~text~ Subscript, "J for Junior text" 610 | 611 | C>, C<=formula> $,$$, ```math Mathematical formulas 612 | 613 | =end table 614 | 615 | The most common use of Selectors is to create L
and 616 | in L. 617 | 618 | =head2 Block types 619 | 620 | Podlite offers notations for specifying a wide range of standard block types... 621 | 622 | 623 | =head3 Headings 624 | 625 | Podlite provides an unlimited number of levels of heading, specified by the 626 | C<=head>R block marker. For example: 627 | 628 | =begin code 629 | =head1 A Top Level Heading 630 | 631 | =head2 A Second Level Heading 632 | 633 | =head3 A third level heading 634 | 635 | =head86 A "Missed it by I much!" heading 636 | =end code 637 | 638 | While Podlite parsers are required to recognize and distinguish all levels 639 | of heading, Podlite renderers are only required to provide distinct 640 | I of the first four levels of heading (though they may, of 641 | course, provide more than that). Headings at levels without distinct 642 | renderings would typically be rendered like the lowest distinctly 643 | rendered level. 644 | 645 | 646 | =head4 Numbered headings 647 | 648 | You can specify that a heading is numbered using the C<:numbered> option. For 649 | example: 650 | 651 | =begin code 652 | =for head1 :numbered 653 | The Problem 654 | 655 | =for head1 :numbered 656 | The Solution 657 | 658 | =for head2 :numbered 659 | Analysis 660 | 661 | =for head3 662 | Overview 663 | 664 | =for head3 665 | Details 666 | 667 | =for head2 :numbered 668 | Design 669 | 670 | =for head1 :numbered 671 | The Implementation 672 | =end code 673 | 674 | which would produce: 675 | 676 | =begin nested 677 | 1. The Problem 678 | 679 | 2. The Solution 680 | 681 | =begin nested 682 | 2.1. Analysis 683 | 684 | =begin nested 685 | Overview 686 | 687 | Details 688 | =end nested 689 | 690 | 2.2: Design 691 | =end nested 692 | 693 | 3. The Implementation 694 | =end nested 695 | 696 | It is usually better to preset a numbering scheme for each heading 697 | level, in a series of L: 698 | 699 | =begin code :allow 700 | B<=config head1 :numbered 701 | Z<>=config head2 :numbered 702 | Z<>=config head3 :!numbered> 703 | 704 | =head1 The Problem 705 | =head1 The Solution 706 | =head2 Analysis 707 | =head3 Overview 708 | =head3 Details 709 | =head2 Design 710 | =head1 The Implementation 711 | =end code 712 | 713 | Alternatively, as a short-hand, if the first whitespace-delimited word 714 | in a heading consists of a single literal C<#> character, the C<#> is 715 | removed and the heading is treated as if it had a C<:numbered> option: 716 | 717 | =begin code 718 | =head1 # The Problem 719 | =head1 # The Solution 720 | =head2 # Analysis 721 | =head3 Overview 722 | =head3 Details 723 | =head2 # Design 724 | =head1 # The Implementation 725 | =end code 726 | 727 | Note that, even though renderers are not required to distinctly render 728 | more than the first four levels of heading, they I required to 729 | correctly honour arbitrarily nested numberings. That is: 730 | 731 | =begin code 732 | =head6 # The Rescue of the Kobayashi Maru 733 | =end code 734 | 735 | should produce something like: 736 | 737 | =nested 738 | B<2.3.8.6.1.9. The Rescue of the Kobayashi Maru> 739 | 740 | 741 | =head3 Ordinary paragraph blocks 742 | 743 | Ordinary paragraph blocks consist of text that is to be formatted into 744 | a document at the current level of nesting, with whitespace 745 | squeezed, lines filled, and any special L 746 | applied. 747 | 748 | Ordinary paragraphs consist of one or more consecutive lines of text, 749 | each of which starts with a non-whitespace character at (virtual) column 750 | 1. The paragraph is terminated by the first blank line or block 751 | directive. For example: 752 | 753 | =begin code 754 | =head1 This is a heading block 755 | 756 | This is an ordinary paragraph. 757 | Its text will be squeezed and 758 | short lines filled. It is terminated by 759 | the first blank line. 760 | 761 | This is another ordinary paragraph. 762 | Its text will also be squeezed and 763 | short lines filled. It is terminated by 764 | the trailing directive on the next line. 765 | =head2 This is another heading block 766 | 767 | This is yet another ordinary paragraph, 768 | at the first virtual column set by the 769 | previous directive 770 | =end code 771 | 772 | Within a C<=pod>, C<=item>, C<=defn>, C<=nested>, or 773 | L block, ordinary paragraphs do not require 774 | an explicit marker or delimiters, but there is also an explicit C 775 | marker (which may be used anywhere): 776 | 777 | =begin code :allow 778 | B<=para> 779 | This is an ordinary paragraph. 780 | Its text will be squeezed and 781 | short lines filled. 782 | =end code 783 | 784 | and likewise the longer C<=for> and C<=begin>/C<=end> forms. For example: 785 | 786 | =begin code :allow 787 | B<=begin para> 788 | This is an ordinary paragraph. 789 | Its text will be squeezed and 790 | short lines filled. 791 | 792 | This is I part of the same paragraph, 793 | which continues until an... 794 | B<=end para> 795 | =end code 796 | 797 | As the previous example implies, when any form of explicit C<=para> block 798 | is used, any whitespace at the start of each line is removed during rendering. 799 | In addition, within a delimited C<=begin para>/C<=end para> block, any 800 | blank lines are preserved. 801 | 802 | 803 | =head3 Code blocks 804 | 805 | Code blocks are used to specify pre-formatted text (typically source 806 | code), which should be rendered without rejustification, without 807 | whitespace-squeezing, and without recognizing any inline markup 808 | codes. Code blocks also have an implicit L 809 | associated with them. Typically these blocks are used to show examples 810 | of code, mark-up, or other textual specifications, and are rendered 811 | using a fixed-width font. 812 | 813 | A code block may be implicitly specified as one or more lines of text, 814 | each of which starts with a whitespace character at the block's virtual 815 | left margin. The implicit code block is then terminated by a blank line. 816 | For example: 817 | 818 | =begin code 819 | This ordinary paragraph introduces a code block: 820 | 821 | $this = 1 * code('block'); 822 | $which.is_specified(:by); 823 | =end code 824 | 825 | Implicit code blocks may only be used within C<=pod>, C<=item>, C<=defn>, 826 | C<=nested>, or L blocks. 827 | 828 | There is also an explicit C<=code> block (which can be specified within 829 | I other block type, not just C<=pod>, C<=item>, etc.): 830 | 831 | =begin code :allow 832 | The C subroutine adds feedback: 833 | 834 | B<=begin code> 835 | 836 | sub loud_update ($who, $status) { 837 | say "$who -> $status"; 838 | 839 | silent_update($who, $status); 840 | } 841 | 842 | B<=end code> 843 | =end code 844 | 845 | As the previous example demonstrates, within an explicit C<=code> block 846 | the code can start at the (virtual) left margin. Furthermore, lines that 847 | start with whitespace characters after that margin have subsequent 848 | whitespace preserved exactly (in addition to the implicit nesting of the 849 | code). Explicit C<=code> blocks may also contain empty lines. 850 | 851 | 852 | =head4 Formatting within code blocks 853 | 854 | Although C<=code> blocks automatically disregard all L, occasionally you may still need to specify 856 | some formatting within a code block. For example, you may wish 857 | to emphasize a particular keyword in an example (using a C> code). Or 858 | you may want to indicate that part of the example is metasyntactic 859 | (using the C> code). Or you might need to insert a non-ASCII 860 | character (using the C> code). 861 | 862 | You can specify a list of markup codes that should still be 863 | recognized within a code block using the C<:allow> option. The value of 864 | the C<:allow> option must be a list of the (single-letter) names of one 865 | or more markup codes. Those codes will then remain active inside the 866 | code block. For example: 867 | 868 | =begin code 869 | =begin code :allow 870 | sub demo { 871 | B 'Hello R'; 872 | } 873 | =end code 874 | =end code 875 | 876 | would be rendered: 877 | 878 | =begin code :allow 879 | sub demo { 880 | B 'Hello R'; 881 | } 882 | =end code 883 | 884 | Note that the use of the C<:allow> option also makes it possible 885 | for verbatim L (such as C> 886 | and C>) to L. 887 | 888 | =head4 Assign programming language to code blocks 889 | 890 | The C<:lang> attribute will be used to provide information about the 891 | programming language used in a particular block of code. This helps 892 | in ensuring that the code is correctly rendered and interpreted by the 893 | renderers or syntax highlighting tools. 894 | 895 | For example: 896 | 897 | =begin code :allow 898 | =begin code B<:lang> 899 | sub demo { 900 | say 'Hello R'; 901 | } 902 | =end code 903 | =end code 904 | 905 | 906 | =head3 I/O blocks 907 | 908 | Podlite also provides blocks for specifying the input and output of programs. 909 | 910 | The C<=input> block is used to specify pre-formatted keyboard input, 911 | which should be rendered without rejustification or squeezing of whitespace. 912 | 913 | The C<=output> block is used to specify pre-formatted terminal or file 914 | output which should also be rendered without rejustification or 915 | whitespace-squeezing. 916 | 917 | Note that, like C<=code> blocks, both C<=input> and C<=output> blocks have an 918 | implicit level of nesting. They are also like C<=code> blocks in that they 919 | are typically rendered in a fixed-width font, though ideally all three blocks 920 | would be rendered in distinct font/weight combinations (for example: regular 921 | serifed for code, bold sans-serif for input, and regular sans-serif for 922 | output). 923 | 924 | Unlike C<=code> blocks, both C<=input> and C<=output> blocks honour any 925 | nested markup codes. This is particularly useful since a sample of 926 | input will often include prompts (which are, of course, output). 927 | Likewise a sample of output may contain the occasional interactive 928 | component. Podlite provides L 929 | (C> and C>) to indicate embedded input or output, so you can use 930 | the block type that indicates the overall purpose of the sample (i.e. is 931 | it demonstrating an input operation or an output sequence?) and then use 932 | the "contrasting" markup code within the block. 933 | 934 | For example, to include a small amount of input in a sample of output 935 | you could use the C> markup code: 936 | 937 | =begin code :allow 938 | =begin output 939 | Name: Baracus, B.A. 940 | Rank: Sgt 941 | Serial: 1PTDF007 942 | 943 | Do you want additional personnel details? B> 944 | 945 | Height: 180cm/5'11" 946 | Weight: 104kg/230lb 947 | Age: 49 948 | 949 | Print? B> 950 | =end output 951 | =end code 952 | 953 | 954 | =head3 Lists 955 | 956 | Lists in Podlite are specified as a series of contiguous C<=item> blocks. No 957 | special "container" directives or other delimiters are required to 958 | enclose the entire list. For example: 959 | 960 | =begin code 961 | The seven suspects are: 962 | 963 | =item Happy 964 | =item Dopey 965 | =item Sleepy 966 | =item Bashful 967 | =item Sneezy 968 | =item Grumpy 969 | =item Keyser Soze 970 | =end code 971 | 972 | List items have one implicit level of nesting: 973 | 974 | =begin nested 975 | The seven suspects are: 976 | 977 | =item Happy 978 | =item Dopey 979 | =item Sleepy 980 | =item Bashful 981 | =item Sneezy 982 | =item Grumpy 983 | =item Keyser Soze 984 | =end nested 985 | 986 | Lists may be multi-level, with items at each level specified using the 987 | C<=item1>, C<=item2>, C<=item3>, etc. blocks. Note that C<=item> is just 988 | an abbreviation for C<=item1>. For example: 989 | 990 | =begin code 991 | =item1 Animal 992 | =item2 Vertebrate 993 | =item2 Invertebrate 994 | 995 | =item1 Phase 996 | =item2 Solid 997 | =item2 Liquid 998 | =item2 Gas 999 | =item2 Chocolate 1000 | =end code 1001 | 1002 | which would be rendered something like: 1003 | 1004 | =for para :nested 1005 | E Animal 1006 | =for para :nested(2) 1007 | E Vertebrate 1008 | =for para :nested(2) 1009 | E Invertebrate 1010 | 1011 | =for para :nested 1012 | E Phase 1013 | =for para :nested(2) 1014 | E Solid 1015 | =for para :nested(2) 1016 | E Liquid 1017 | =for para :nested(2) 1018 | E Gas 1019 | =for para :nested(2) 1020 | E Chocolate 1021 | 1022 | Podlite parsers must issue a warning if a "level-R" C<=item> block 1023 | (e.g. an C<=item2>, C<=item3>, etc.) appears anywhere except where there 1024 | is a preceding "level-R" C<=item> in the same surrounding block. That 1025 | is, an C<=item3> should only be specified if an C<=item2> appears 1026 | somewhere before it, and that C<=item2> should itself only appear if 1027 | there is a preceding C<=item1>. 1028 | 1029 | Note that item blocks within the same list are not physically nested. 1030 | That is, lower-level items should I be specified inside 1031 | higher-level items: 1032 | 1033 | =begin code 1034 | =comment WRONG... 1035 | =begin item1 -------------- 1036 | The choices are: | 1037 | =item2 Liberty ==< Level 2 |==< Level 1 1038 | =item2 Death ==< Level 2 | 1039 | =item2 Beer ==< Level 2 | 1040 | =end item1 -------------- 1041 | =end code 1042 | 1043 | =begin code 1044 | =comment CORRECT... 1045 | =begin item1 --------------- 1046 | The choices are: |==< Level 1 1047 | =end item1 --------------- 1048 | =item2 Liberty ==================< Level 2 1049 | =item2 Death ==================< Level 2 1050 | =item2 Beer ==================< Level 2 1051 | =end code 1052 | 1053 | 1054 | =head4 Ordered lists 1055 | 1056 | An item is part of an ordered list if the item has a C<:numbered> 1057 | configuration option: 1058 | 1059 | =begin code 1060 | =for item1 :numbered 1061 | Visito 1062 | 1063 | =for item2 :numbered 1064 | Veni 1065 | 1066 | =for item2 :numbered 1067 | Vidi 1068 | 1069 | =for item2 :numbered 1070 | Vici 1071 | =end code 1072 | 1073 | This would produce something like: 1074 | 1075 | =begin nested 1076 | 1. Visito 1077 | 1078 | =begin nested 1079 | 1.1. Veni 1080 | 1081 | 1.2. Vidi 1082 | 1083 | 1.3. Vici 1084 | =end nested 1085 | =end nested 1086 | 1087 | although the numbering scheme is entirely at the discretion of the 1088 | renderer, so it might equally well be rendered: 1089 | 1090 | =begin nested 1091 | 1. Visito 1092 | 1093 | =begin nested 1094 | 1a. Veni 1095 | 1096 | 1b. Vidi 1097 | 1098 | 1c. Vici 1099 | =end nested 1100 | =end nested 1101 | 1102 | or even: 1103 | 1104 | =begin nested 1105 | A: Visito 1106 | 1107 | =begin nested 1108 | E(i) Veni 1109 | 1110 | E(ii) Vidi 1111 | 1112 | (iii) Vici 1113 | =end nested 1114 | =end nested 1115 | 1116 | Alternatively, if the first word of the item consists of a single C<#> 1117 | character, the item is treated as having a C<:numbered> option: 1118 | 1119 | =begin code 1120 | =item1 # Visito 1121 | =item2 # Veni 1122 | =item2 # Vidi 1123 | =item2 # Vici 1124 | =end code 1125 | 1126 | To specify an I list item that starts with a literal C<#>, either 1127 | make the octothorpe verbatim: 1128 | 1129 | =begin code :allow 1130 | =item B> introduces a comment 1131 | =end code 1132 | 1133 | or explicitly mark the item itself as being unnumbered: 1134 | 1135 | =begin code :allow 1136 | =for item B<:!numbered> 1137 | # introduces a comment 1138 | =end code 1139 | 1140 | The numbering of successive C<=item1> list items increments 1141 | automatically, but is reset to 1 whenever any other kind of non-ambient 1142 | Podlite block appears between two C<=item1> blocks. For example: 1143 | 1144 | =begin code 1145 | The options are: 1146 | 1147 | =item1 # Liberty 1148 | =item1 # Death 1149 | =item1 # Beer 1150 | 1151 | The tools are: 1152 | 1153 | =item1 # Revolution 1154 | =item1 # Deep-fried peanut butter sandwich 1155 | =item1 # Keg 1156 | =end code 1157 | 1158 | would produce: 1159 | 1160 | =begin nested 1161 | The options are: 1162 | 1163 | =begin nested 1164 | =para 1. Liberty 1165 | =para 2. Death 1166 | =para 3. Beer 1167 | =end nested 1168 | 1169 | The tools are: 1170 | 1171 | =begin nested 1172 | =para 1. Revolution 1173 | =para 2. Deep-fried peanut butter sandwich 1174 | =para 3. Keg 1175 | =end nested 1176 | =end nested 1177 | 1178 | The numbering of nested items (C<=item2>, C<=item3>, etc.) only resets 1179 | (to 1) when the higher-level item's numbering either resets or increments. 1180 | 1181 | To prevent a numbered C<=item1> from resetting after a non-item block, 1182 | you can specify the C<:continued> option: 1183 | 1184 | =begin code :allow 1185 | =for item1 1186 | # Retreat to remote Himalayan monastery 1187 | 1188 | =for item1 1189 | # Learn the hidden mysteries of space and time 1190 | 1191 | I 1192 | 1193 | =for item1 B<:continued> 1194 | # Prophet! 1195 | =end code 1196 | 1197 | which produces: 1198 | 1199 | =begin nested 1200 | =para 1. Retreat to remote Himalayan monastery 1201 | =para 2. Learn the hidden mysteries of space and time 1202 | =para I 1203 | =para 3. Prophet! 1204 | =end nested 1205 | 1206 | =head4 Task lists 1207 | 1208 | In addition to the ordered list Podlite also supports 1209 | task lists, which are commonly known as checklists or to-do lists. 1210 | 1211 | To create a task list item just apply a C<:checked> 1212 | attribute to C<=item> block. 1213 | 1214 | =begin code :allow 1215 | =for item B<:checked> 1216 | Buy groceries 1217 | =for item B<:!checked> 1218 | Clean the garage 1219 | =end code 1220 | 1221 | The rendered output looks like this: 1222 | 1223 | [X] Buy groceries 1224 | [ ] Clean the garage 1225 | 1226 | Alternatively, if item content starts with brackets with space (C<[ ]>) 1227 | the item is treated as having a C<:!checked> attribute. 1228 | To select a checkbox, add an C in between the brackets (C<[x]>). it eqvivalent 1229 | of C<:checked> attribute. 1230 | 1231 | For example: 1232 | =begin code :allow 1233 | =item B<[x]> Buy groceries 1234 | =itme B<[ ]> Clean the garage 1235 | =end code 1236 | 1237 | It possiible to create multilevel to-do lists, which permits the 1238 | inclusion of various task levels or sub-tasks. 1239 | Here's an example: 1240 | 1241 | =begin code :allow 1242 | B<=item1> [ ] Work 1243 | B<=item2> [ ] Prepare the presentation 1244 | =item2 [x] Send emails 1245 | =item1 [ ] Home 1246 | =item2 [ ] Vacuum the living room 1247 | =item2 [ ] Water the plants 1248 | =end code 1249 | 1250 | =head4 Unordered lists 1251 | 1252 | List items that are not C<:numbered> or C<:checked> are treated as defining unordered 1253 | lists. Typically, such lists are rendered with bullets. For example: 1254 | 1255 | =begin code 1256 | =item1 Reading 1257 | =item2 Writing 1258 | =item3 'Rithmetic 1259 | =end code 1260 | 1261 | might be rendered: 1262 | 1263 | =for para :nested(1) 1264 | EReading 1265 | =for para :nested(2) 1266 | EWriting 1267 | =for para :nested(3) 1268 | E'Rithmetic 1269 | 1270 | As with numbering styles, the bulletting strategy used for different levels 1271 | within a nested list is entirely up to the renderer. 1272 | 1273 | 1274 | =head4 Multi-paragraph list items 1275 | 1276 | Use the delimited form of the C<=item> block to specify items that 1277 | contain multiple paragraphs. For example: 1278 | 1279 | =begin code 1280 | Let's consider two common proverbs: 1281 | 1282 | =begin item :numbered 1283 | I 1284 | 1285 | This is a common myth and an unconscionable slur on the Spanish 1286 | people, the majority of whom are extremely attractive. 1287 | =end item 1288 | 1289 | =begin item :numbered 1290 | I 1291 | 1292 | In deciding whether to become an early riser, it is worth 1293 | considering whether you would actually enjoy annelids 1294 | for breakfast. 1295 | =end item 1296 | 1297 | As you can see, folk wisdom is often of dubious value. 1298 | =end code 1299 | 1300 | which produces: 1301 | 1302 | =begin nested 1303 | =config item :numbered 1304 | Let's consider two common proverbs: 1305 | 1306 | =begin item 1307 | I 1308 | 1309 | This is a common myth and an unconscionable slur on the Spanish 1310 | people, the majority of whom are extremely attractive. 1311 | =end item 1312 | 1313 | =begin item 1314 | I 1315 | 1316 | In deciding whether to become an early riser, it is worth 1317 | considering whether you would actually enjoy annelids 1318 | for breakfast. 1319 | =end item 1320 | 1321 | As you can see, folk wisdom is often of dubious value. 1322 | =end nested 1323 | 1324 | 1325 | =head4 Definition lists 1326 | 1327 | To create term/definition lists, use a C<=defn> block. This is 1328 | similar in effect to an C<=item> block, in that a series of C<=defn> 1329 | blocks implicitly defines a list (but which might then be rendered into 1330 | HTML using C«
...
» tags, rather than C«
    ...
» tags) 1331 | 1332 | The first non-blank line of content is treated as a term being defined, 1333 | and the remaining content is treated as the definition for the term. 1334 | For example: 1335 | 1336 | =begin code 1337 | =defn MAD 1338 | Affected with a high degree of intellectual independence. 1339 | 1340 | =defn MEEKNESS 1341 | Uncommon patience in planning a revenge that is worth while. 1342 | 1343 | =defn 1344 | MORAL 1345 | Conforming to a local and mutable standard of right. 1346 | Having the quality of general expediency. 1347 | =end code 1348 | 1349 | Like other kinds of list items, definitions can be numbered, using either an 1350 | option or a leading C<#>: 1351 | 1352 | =begin code :allow 1353 | =for defn B<:numbered> 1354 | SELFISH 1355 | Devoid of consideration for the selfishness of others. 1356 | 1357 | =defn B<#> SUCCESS 1358 | The one unpardonable sin against one's fellows. 1359 | =end code 1360 | 1361 | 1362 | =head3 Nesting blocks 1363 | 1364 | Any block can be nested by specifying a C<:nested> option on it: 1365 | 1366 | =begin code :allow 1367 | =begin para B<:nested> 1368 | We are all of us in the gutter,E 1369 | but some of us are looking at the stars! 1370 | =end para 1371 | =end code 1372 | 1373 | However, qualifying each nested paragraph individually quickly becomes 1374 | tedious if there are many in a sequence, or if multiple levels of 1375 | nesting are required: 1376 | 1377 | =begin code :allow 1378 | =begin para B<:nested> 1379 | We are all of us in the gutter,E 1380 | but some of us are looking at the stars! 1381 | =end para 1382 | =begin para B<:nested(2)> 1383 | -- Oscar Wilde 1384 | =end para 1385 | =end code 1386 | 1387 | So Podlite provides a C<=nested> block that marks all its contents as being 1388 | nested: 1389 | 1390 | =begin code :allow 1391 | B<=begin nested> 1392 | We are all of us in the gutter,E 1393 | but some of us are looking at the stars! 1394 | B<=begin nested> 1395 | -- Oscar Wilde 1396 | B<=end nested> 1397 | B<=end nested> 1398 | =end code 1399 | 1400 | Nesting blocks can contain any other kind of block, including implicit 1401 | paragraph and code blocks. Note that the relative physical indentation 1402 | of the blocks plays no role in determining their ultimate nesting. 1403 | The preceding example could equally have been specified: 1404 | 1405 | =begin code :allow 1406 | B<=begin nested> 1407 | We are all of us in the gutter,E 1408 | but some of us are looking at the stars! 1409 | B<=begin nested> 1410 | -- Oscar Wilde 1411 | B<=end nested> 1412 | B<=end nested> 1413 | =end code 1414 | 1415 | 1416 | =head3 Tables 1417 | 1418 | Simple tables can be specified in Podlite using a C<=table> block. 1419 | The table may be given an associated description or title using the 1420 | C<:caption> option. 1421 | 1422 | Columns are separated by two or more consecutive whitespace characters 1423 | (double-space), 1424 | or by a vertical line (C<|>) or a border intersection (C<+>), either of 1425 | which must be separated from any content by at least one whitespace 1426 | character. Note that only one column separator type is allowed in a single line, 1427 | but different lines are allowed to use different visible column separator types 1428 | (that style is not recommended). Using a mixture of visible and non-visible 1429 | column separator types in a table is an error. 1430 | 1431 | Rows can be specified in one of two ways: either one row per line, with 1432 | no separators; or multiple lines per row with explicit horizontal 1433 | separators (whitespace, intersections (C<+>), or horizontal lines: C<->, 1434 | C<=>, C<_>) between I row. Either style can also have an 1435 | explicitly separated header row at the top. If rows are using the 1436 | two-whitespace-character separator, the row cells should be carefully 1437 | aligned to ensure the table is interpreted as the user intended. 1438 | 1439 | Each individual table cell is separately formatted, as if it were a 1440 | nested C<=para>. Note that table rows are expected to have the same number 1441 | of cells. 1442 | 1443 | This means you can create tables compactly, line-by-line: 1444 | 1445 | =begin code 1446 | =table 1447 | The Shoveller Eddie Stevens King Arthur's singing shovel 1448 | Blue Raja Geoffrey Smith Master of cutlery 1449 | Mr Furious Roy Orson Ticking time bomb of fury 1450 | The Bowler Carol Pinnsler Haunted bowling ball 1451 | =end code 1452 | 1453 | With header: 1454 | 1455 | =begin code 1456 | =begin table 1457 | 1458 | Directive Specifies 1459 | _________ ____________________________________________________ 1460 | C<=begin> Start of an explicitly terminated block 1461 | C<=config> Lexical modifications to a block or markup code 1462 | 1463 | =end table 1464 | =end code 1465 | 1466 | Or: 1467 | 1468 | =begin code 1469 | =begin table 1470 | 1471 | Energy Source Benefit 1472 | 1473 | Solar power Reduces electricity bills 1474 | Wind energy Clean power source 1475 | Hydroelectric power Highly efficient 1476 | Geothermal energy Low emissions 1477 | Biomass Reduces waste 1478 | 1479 | =end table 1480 | =end code 1481 | 1482 | or line-by-line with multi-line headers: 1483 | 1484 | =begin code 1485 | =table 1486 | Superhero | Secret | 1487 | | Identity | Superpower 1488 | ==============|=================|================================ 1489 | The Shoveller | Eddie Stevens | King Arthur's singing shovel 1490 | Blue Raja | Geoffrey Smith | Master of cutlery 1491 | Mr Furious | Roy Orson | Ticking time bomb of fury 1492 | The Bowler | Carol Pinnsler | Haunted bowling ball 1493 | =end code 1494 | 1495 | or with multi-line headers I multi-line data: 1496 | 1497 | =begin code 1498 | =begin table :caption('The Other Guys') 1499 | 1500 | Secret 1501 | Superhero Identity Superpower 1502 | ============= =============== =================== 1503 | The Shoveller Eddie Stevens King Arthur's 1504 | singing shovel 1505 | 1506 | Blue Raja Geoffrey Smith Master of cutlery 1507 | 1508 | Mr Furious Roy Orson Ticking time bomb 1509 | of fury 1510 | 1511 | The Bowler Carol Pinnsler Haunted bowling ball 1512 | 1513 | =end table 1514 | =end code 1515 | 1516 | =head4 Advanced Table Format 1517 | 1518 | Tables may construct using C<=row> and C<=cell> blocks. 1519 | The C<=row> blocks represent individual rows within the table. 1520 | 1521 | The C<=cell> blocks exist within rows and contain the actual content of the table. 1522 | These cells can contain text, data, or other blocks. 1523 | 1524 | =begin code 1525 | =begin table 1526 | 1527 | =begin row 1528 | =cell Fruits 1529 | =cell Bananas 1530 | =cell Yellow and ripe 1531 | =end row 1532 | 1533 | =begin row 1534 | =cell Vegetables 1535 | =cell Carrots 1536 | =begin cell 1537 | =para Crunchy and orange 1538 | =end cell 1539 | =end row 1540 | 1541 | =end table 1542 | =end code 1543 | 1544 | Each C<=row> block may have an optional C<:header> attribute, designating 1545 | it as a header row. Header rows typically contain labels or titles 1546 | for columns and are visually distinct. 1547 | 1548 | 1549 | =begin code :allow 1550 | =begin table 1551 | 1552 | =begin row B<:header> 1553 | =cell Category 1554 | =cell Product 1555 | =cell Description 1556 | =end row 1557 | 1558 | =begin row 1559 | =cell Fruits 1560 | =cell Bananas 1561 | =cell Yellow and ripe 1562 | =end row 1563 | 1564 | =begin row 1565 | =cell Vegetables 1566 | =cell Carrots 1567 | =cell Crunchy and orange 1568 | =end row 1569 | 1570 | =end table 1571 | =end code 1572 | 1573 | The C<=cell> blocks can also have two important attributes: 1574 | 1575 | =begin defn 1576 | C<:colspan> 1577 | 1578 | This attribute specifies the number of columns a cell should span horizontally. 1579 | It allows cells to merge and occupy multiple adjacent columns, creating a visually 1580 | unified cell. 1581 | =end defn 1582 | 1583 | =begin defn 1584 | C<:rowspan> 1585 | 1586 | This attribute determines how many rows a cell should span vertically. 1587 | Cells with C<:rowspan> can cover multiple rows in a table, creating a vertical merge effect. 1588 | =end defn 1589 | 1590 | These example demonstrate how C<:colspan> and C<:rowspan> attributes can be used 1591 | to create tables with merged cells, which is especially useful for complex 1592 | data structures. 1593 | 1594 | =begin code 1595 | =begin table 1596 | 1597 | =begin row :header 1598 | =for cell :colspan(2) 1599 | Item and Quantity 1600 | =cell Description 1601 | =end row 1602 | 1603 | =begin row 1604 | =cell Apples 1605 | =cell 5 1606 | =for cell :rowspan(2) 1607 | Fruit for snacking 1608 | =end row 1609 | 1610 | =begin row 1611 | =cell Bananas 1612 | =cell 3 1613 | =end row 1614 | 1615 | =end table 1616 | =end code 1617 | 1618 | 1619 | It draw somethink like this: 1620 | 1621 | --------------------------------------------------------------- 1622 | | Item and Quantity | Description | 1623 | |----------------------------------|--------------------------| 1624 | | Apples | 5 | | 1625 | |--------------|-------------------| Fruit for snacking | 1626 | | Bananas | 3 | | 1627 | --------------------------------------------------------------- 1628 | 1629 | Each C<=row> block may only contain C<=cell> blocks or blank lines as delimiters. 1630 | All other types of blocks within the C<=row> are implicitly wrapped 1631 | by C<=cell> blocks. 1632 | 1633 | For example: 1634 | 1635 | =begin code 1636 | 1637 | =begin table 1638 | 1639 | =begin row :header 1640 | =cell Diagram or Picture 1641 | =cell Description 1642 | =end row 1643 | 1644 | =begin row 1645 | =picture spacecraft_in_orbit.jpg 1646 | =para 1647 | A vehicle designed for space travel 1648 | =end row 1649 | 1650 | =begin row 1651 | =Mermaid 1652 | graph TD; 1653 | A[Space Station] --> B[Mars Base] 1654 | 1655 | A space station connected to a Mars base 1656 | =end row 1657 | 1658 | =end table 1659 | 1660 | =end code 1661 | 1662 | =head4 Table from CSV files or data blocks 1663 | 1664 | It is possible to create tables from files or data blocks. 1665 | To do this, use the C or C schema in the first non-blank line 1666 | to specify the source of the table data. 1667 | For example: 1668 | 1669 | =begin code :allow 1670 | =table B 1671 | 1672 | =for table :caption('Basic cake recipe ingredients') 1673 | B 1674 | 1675 | =begin data B<:key> :mime-type 1676 | ingredient,quantity,unit 1677 | flour,2,cups 1678 | sugar,1,cups 1679 | eggs,2,items 1680 | butter,0.5,cups 1681 | baking powder,2,teaspoons 1682 | =end data 1683 | =end code 1684 | 1685 | 1686 | =for head3 :id 1687 | Named or modular custom blocks 1688 | 1689 | D whose names contain at least one uppercase and one lowercase 1690 | letter are assumed to be destined for specialized renderers or parser 1691 | plug-ins. For example: 1692 | 1693 | =begin code 1694 | =begin Xhtml 1695 | 1696 | =end Xhtml 1697 | =end code 1698 | 1699 | or: 1700 | 1701 | =begin code 1702 | =Image http://www.perlfoundation.org/images/perl_logo_32x104.png 1703 | =end code 1704 | 1705 | =begin nested :notify 1706 | Named or modular blocks are defined within separate modules 1707 | and integrated into the core system through a defined interface or API. 1708 | 1709 | The interface or API for external modules depends on the implementation. 1710 | =end nested 1711 | 1712 | Ideally, each named block should have a corresponding handler responsible 1713 | for its rendering and processing. 1714 | 1715 | In the absence of a handler for named block, the implementation should 1716 | allow the content to degrade gracefully, ensuring that the core message 1717 | or functionality remains accessible even if some advanced features cannot 1718 | be rendered. As result, that blocks my be displayed as verbatim or 1719 | placeholder content or even not rendered at all. 1720 | 1721 | Alongside the verbatim or placeholder content, the renderer could provide 1722 | an unobtrusive yet informative error message, explaining that the named block 1723 | could not be processed. 1724 | 1725 | Note that all block names consisting entirely of lowercase or entirely of 1726 | uppercase letters are reserved. See L<#Semantic blocks>. 1727 | 1728 | To check custom markup codes, refer to L<#Custom markup codes>. 1729 | 1730 | 1731 | =head3 Podlite comments 1732 | 1733 | D refers to Podlite blocks that should not 1734 | be displayed by any renderer. However, they are still may be part of the 1735 | internal Podlite representation. 1736 | 1737 | Comments are useful for meta-documentation (documenting the documentation): 1738 | 1739 | =begin code 1740 | =comment Add more here about the algorithm 1741 | =end code 1742 | 1743 | and for temporarily removing parts of a document: 1744 | 1745 | =begin code :allow 1746 | =item # Retreat to remote Himalayan monastery 1747 | 1748 | =item # Learn the hidden mysteries of space and time 1749 | 1750 | =item # Achieve enlightenment 1751 | 1752 | B<=begin comment> 1753 | =item # Prophet! 1754 | B<=end comment> 1755 | =end code 1756 | 1757 | 1758 | =head3 Data blocks 1759 | 1760 | The C<=data> block is used to embed various types of data directly into a document. 1761 | 1762 | For example, to include a CSV file in a document, it is possible to 1763 | use the following syntax: 1764 | 1765 | =begin code :allow 1766 | 1767 | =begin data :key :mime-type 1768 | name,month,amount 1769 | John Doe,January,1000 1770 | Jane Doe,February,1500 1771 | =end data 1772 | 1773 | =end code 1774 | 1775 | Each C<=data> block can be given a C<:key> option, to name it. The contents 1776 | of any C<=data> block with a key are addressable via 1777 | the C schema. For example: 1778 | 1779 | =begin code :allow 1780 | =begin data B<:key> :mime-type 1781 | id,name,position,department 1782 | 1,John Doe,Manager,Marketing 1783 | 2,Jane Smith,Developer,Engineering 1784 | 3,Bob Brown,Designer,Product 1785 | =end data 1786 | 1787 | =table B 1788 | 1789 | =end code 1790 | 1791 | Each C<=data> block can include several attributes to provide additional information 1792 | about the contained data: 1793 | 1794 | =begin defn 1795 | C<:filename> 1796 | 1797 | This option specifies the original file name of the embedded data, which 1798 | can be used to hint at the type of data contained if the C<:mime-type> is not 1799 | explicitly provided. 1800 | =end defn 1801 | 1802 | =begin defn 1803 | C<:mime-type> 1804 | 1805 | This option indicates the MIME type of the data, such as C for PNG images, 1806 | which helps determine how the data should be interpreted and processed. 1807 | 1808 | Here is a list of common MIME types and their corresponding file extensions: 1809 | 1810 | =table 1811 | MIME Type | File Extension 1812 | ------------------ | -------------- 1813 | text/plain | .txt 1814 | text/markdown | .md, .markdown 1815 | text/podlite | .podlite, .pod6 1816 | application/json | .json 1817 | application/xml | .xml 1818 | image/jpeg | .jpg, .jpeg 1819 | image/png | .png 1820 | application/pdf | .pdf 1821 | application/zip | .zip 1822 | audio/mpeg | .mp3 1823 | video/mp4 | .mp4 1824 | application/msword | .doc, .docx 1825 | text/csv | .csv 1826 | text/tab-separated-values | .tsv, .tab 1827 | 1828 | =end defn 1829 | 1830 | =begin defn 1831 | C<:access-time> and C<:modify-time> 1832 | 1833 | These attributes record the times when the data was last accessed or 1834 | edited. 1835 | 1836 | =end defn 1837 | 1838 | =begin defn 1839 | C<:encoding> 1840 | 1841 | This option specifies the encoding method used to store the data. 1842 | For non-text data, such as images in PNG format, 1843 | the encoding method C is used. 1844 | =end defn 1845 | 1846 | Example of storing images in C<=data> blocks: 1847 | 1848 | =begin code :allow 1849 | 1850 | =begin B B<:key> :filename :mime-type 1851 | = :access-time<2022-01-01T00:00:00Z> :modify-time<2022-01-02T10:00:00Z> 1852 | = :encoding 1853 | iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAS0lEQVR4AWPOPfjpvWZSW4db 1854 | ZLk+kwTHP24HUQYGfi4WTiZVAcYfDtIMDCJc/38xK6TWth37wcrw7cufF8yeeWUGrL8Z33Ey 1855 | /t0HAMBnF2nt5sNRAAAAAElFTkSuQmCC 1856 | =end data 1857 | 1858 | =picture B 1859 | 1860 | =end code 1861 | 1862 | In the example above, we have a C<=data> block with C<:id> C that stores 1863 | the base64-encoded image data. We also specify the filename, mime type, 1864 | access time, and edit time as attributes of the C<=data> block. 1865 | 1866 | The image can then be referenced using the C<=picture> block with the scheme 1867 | C and the block name C. 1868 | 1869 | 1870 | The C<=data> blocks are just regular Podlite blocks and may appear anywhere 1871 | within a source file, and as many times as required. 1872 | 1873 | Note that in Podlite, it is possible to specify C<=data> blocks 1874 | I the point in the source where their contents will be used. 1875 | 1876 | C<=data> blocks are never rendered by the standard Podlite renderers. 1877 | 1878 | 1879 | =head3 Semantic blocks 1880 | 1881 | All uppercase block typenames are reserved for specifying standard 1882 | documentation, publishing, or source components. 1883 | 1884 | Standard semantic blocks include: 1885 | 1886 | =begin code 1887 | =NAME 1888 | =AUTHOR 1889 | =VERSION 1890 | =SYNOPSIS 1891 | =DESCRIPTION 1892 | =USAGE 1893 | =INTERFACE 1894 | =METHOD 1895 | =SUBROUTINE 1896 | =OPTION 1897 | =DIAGNOSTIC 1898 | =ERROR 1899 | =WARNING 1900 | =DEPENDENCY 1901 | =BUG 1902 | =SEE-ALSO 1903 | =ACKNOWLEDGEMENT 1904 | =COPYRIGHT 1905 | =DISCLAIMER 1906 | =LICENCE 1907 | =LICENSE 1908 | =TITLE 1909 | =SECTION 1910 | =CHAPTER 1911 | =APPENDIX 1912 | =TOC 1913 | =INDEX 1914 | =FOREWORD 1915 | =SUMMARY 1916 | =end code 1917 | 1918 | The plural forms of each of these keywords are also reserved, and are 1919 | aliases for the singular forms. 1920 | 1921 | Most of these blocks are typically used in their full delimited forms: 1922 | 1923 | =begin code 1924 | =begin SYNOPSIS 1925 | use Magic::Parser; 1926 | 1927 | my Magic::Parser $parser .= new(); 1928 | 1929 | my $tree = $parser.parse($fh); 1930 | =end SYNOPSIS 1931 | =end code 1932 | 1933 | Semantic blocks can be considered to be variants of the C<=head1> block 1934 | in most respects (and most renderers will treat them as such). The main 1935 | difference is that, in a C<=head1> block, the heading is the contents of 1936 | the block; whereas, in a semantic block, the heading is derived from the 1937 | typename of the block itself and the block contents are instead treated as 1938 | the C<=para> or C<=code> block(s) belonging to the heading. 1939 | 1940 | The use of these special blocks is not required; you can still just write: 1941 | 1942 | =begin code 1943 | =head1 SYNOPSIS 1944 | =begin code :lang 1945 | use Magic::Parser 1946 | 1947 | my Magic::Parser $parser .= new(); 1948 | 1949 | my $tree = $parser.parse($fh); 1950 | =end code 1951 | =end code 1952 | 1953 | However, using the keywords adds semantic information to the 1954 | documentation, which may assist various renderers, summarizers, coverage 1955 | tools, document refactorers, and other utilities. This is because a 1956 | semantic block I the text it controls (unlike a C<=head1>, 1957 | which merely precedes its corresponding text), so using semantic blocks 1958 | produces a more explicitly structured document. 1959 | 1960 | Note that there is no requirement that semantic blocks be rendered in 1961 | a particular way (or at all). Specifically, it is not necessary to 1962 | preserve the capitalization of the keyword. For example, the 1963 | C<=SYNOPSIS> block of the preceding example might be rendered like so: 1964 | 1965 | =begin nested 1966 | B<3.EI> 1967 | 1968 | =begin code :lang 1969 | use Raku::Magic::Parser; 1970 | 1971 | my $rep = Raku::Magic::Parser.parse($fh, :all_pod); 1972 | =end code 1973 | =end nested 1974 | 1975 | 1976 | =head3 Table of contents 1977 | 1978 | The C<=toc> block creates an autogenerated table of contents (TOC) 1979 | in a document. The TOC is an index of section titles within the document, 1980 | and its structure is determined by the document's organization. 1981 | 1982 | The first non-blank line of C<=toc> content is treated as a L. 1983 | 1984 | For example: 1985 | 1986 | =begin code 1987 | =toc head1, head2, head3, item1, item2, table 1988 | =end code 1989 | 1990 | or: 1991 | 1992 | =begin code 1993 | =toc head1, head2, head3 1994 | =end code 1995 | 1996 | The TOC displays without a caption by default. 1997 | However, a caption can be specified using the C<:caption> 1998 | attribute of the C<=toc> block. 1999 | 2000 | For example: 2001 | 2002 | =begin code :allow 2003 | =for toc B<:caption('Table of contents')> 2004 | head1, head2, head3 2005 | =end code 2006 | 2007 | The TOC entries are built using the C<:caption> attribute content 2008 | within the block. If this attribute is not present, the text 2009 | presentation of the block's content serves as the TOC entry. 2010 | 2011 | The depth of the generated TOC is determined by the L<"Selector"|#Selectors> argument. 2012 | The selector is processed, and headers or filtered blocks that 2013 | allow levels are used to build the TOC levels. If a block lacks an 2014 | associated level, it is rendered at a level one higher than the previous 2015 | block with a level in the TOC. 2016 | 2017 | Note that all L are treated as equivalent 2018 | to C headings, and the C<=item1>/C<=item> equivalence is preserved. 2019 | 2020 | The C<:folded-levels> attribute indicates which levels of the TOC should 2021 | be folded. 2022 | 2023 | =begin code :allow 2024 | =for toc B<:folded-levels[2,3]> :caption('Table of contents') 2025 | head1, head2, item1 2026 | =end code 2027 | 2028 | If the C<:folded-levels> attribute is provided with a set 2029 | of key-value pairs, it indicates the folding state of each 2030 | specified level. 2031 | 2032 | For example: 2033 | 2034 | =begin code :allow 2035 | =for toc B« :folded-levels< 2=>1, 4 => 1, 3=>0 > » 2036 | head1, head2, head3, item1, item2 2037 | =end code 2038 | 2039 | The value C<0> for level C<3> indicates that this level should 2040 | remain unfolded. Levels C<2> and C<4> are folded. 2041 | 2042 | This configuration enables customized folding within the TOC. 2043 | 2044 | The TOC is inserted at the location of the C<=toc> block. 2045 | 2046 | To enable the autogenerated TOC controlled by the renderer, set the C<:toc> 2047 | document attribute for the C<=pod> block. In this case, the specific configuration 2048 | and outcome of the TOC are determined by the renderer implementation. 2049 | 2050 | 2051 | =head3 Include block 2052 | 2053 | The C<=include> block enables reuse of specific parts of documents within 2054 | project sources. This feature is particularly useful for complex documents 2055 | that require including sections from different files while maintaining the 2056 | overall context and structure. 2057 | 2058 | The C<=include> block is followed by a L<"Selector"|#Selectors> that specifies the 2059 | content to be included. 2060 | 2061 | In this example, the content of the file C located in the 2062 | C<./includes> directory is included: 2063 | 2064 | =begin code 2065 | =include file:./includes/chapter01.pod6 2066 | =end code 2067 | 2068 | A wildcard L<"Selector"|#Selectors> enables inclusion 2069 | of content from all the Markdown files: 2070 | 2071 | =begin code 2072 | =include file:./includes/*.md 2073 | =end code 2074 | 2075 | It is possible to include blocks from the same document. 2076 | This feature proves valuable when reusing parts of existing content. 2077 | 2078 | For instance, a semantic block C<=VERSION> can be included as demonstrated: 2079 | 2080 | =begin code :allow 2081 | B<=include VERSION> 2082 | =VERSION 1.0.0 2083 | =end code 2084 | 2085 | or, equivalently: 2086 | 2087 | =begin code 2088 | =VERSION 1.0.0 2089 | =VERSION 1.0.0 2090 | =end code 2091 | 2092 | Podlite detects the type of the included file by its extension. 2093 | For example, if the included file has a C<.md> extension, 2094 | it is treated as a Markdown file. 2095 | 2096 | To override the type of the included file, use the C<:mime-type> 2097 | attribute. This attribute specifies the MIME type of the included file. 2098 | For example: 2099 | 2100 | =begin code :allow 2101 | =for include B<:mime-type('text/podlite')> 2102 | file:./includes/text.txt 2103 | =end code 2104 | 2105 | The C<:mime-type> attribute is particularly useful when including files with 2106 | extensions that do not match their actual MIME type. 2107 | 2108 | Security considerations are crucial, as adding content from external 2109 | sources could potentially create vulnerabilities such as injecting harmful code 2110 | or malicious material. Tools responsible for displaying and handling the content 2111 | should provide warnings in such situations. 2112 | 2113 | 2114 | =head3 Inserting pictures 2115 | 2116 | Podlite allows to include images using a C<=picture> block with an inline version 2117 | represented as C>: 2118 | 2119 | =begin code :allow 2120 | B<=picture astronaut.png> 2121 | =para In the vast expanse of the cosmos, an intrepid B> 2122 | floats weightlessly above the Earth. 2123 | =end code 2124 | 2125 | The first non-blank line of content within the C<=picture> block specifies the 2126 | source of the image, and the remaining content is treated as caption. 2127 | 2128 | This source can be either local or remote, and it can be 2129 | specified using different schemas: C for remote images, C for 2130 | local ones, or C for L in the document. 2131 | If no schema is provided, C is used as default. 2132 | 2133 | =begin code :allow 2134 | =picture https://example.com/image.jpg 2135 | =picture file:/local/image.png 2136 | =picture /local/image.png 2137 | =picture ../image.png 2138 | =picture data:Logo 2139 | =end code 2140 | 2141 | Following the source line, it possible to include an image caption. 2142 | 2143 | =begin code 2144 | =picture astronaut.png 2145 | In the vast expanse of the cosmos, an intrepid B 2146 | floats weightlessly above the Earth. 2147 | =end code 2148 | 2149 | In the delimited form of C<=picture>, multiple text blocks can be included: 2150 | 2151 | =begin code 2152 | =begin picture 2153 | astronaut.png 2154 | 2155 | In the vast expanse of the cosmos, an intrepid B 2156 | floats weightlessly above the Earth. 2157 | 2158 | This astronaut explores the vastness of space. 2159 | 2160 | =end picture 2161 | =end code 2162 | 2163 | All inline markup codes supported by L 2164 | can be used within picture captions. 2165 | 2166 | A caption can also be defined using the C<:caption> attribute: 2167 | 2168 | =begin code :allow 2169 | =for picture B<:caption> 2170 | diag01.png 2171 | =end code 2172 | 2173 | 2174 | =head3 Mathematical formulas 2175 | 2176 | To include mathematical formulas, use a C<=formula> block with an inline version 2177 | represented as C>. 2178 | 2179 | To insert mathematical expressions, use LaTeX-style syntax, which is 2180 | a commonly used format for writing mathematical equations. 2181 | 2182 | =begin code :allow 2183 | B<=formula> 2184 | x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} 2185 | 2186 | In a right triangle, the length of the hypotenuse can be calculated 2187 | using the Pythagorean theorem: B>. 2188 | 2189 | Euler's identity, B>, is a fundamental equation in 2190 | complex analysis. 2191 | 2192 | =end code 2193 | 2194 | The formula caption can be defined using the C<:caption> attribute: 2195 | 2196 | =begin code :allow 2197 | =formula B< :caption > 2198 | x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} 2199 | =end code 2200 | 2201 | 2202 | =head3 Markdown support 2203 | 2204 | Podlite includes built-in support for Markdown, making it easy to include Markdown 2205 | content within Podlite documents. This is achieved using the C<=markdown> block. 2206 | 2207 | =begin code :allow 2208 | B<=begin markdown> 2209 | 2210 | ## Markdown Example 2211 | 2212 | You can use all the standard Markdown syntax within this block. For example: 2213 | 2214 | - *Italic text* using asterisks or underscores: *italic* or _italic_. 2215 | - **Bold text** using double asterisks or underscores: **bold** or __bold__. 2216 | - [Links](https://example.com) with the `[text](url)` syntax. 2217 | - Unordered lists using `-`, `*`, or `+`: 2218 | 2219 | - Item 1 2220 | - Item 2 2221 | 2222 | - Ordered lists using numbers: 2223 | 2224 | 1. First item 2225 | 2. Second item 2226 | 2227 | - Code blocks with backticks: 2228 | 2229 | ```python 2230 | def hello_world(): 2231 | print("Hello, World!") 2232 | ``` 2233 | 2234 | - Blockquotes with the `>` symbol: 2235 | 2236 | > This is a blockquote. 2237 | 2238 | B<=end markdown> 2239 | =end code 2240 | 2241 | This block allows to seamlessly combine Podlite's structured blocks with 2242 | the flexibility of Markdown. 2243 | 2244 | 2245 | =head2 Markup codes 2246 | 2247 | Markup codes enable inline markup within the text of (most) Podlite block types. 2248 | They are a form of block that can contain only other markup codes. Specifically, 2249 | markup codes can nest: 2250 | 2251 | =begin code :allow 2252 | V> 2254 | and with emphasis.> 2255 | =end code 2256 | 2257 | All Podlite markup codes consist of a single capital letter followed 2258 | immediately by a set of angle brackets. The brackets contain the text or 2259 | data to which the markup code applies. A set of single 2260 | angles (C«<...>»), a set of double angles (C<«...»>), or multiple 2261 | single-angles (C«<<<...>>>») can be used. 2262 | 2263 | Within angle delimiters, you cannot use sequences of the same angle 2264 | characters that are longer than the delimiters: 2265 | 2266 | =begin code :allow 2267 | =comment 2268 | These are errors... 2269 | 2270 | C< $fooB«<<»barB«>>» > 2271 | The Perl 5 heredoc syntax was: C< B«<<»END_MARKER > 2272 | =end code 2273 | 2274 | Sequences of angles that are the same length as 2275 | the delimiters I be used, but they must be balanced. For example: 2276 | 2277 | C< $foo > 2278 | C<< $foo<> >> 2279 | 2280 | If an unbalanced angle is needed, either use different delimiters: 2281 | 2282 | =begin code :allow 2283 | CB<«>$foo < $barB<»> 2284 | The Perl 5 heredoc syntax was: CB<«> < 2285 | =end code 2286 | 2287 | or delimiters with more consecutive angles than the text contains: 2288 | 2289 | =begin code :allow 2290 | CB«<<»$foo < $barB«>>» 2291 | The Perl 5 heredoc syntax was: CB«<<<» <>>» 2292 | =end code 2293 | 2294 | A markup code ends at the matching closing angle bracket(s), or at 2295 | the end of the enclosing block or markup code in which the opening 2296 | angle bracket was specified, whichever comes first (this includes paragraph 2297 | and abbreviated blocks, ending with blank a line). Podlite parsers are 2298 | required to issue a warning whenever a markup code is terminated by 2299 | the end of an outer block rather than by its own delimiter (unless the 2300 | user explicitly disables the warning). 2301 | 2302 | 2303 | =head3 Significance indicators 2304 | 2305 | Podlite provides three markup codes that flag their contents with 2306 | increasing levels of significance: 2307 | 2308 | =item 2309 | The C> markup code specifies that the contained text is 2310 | B or distinctive; that it is of I. Typically 2311 | such content would be rendered in an underlined style. 2312 | 2313 | =item 2314 | The C> markup code specifies that the contained text is 2315 | B; that it is of I. Such content would 2316 | typically be rendered in italics or in C< ... > tags 2317 | 2318 | =item 2319 | The C> markup code specifies that the contained text is the 2320 | B or focus of the surrounding text; that it is of I. Such content would typically be rendered in a bold style or 2322 | in C< ... > tags. 2323 | 2324 | 2325 | =head3 Mistake marking 2326 | 2327 | The code C> can be used for strikethrough text, where 'O' stands 2328 | for "Overstrike." This indicates that certain words are a 2329 | mistake and should not be included in the document. 2330 | 2331 | O Our planet's sky is usually blue. 2332 | 2333 | 2334 | =head3 Text positioning 2335 | 2336 | Podlite provides two markup codes for positioning characters or words. 2337 | 2338 | =begin item 2339 | To create subscript text, use the C> markup code, where 'J' represents 2340 | "Junior text." Subscript positions one or more characters slightly below the normal 2341 | line of type. 2342 | 2343 | HJ<2>O 2344 | 2345 | This code renders as C2O>, which signifies that the '2' is positioned 2346 | slightly below the baseline, as is often seen in chemical formulas like C (water). 2347 | =end item 2348 | 2349 | =begin item 2350 | To create superscript text, it possible to use the C> markup code, where 'H' 2351 | stands for "High text." Superscript positions one or more characters slightly 2352 | above the normal line of type 2353 | 2354 | XH<2> 2355 | 2356 | This code renders as C2>, indicating that the C<'2'> is positioned 2357 | slightly above the baseline. This is commonly used for mathematical exponents, as in C. 2358 | =end item 2359 | 2360 | 2361 | =head3 Definitions 2362 | 2363 | The C> markup code indicates that the contained text is a 2364 | B, introducing a term that the adjacent text 2365 | elucidates. It is the inline equivalent of a C<=defn> block. 2366 | For example: 2367 | 2368 | =begin code :allow 2369 | There ensued a terrible moment of B>: a brief 2370 | suspension of the effects of gravity, accompanied by a sudden 2371 | to-the-camera realization of imminent downwards acceleration. 2372 | =end code 2373 | 2374 | A definition may be given synonyms, which are specified after a vertical bar 2375 | and separated by semicolons: 2376 | 2377 | =begin code :allow 2378 | A B> provides a way 2379 | to add inline mark-up to a piece of text. 2380 | =end code 2381 | 2382 | A definition would typically be rendered in italics or C< ... > 2383 | tags and will often be used as a link target for subsequent instances of the 2384 | term (or any of its specified synonyms) within a hypertext. 2385 | 2386 | 2387 | =head3 Example specifiers 2388 | 2389 | Podlite provides markup codes for specifying inline examples of input, 2390 | output, code, and metasyntax: 2391 | 2392 | =begin item 2393 | The C> markup code specifies that the contained text is 2394 | B; that is: something that a program might print out. 2395 | Such content would typically be rendered in a T or with 2396 | C< ... > tags. The contents of a C> code are always 2397 | L (as if they had an implicit 2398 | C> around them). The C> code is the inline equivalent of the 2399 | C<=output> block. 2400 | =end item 2401 | 2402 | =begin item 2403 | The C> markup code specifies that the contained text is 2404 | B; that is: something that a user might type in. Such 2405 | content would typically be rendered in a K (preferably a 2406 | different font from that used for the C> markup code) or with 2407 | C< ... > tags. The contents of a C> code are always 2408 | L. The C> code is the 2409 | inline equivalent of the C<=input> block. 2410 | =end item 2411 | 2412 | =begin item 2413 | The C> markup code specifies that the contained text is B; 2414 | that is, something that might appear in a program or specification. Such 2415 | content would typically be rendered in a C (preferably 2416 | a different font from that used for the C> or C> markup 2417 | codes) or with C< ... > tags. The contents of a C> code 2418 | are L and L. 2419 | The C> code is the inline equivalent of the C<=code> block. 2420 | 2421 | To include other markup codes in a C> code, the code can be lexically 2422 | L: 2423 | 2424 | =begin code :allow 2425 | =begin para 2426 | B<=config C<> :allow> 2427 | Raku makes extensive use of the C>> and C>> 2428 | characters, for example, in a hash look-up: 2429 | C<%hashB>>keyB>>> 2430 | =end para 2431 | =end code 2432 | 2433 | To enable entities in I C>, place a C<=config C<> :allow> 2434 | at the top of the document. 2435 | =end item 2436 | 2437 | =begin item 2438 | The C> markup code specifies that the contained text is a 2439 | B, placeholder, or metasyntactic variable. It is 2440 | used to indicate a component of a syntax or specification that should 2441 | eventually be replaced by an actual value. For example: 2442 | 2443 | =begin code :allow 2444 | The basic C command is: C B R> 2445 | =end code 2446 | 2447 | or: 2448 | 2449 | =begin code :allow 2450 | Then enter your details at the prompt: 2451 | =for input 2452 | Name: B> 2453 | ID: B> 2454 | Pass: B> 2455 | =end code 2456 | 2457 | Typically replaceables would be rendered in R or with 2458 | C< ... > tags. The font used should be the same as that used for 2459 | the C> code, unless the C> is inside a C> or C> code (or 2460 | the equivalent C<=input> or C<=output> blocks), in which case their 2461 | respective fonts should be used. 2462 | =end item 2463 | 2464 | 2465 | =head3 Verbatim text 2466 | 2467 | The C> markup code treats its entire contents as being B, 2468 | disregarding every apparent markup code within it. For example: 2469 | 2470 | The B >> markup code disarms other codes 2471 | such as V< I<>, C<>, B<>, and M<> >. 2472 | 2473 | Note that the C> code only changes the way its 2474 | contents are parsed, I the way they are rendered. That is, the 2475 | contents are still wrapped and formatted like plain text, and the 2476 | effects of any markup codes surrounding the C> code 2477 | are still applied to its contents. For example, the previous example 2478 | is rendered: 2479 | 2480 | =nested 2481 | The B >> markup code disarms other codes 2482 | such as V< I<>, C<>, B<>, and M<> >. 2483 | 2484 | You can prespecify markup codes that remain active within 2485 | a C> code, using the L|#Formatting within code blocks> 2486 | option. 2487 | 2488 | 2489 | =head3 Inline comments 2490 | 2491 | The C> markup code indicates that its contents constitute a 2492 | B, which should not be rendered by any renderer. 2493 | For example: 2494 | 2495 | =begin code :allow 2496 | The "exeunt" command B> is used 2497 | to quit all applications. 2498 | =end code 2499 | 2500 | In certain scenarios, the C> code is used to break up text that 2501 | would otherwise be considered mark-up: 2502 | 2503 | =begin code :allow 2504 | In certain scenarios, the ZB><> code is used to break up text that 2505 | would otherwise be considered mark-up. 2506 | =end code 2507 | 2508 | That technique still works, but it's now easier to accomplish the same goal 2509 | using a verbatim markup code: 2510 | 2511 | =begin code :allow 2512 | In certain scenarios, the B«V>>» code is used to break up text that 2513 | would otherwise be considered mark-up. 2514 | =end code 2515 | 2516 | Moreover, the C> code automatically treats its contents as being 2517 | verbatim, which often eliminates the need for the C> as well: 2518 | 2519 | =begin code :allow 2520 | In certain scenarios, the B«V>>» code was widely used to break up text 2521 | that would otherwise be considered mark-up. 2522 | =end code 2523 | 2524 | The C> markup code is the inline equivalent of a 2525 | L block|#Comments>. 2526 | 2527 | 2528 | =head3 Links 2529 | 2530 | The C> code is used to specify all kinds of links, filenames, citations, 2531 | and cross-references (both internal and external). 2532 | 2533 | A link specification consists of a I terminated by a 2534 | colon, followed by an I (in the scheme's preferred 2535 | syntax), followed by an I (again, in the scheme's syntax). 2536 | All three components are optional, though at least one must be present in 2537 | any link specification. 2538 | 2539 | Usually, in schemes where an internal address makes sense, it will be 2540 | separated from the preceding external address by a C<#>, unless the 2541 | particular addressing scheme requires some other syntax. When new 2542 | addressing schemes are created specifically for Podlite, it is strongly 2543 | recommended that C<#> be used to mark the start of internal addresses. 2544 | 2545 | Standard schemes include: 2546 | 2547 | =begin defn 2548 | C and C 2549 | 2550 | A standard web URL. For example: 2551 | 2552 | =begin code :allow 2553 | This module needs the LAME library 2554 | (available from L>) 2555 | =end code 2556 | 2557 | If the link does not start with C it is treated as being relative to 2558 | the location of the current document: 2559 | 2560 | =begin code :allow 2561 | See also: L> and 2562 | L> 2563 | =end code 2564 | 2565 | =end defn 2566 | 2567 | =begin defn 2568 | C 2569 | 2570 | A filename on the local system. For example: 2571 | 2572 | =begin code :allow 2573 | Next, edit the global config file (that is, either 2574 | L> or L>). 2575 | =end code 2576 | 2577 | Filenames that don't begin with a C or a C<~> are relative 2578 | to the current document's location: 2579 | 2580 | =begin code :allow 2581 | Then, edit the local config file (that is, either 2582 | L> or L>. 2583 | =end code 2584 | 2585 | =end defn 2586 | 2587 | =begin defn 2588 | C 2589 | 2590 | An email address. Typically, activating this type of link invokes a mailer. 2591 | For example: 2592 | 2593 | =begin code :allow 2594 | Please forward bug reports to L> 2595 | =end code 2596 | 2597 | =end defn 2598 | 2599 | =begin defn 2600 | C 2601 | 2602 | A link to the system manpages. For example: 2603 | 2604 | =begin code :allow 2605 | This module implements the standard 2606 | Unix L> facilities. 2607 | =end code 2608 | 2609 | =end defn 2610 | 2611 | =begin defn 2612 | C 2613 | 2614 | A link to other documents by utilizing semantic blocks 2615 | such as C<=TITLE> or C<=NAME> as anchor points for these links. 2616 | 2617 | For example: 2618 | 2619 | =begin code :allow 2620 | B<=NAME Dumper> 2621 | 2622 | You may wish to use L> to 2623 | view the results. 2624 | =end code 2625 | 2626 | Moreover, the C scheme allows the use of an C<:id> attribute within 2627 | the C<=TITLE> or C<=NAME> blocks to create unique identifiers for document 2628 | linking. This ensures precision in navigation, as each identifier 2629 | corresponds to a specific part of the document set. An example would be: 2630 | 2631 | =begin code :allow 2632 | =for TITLE :id 2633 | The Specification of Podlite 2634 | 2635 | ... 2636 | 2637 | Read the L. 2638 | 2639 | ... 2640 | =end code 2641 | 2642 | When Podlite processes a link, it can automatically use the document's title 2643 | from the C<=TITLE> or C<=NAME> blocks as the display text for the hyperlink if no 2644 | explicit text is provided. For example: 2645 | 2646 | =begin code :allow 2647 | 2648 | =for TITLE :id 2649 | The Specification of Podlite 2650 | 2651 | =para 2652 | Please read "B>". 2653 | 2654 | =end code 2655 | 2656 | ... will be rendered as: 2657 | 2658 | =begin code :allow 2659 | 2660 | Please read "B". 2661 | 2662 | =end code 2663 | 2664 | =end defn 2665 | 2666 | =begin defn 2667 | C 2668 | 2669 | A link to the L or L 2670 | definition of the specified term within the current document. For example: 2671 | 2672 | =begin code :allow 2673 | He was highly prone to B>: an unfortunate proclivity 2674 | for employing grandiloquisms (for example, words such as "proclivity", 2675 | "grandiloquism", and indeed "lexiphania"). 2676 | 2677 | B<=defn glossoligation> 2678 | Restraint of the tongue (voluntary or otherwise) 2679 | =end code 2680 | 2681 | and later, to link back to the definition: 2682 | 2683 | =begin code :allow 2684 | To treat his chronic L> the doctor prescribed an 2685 | immediate L> or, if that proved ineffective, 2686 | a complete cephalectomy. 2687 | =end code 2688 | 2689 | =end defn 2690 | 2691 | =begin defn 2692 | C and C 2693 | 2694 | The International Standard Book Number or International Standard 2695 | Serial Number for a publication. For example: 2696 | 2697 | =begin code :allow 2698 | The Perl Journal was a registered 2699 | serial publication (L>) 2700 | =end code 2701 | 2702 | =end defn 2703 | 2704 | To refer to a specific section within a webpage, manpage, or Podlite 2705 | document, add the name of that section after the main link, separated by 2706 | a C<#>. For example: 2707 | 2708 | =begin code :allow 2709 | Also see: L>, 2710 | L>, and 2711 | L> 2712 | =end code 2713 | 2714 | To refer to a section of the current document, omit the external address: 2715 | 2716 | =begin code :allow 2717 | This mechanism is described under L> below. 2718 | =end code 2719 | 2720 | The scheme name may also be omitted in that case: 2721 | 2722 | =begin code :allow 2723 | This mechanism is described under L> below. 2724 | =end code 2725 | 2726 | Podlite includes the possibility of assigning a unique identifier to a block. 2727 | These identifiers can be explicitly assigned to any blocks using 2728 | the C<:id> attribute. Later, these identifiers are utilized for addressing blocks 2729 | and creating links. 2730 | 2731 | =begin code :allow 2732 | =for head1 :id 2733 | Introduction 2734 | =for para B<:id> 2735 | This is an introductory paragraph. 2736 | 2737 | For more information, see L> and L> 2738 | =end code 2739 | 2740 | In this example, the link reference to the header block identified by "intro" 2741 | rather than the name "Introduction" and to the paragrapth block with identifier "id1". 2742 | 2743 | Normally a link is presented as some rendered version of the link 2744 | specification itself. However, you can specify an alternate 2745 | presentation by prefixing the link with the desired text and a 2746 | vertical bar. Whitespace is not significant on either side of the bar. 2747 | For example: 2748 | 2749 | =begin code :allow 2750 | This module needs the Lhttp://www.mp3dev.org/mp3/>. 2751 | 2752 | You could also write the code 2753 | L doc:Lingua::Romana::Perligata> 2754 | 2755 | His Ldefn:lexiphania>> tendencies were, alas, incurable. 2756 | =end code 2757 | 2758 | 2759 | =head3 Contextual backlinks 2760 | 2761 | Podlite introduces the concept of contextual backward links C> (or contextual backlinks), 2762 | enhancing the traditional L mechanism by allowing to not 2763 | only reference another location but also provide specific 2764 | context around that reference. This context can take the form of opinions, 2765 | additional information, or any relevant commentary that enhances the understanding 2766 | of the referenced material. 2767 | 2768 | For example: 2769 | 2770 | =begin code :allow 2771 | This text can reveal the meaning of B> 2772 | =end code 2773 | 2774 | or: 2775 | 2776 | =begin code :allow 2777 | We discuss here about B>. 2778 | =end code 2779 | 2780 | Contextual backlinks on the destination page can be displayed in various ways. 2781 | They may appear with surrounding text chunks, providing context within 2782 | the flow of the content. Alternatively, they can be placed at the end 2783 | of the text, in the margin of the page, or highlighted in other visually 2784 | distinctive ways. 2785 | 2786 | Like traditional L, contextual backlinks allows the use of 2787 | all available link schemes, including C and C, to link to external content. 2788 | 2789 | Contextual backlinks might be visually distinguished from 2790 | standard links through color coding. 2791 | 2792 | 2793 | =head3 Alias placements 2794 | 2795 | The C> code is replaced by the contents of the named alias or object 2796 | specified within its delimiters. 2797 | For example: 2798 | 2799 | =begin code 2800 | =alias PROGNAME Earl Irradiatem Eventually 2801 | =alias VENDOR 4D Kingdoms 2802 | =alias TERMS_URL L 2803 | 2804 | The use of A is subject to the terms and conditions 2805 | laid out by A, as specified at A. 2806 | =end code 2807 | 2808 | See L<#Aliases> for further details of the aliasing macro mechanism. 2809 | 2810 | 2811 | =head3 Space-preserving text 2812 | 2813 | Any text enclosed in an C> code is formatted normally, except that 2814 | every whitespace character in itEincluding any newlineEis 2815 | preserved. These characters are also treated as being non-breaking 2816 | (except for the newlines, of course). For example: 2817 | 2818 | The emergency signal is: S< 2819 | dot dot dot dash dash dash dot dot dot>. 2820 | 2821 | would be formatted like so: 2822 | 2823 | =nested 2824 | The emergency signal is:E<0x85> 2825 | dotEdotEdotEEEdashEdashEdashEEEEdotEdotEdot. 2826 | 2827 | rather than: 2828 | 2829 | =nested 2830 | The emergency signal is: dot dot dot dash dash dash dot dot dot. 2831 | 2832 | 2833 | =head3 Entities 2834 | 2835 | To include Unicode code points or HTML5 character references in a 2836 | Podlite document, specify the required D using the C> code. 2837 | 2838 | If the C> contains a number, that number is treated as the decimal 2839 | Unicode value for the desired code point. For example: 2840 | 2841 | Podlite makes considerable use of E<171> and E<187>. 2842 | 2843 | You can also use explicit binary, octal, decimal, or hexadecimal numbers: 2844 | 2845 | Podlite makes considerable use of E<0b10101011> and E<0b10111011>. 2846 | Podlite makes considerable use of E<0o253> and E<0o273>. 2847 | Podlite makes considerable use of E<0d171> and E<0d187>. 2848 | Podlite makes considerable use of E<0xAB> and E<0xBB>. 2849 | 2850 | If the C> contains anything that is not a number, the contents are 2851 | interpreted as a Unicode character name (which is always uppercase), or 2852 | else as an HTML5 named character reference. For example: 2853 | 2854 | Podlite makes considerable use of E 2855 | and E. 2856 | 2857 | or, equivalently: 2858 | 2859 | Podlite makes considerable use of E and E. 2860 | 2861 | To include emoji codes, you can use the C> code along 2862 | with the colon-prefixed and postfix emoji shortname: 2863 | 2864 | Podlite uses emoji codes to express emotions and actions, 2865 | such as E<:thumbsup:> for approval and E<:smile:> for happiness. 2866 | 2867 | In this example, C<:smile:> and C<:thumbsup:> are emoji codes representing 2868 | the respective emojis. You can use any valid emoji code in this format 2869 | to include emojis in your Podlite document. 2870 | 2871 | Note that the specific emoji codes and the emojis they represent may vary 2872 | depending on the platform or system you are using. 2873 | 2874 | Multiple consecutive entities (in any format) can be specified in a 2875 | single C> code, separated by semicolons: 2876 | 2877 | Podlite makes considerable use of E. 2878 | 2879 | 2880 | =head3 Indexing terms 2881 | 2882 | Anything enclosed in an C> code is an B. The contents 2883 | of the code are both formatted into the document and used as the 2884 | (case-insensitive) index entry: 2885 | 2886 | =begin code :allow 2887 | An B> is an ordered list of scalars indexed by number, 2888 | starting with 0. A B> is an unordered collection of scalar 2889 | values indexed by their associated string key. 2890 | =end code 2891 | 2892 | An index entry where the indexed text and the index entry differ can be specified 2893 | by separating the two with a vertical bar: 2894 | 2895 | =begin code :allow 2896 | An B> is an ordered list of scalars indexed by number, 2897 | starting with 0. A B> is an unordered collection of 2898 | scalar values indexed by their associated string key. 2899 | =end code 2900 | 2901 | In the two-part form, the index entry comes after the bar and is 2902 | case-sensitive. 2903 | 2904 | Hierarchical index entries can be specified by separating indexing levels 2905 | with commas: 2906 | 2907 | =begin code :allow 2908 | An X> is an ordered list of scalars 2909 | indexed by number, starting with 0. A X> 2910 | is an unordered collection of scalar values indexed by their 2911 | associated string key. 2912 | =end code 2913 | 2914 | Multiple entries for a single indexed text can be specified by separating 2915 | the entries with semicolons: 2916 | 2917 | =begin code :allow 2918 | A X> 2919 | is an unordered collection of scalar values indexed by their 2920 | associated string key. 2921 | =end code 2922 | 2923 | The indexed text can be empty, creating a "zero-width" index entry: 2924 | 2925 | =begin code :allow 2926 | B>This is called the "Orcish Manoeuvre" 2927 | because you "OR" the "cache". 2928 | =end code 2929 | 2930 | 2931 | =head3 Annotations 2932 | 2933 | Anything enclosed in an C> code is an inline B. 2934 | For example: 2935 | 2936 | =begin code :allow 2937 | Space stations feature hydroponic gardens B>, a necessity for long-term missions. 2939 | =end code 2940 | 2941 | Renderers may present such annotations in various ways: as 2942 | footnotes, endnotes, sidebars, pop-ups, tooltips, or 2943 | expandable tags. They are never rendered as unmarked 2944 | inline text. The previous example might be rendered as: 2945 | 2946 | =nested 2947 | Space stations feature hydroponic gardens E, a necessity for 2948 | long-term missions. 2949 | and later: 2950 | 2951 | =begin nested 2952 | B 2953 | 2954 | =para 2955 | E Plants grow without soil, using mineral nutrient solutions. 2956 | =end nested 2957 | 2958 | 2959 | =for head3 :id('Custom markup codes') 2960 | Module-defined handler for extends markup features 2961 | 2962 | The C> code in Podlite extends the language's capabilities by allowing users 2963 | to specify additional processing instructions within their documents. 2964 | This is achieved by combining content text with a custom plug-in specifier, 2965 | followed by optional configuration information that is passed to a handler function. 2966 | 2967 | The structure of the C> markup code as follows: 2968 | 2969 | M< CONTENT-TEXT| R R> 2970 | 2971 | This syntax includes C section, followed by a 2972 | name specifier C and then the C 2973 | (see L<"Configuration syntax options"|#configuration_syntax>). 2974 | The name specifier should follow the same rules as for 2975 | L. 2976 | 2977 | The C> formatting code is the inline equivalent of a 2978 | L. 2979 | 2980 | An example of how this code might be used is : 2981 | 2982 | =for code :allow 2983 | B«M<» This text is highlighted in yellow B«|Marker :color('yellow') >». 2984 | 2985 | In this example, the text C<"This text is highlighted in yellow"> is subject 2986 | to special handling specified by the C module and 2987 | C<:color('yellow')>, indicating that the text should be highlighted in yellow. 2988 | 2989 | If the C is unrecognized, the content text C should be 2990 | rendered as ordinary text. This ensures that documents remain readable even 2991 | if specific processing instructions cannot be executed. The renderer could provide 2992 | an unobtrusive yet informative error message, explaining that the custom 2993 | markup block could not be processed. 2994 | 2995 | 2996 | =head2 Block pre-configuration 2997 | 2998 | The C<=config> directive allows you to prespecify standard configuration 2999 | information that is applied to every block of a particular type. 3000 | 3001 | =begin code 3002 | 3003 | =config code :lang :allow 3004 | =config head1 :numbered 3005 | =config head2 :folded 3006 | 3007 | =end code 3008 | 3009 | Here, two configurations are outlined. The first one sets 3010 | the language for code blocks to C and allows bold markup. 3011 | The second establishes that all level 1 headings will be numbered. 3012 | 3013 | The general syntax for configuration directives is: 3014 | 3015 | =begin code :allow< R > 3016 | =config R R 3017 | = R 3018 | =end code 3019 | 3020 | A C<=config> is a directive, not a block. Hence, 3021 | there is no paragraph or delimited form of the C<=config> directive. 3022 | Each C<=config> specification is lexically scoped to the surrounding 3023 | block or file in which it is specified. 3024 | 3025 | Note that, if a particular block later explicitly specifies a 3026 | configuration option with the same key, that option overrides the 3027 | pre-configured option. For example, given the code blocks configurations in the 3028 | previous example, to specify another language for code block: 3029 | 3030 | =begin code 3031 | =for code :lang 3032 | print(JSON.stringify([1,2]])); 3033 | =end code 3034 | 3035 | 3036 | =head3 Pre-configuring markup codes 3037 | 3038 | You can also lexically preconfigure a L, 3039 | by naming it with a pair of angles as a suffix. For example: 3040 | 3041 | =begin code :allow 3042 | =comment Always allow E<> codes in any (implicit or explicit) V<> code... 3043 | B«=config V<> :allow» 3044 | =comment All inline code allows I<> 3045 | B«=config C<> :allow» 3046 | =end code 3047 | 3048 | Note that, even though the markup code is named using single-angles, 3049 | the preconfiguration applies regardless of the actual delimiters used on 3050 | subsequent instances of the code. 3051 | 3052 | 3053 | =head2 Aliases 3054 | 3055 | The C<=alias> directive provides a way to define lexically scoped 3056 | synonyms for longer Podlite sequences, (meta)object declarators from the 3057 | code, or even entire chunks of ambient source. These synonyms can then 3058 | be inserted into subsequent Podlite using the 3059 | L markup code>|#Alias placements>. 3060 | 3061 | Note that C<=alias> is a fundamental Podlite directive, like C<=begin> or 3062 | C<=for>; there are no equivalent paragraph or delimited forms. 3063 | 3064 | Macro aliases are lexically scoped to the surrounding Podlite block. 3065 | 3066 | The simplest form of alias takes two arguments. The first is an 3067 | identifier (which is usually specified in uppercase, though this is 3068 | certainly not mandatory). The second argument consists of one or more 3069 | lines of replacement text. 3070 | 3071 | This creates a lexically scoped Podlite macro that can be invoked during 3072 | document generation by placing the identifier (i.e. the first argument 3073 | of the alias) in an C> markup code. This markup code is then 3074 | replaced by the text returned by new macro. 3075 | 3076 | The replacement text returned by the alias macro begins at the first 3077 | non-whitespace character after the alias's identifier and continues to 3078 | the end of the line. The replacement text can extend over multiple 3079 | lines by starting each following line with an C<=> (at the same level 3080 | of indentation as the C<=alias> directive itself) followed by at least 3081 | one whitespace. Each additional line uses the original 3082 | line's (virtual) left margin, as specified by the indentation of the 3083 | replacement text on the C<=alias> line. 3084 | 3085 | For example: 3086 | 3087 | =begin code 3088 | =alias PROGNAME Earl Irradiatem Evermore 3089 | =alias VENDOR 4D Kingdoms 3090 | =alias TERMS_URLS =item L 3091 | = =item L 3092 | = =item L 3093 | 3094 | The use of A is subject to the terms and conditions 3095 | laid out by A, as specified at: 3096 | 3097 | A 3098 | 3099 | =end code 3100 | 3101 | This would produce: 3102 | 3103 | =begin para :nested 3104 | The use of Earl Irradiatem Evermore is subject to the terms and 3105 | conditions laid out by 4D Kingdoms Inc, as specified at: 3106 | 3107 | =item L 3108 | =item L 3109 | =item L 3110 | 3111 | =end para 3112 | 3113 | The advantage of using aliases is that the same alias can be 3114 | reused in multiple places in the documentation. If the replacement 3115 | text needs to be changed, it requires modification in only a single place: 3116 | 3117 | =begin code 3118 | =alias PROGNAME Count Krunchem Constantly 3119 | =alias VENDOR Last Chance Receivers Intl 3120 | =alias TERMS_URLS L 3121 | =end code 3122 | 3123 | 3124 | =head2 Notification blocks 3125 | 3126 | These blocks, often referred to as admonitions, callouts, or alerts, 3127 | serve to draw attention to different types of content, 3128 | such as tips, warnings, or important notes. 3129 | 3130 | To create specially formatted blocks highlighting information in Podlite, 3131 | the C<=nested> block and C<:notice> attribute are used. 3132 | 3133 | For example: 3134 | 3135 | =begin code :allow 3136 | B<=begin nested> B<:notify> 3137 | Remember to always use oven mitts when handling hot bakeware 3138 | to prevent burns. 3139 | B<=end nested> 3140 | =end code 3141 | 3142 | Below is a table outlining the different types of notification blocks 3143 | along with a brief description of each type. 3144 | 3145 | =begin table :caption<"Types of Notification blocks"> 3146 | 3147 | Type Description 3148 | ---------- ------------------------------------------------------ 3149 | note Provides additional information and context without 3150 | interrupting the flow of the main content 3151 | 3152 | tip Offers advice for doing things better or more easily 3153 | 3154 | important Signifies that the information is crucial for 3155 | understanding or success 3156 | 3157 | warning Indicates urgent information that requires immediate 3158 | attention to avoid potential problems 3159 | 3160 | caution Advises readers about potential negative outcomes or 3161 | risks associated with certain actions 3162 | 3163 | =end table 3164 | 3165 | =begin comment 3166 | TODO: 3167 | custom (e.g. `faq`, etc.)??? Allows for specifying the specific context or content. 3168 | 3169 | =begin nested :caption<"Foldable FAQ: Question 1"> :notice :folded 3170 | This is how you make content foldable for a cleaner look. 3171 | =end nested 3172 | 3173 | =end comment 3174 | 3175 | By default, the title of the notification block is its type identifier in title case. 3176 | The title of the block and visibility of the information can be customized 3177 | using the C<:caption> and C<:folded> options. 3178 | 3179 | =begin code :allow 3180 | =begin nested B<:caption<"Astronaut's Reminder">> :notify B<:folded> 3181 | Space missions require meticulous planning and adherence to safety protocols. 3182 | Neglecting these can lead to mission failure or, worse, endanger lives. 3183 | =end nested 3184 | =end code 3185 | 3186 | Title-only callouts can be created by omitting the body. 3187 | 3188 | =begin code 3189 | =for nested :notify :folded :caption<"Title-only callout"> 3190 | =end code 3191 | 3192 | Notification blocks are displayed with distinctive colors and 3193 | icons that indicate the significance of the content. 3194 | 3195 | =begin SUMMARY 3196 | 3197 | =head2 Directives 3198 | =begin table :nested 3199 | 3200 | Directive Specifies 3201 | _________ ____________________________________________________ 3202 | C<=begin> Start of an explicitly terminated block 3203 | C<=config> Lexical modifications to a block or markup code 3204 | C<=end> Explicit termination of a C<=begin> block 3205 | C<=for> Start of an implicitly (blank-line) terminated block 3206 | C<=alias> Define a Podlite macro 3207 | 3208 | =end table 3209 | 3210 | 3211 | =head2 Blocks 3212 | =begin table :nested 3213 | 3214 | Block typename Specifies 3215 | _______________ ____________________________________________________ 3216 | C<=code> Verbatim pre-formatted sample source code 3217 | C<=comment> Content to be ignored by all renderers 3218 | C<=defn> Definition of a term 3219 | C<=head>R Ith-level heading 3220 | C<=input> Pre-formatted sample input 3221 | C<=item> First-level list item 3222 | C<=item>R Ith-level list item 3223 | C<=nested> Nested block contents within the current context 3224 | C<=output> Pre-formatted sample output 3225 | C<=para> Ordinary paragraph 3226 | C<=pod> No "ambient" blocks inside 3227 | C<=table> Simple rectangular table 3228 | C<=data> Data section 3229 | C<=toc> Autogenerated table of contents 3230 | C<=include> Include other blocks or documents 3231 | C<=picture> Insert pictures 3232 | C<=formula> Mathematical formulas 3233 | C<=markdown> Markdown support 3234 | C<=>R Semantic blocks (C<=SYNOPSIS>, C<=BUGS>, etc.) 3235 | C<=>R User-defined block 3236 | 3237 | =end table 3238 | 3239 | =head2 Inline markup codes 3240 | =config C<> :allow 3241 | =begin table :nested 3242 | 3243 | Formatting code Specifies 3244 | ___________________ ___________________________________________________ 3245 | C> Replaced by contents of specified macro/object 3246 | C> Basis/focus of sentence (typically rendered bold) 3247 | C> Code (typically rendered fixed-width) 3248 | C> Definition (C|R;R;...>>) 3249 | C> Entity names or numeric codepoints (C;R;...>>), emoji 3250 | C> Mathematical formula 3251 | C> Reserved 3252 | C> Superscript 3253 | C> Important (typically rendered in italics) 3254 | C> Subscript 3255 | C> Keyboard input (typically rendered fixed-width) 3256 | C> Link (C|R>>) 3257 | C> Module-defined code (C:R>>) 3258 | C> Note (not rendered inline) 3259 | C> Strikethrough 3260 | C> Inline eqivalent for C<=picture> block 3261 | C> reserved 3262 | C<...>> Replaceable component or metasyntax 3263 | C> Space characters to be preserved 3264 | C> Terminal output (typically rendered fixed-width) 3265 | C> Unusual (typically rendered with underlining) 3266 | C«V<...>» Verbatim (internal markup codes ignored) 3267 | C> Contextual backlinks 3268 | C> Index entry (C|R,R;...>>) 3269 | C> Reserved 3270 | C> Zero-width comment (contents never rendered) 3271 | 3272 | =end table 3273 | 3274 | =end SUMMARY 3275 | 3276 | =LICENSE Artistic license 2.0 3277 | 3278 | =end pod 3279 | -------------------------------------------------------------------------------- /assets/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | All assets in this directory including, but not limited to, logos, icons 3 | and images are copyright © 2019-2024 by Aliaksandr Zahatski, all rights reserved. 4 | 5 | Content in this directory is licensed under a Creative Commons Attribution 4.0 International license. 6 | 7 | Under the terms of this license, you must include an attribution to the Podlite project, with a link (https://podlite.org/), if you display these logos or derivates thereof. 8 | 9 | https://creativecommons.org/licenses/by/4.0/ 10 | 11 | -------------------------------------------------------------------------------- /assets/bigtitle-social-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/podlite/podlite-specs/ebe3c42a2306892887c8d812b67a261e84c1acc7/assets/bigtitle-social-logo.png -------------------------------------------------------------------------------- /assets/podlite_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/podlite/podlite-specs/ebe3c42a2306892887c8d812b67a261e84c1acc7/assets/podlite_logo.pdf -------------------------------------------------------------------------------- /assets/podlite_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/podlite/podlite-specs/ebe3c42a2306892887c8d812b67a261e84c1acc7/assets/podlite_logo.png -------------------------------------------------------------------------------- /assets/podlite_logo_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/podlite/podlite-specs/ebe3c42a2306892887c8d812b67a261e84c1acc7/assets/podlite_logo_256x256.png --------------------------------------------------------------------------------