1Text::WikiFormat::BlockUss(e3rpmC)ontributed Perl DocumeTnetxatt:i:oWnikiFormat::Blocks(3pm)
2
3
4
6 Text::WikiFormat::Blocks - blocktypes for Text::WikiFormat
7
9 None. Use Text::WikiFormat as the public interface, unless you want to
10 create your own block type.
11
13 This module merely creates subclasses of Text::WikiFormat::Block, which
14 is the interesting code. A block is a collection of related lines,
15 such as a code block (text to display verbatim in a monospaced font), a
16 header, an unordered list, an ordered list, and a paragraph (text to
17 display in a proportional font).
18
19 Every block extends "Text::WikiFormat::Block".
20
22 The following methods exist:
23
24 • new( %args )
25
26 Creates and returns a new block. The valid arguments are:
27
28 • "text"
29
30 The text of the line found in the block.
31
32 • "args"
33
34 The arguments captured by the block-identifying regular
35 expression.
36
37 • "level"
38
39 The level of indentation for the block (usually only useful for
40 list blocks).
41
42 • "tags"
43
44 The tags in effect for the current type of wiki formatting.
45
46 • "opts"
47
48 The options in effect for the current type of wiki formatting.
49
50 Use the accessors of the same names to retrieve the values of the
51 attributes.
52
53 • add_text( @lines_of_text )
54
55 Adds a list of lines of text to the current text for the block.
56 This is very useful when you encounter a block and want to merge it
57 with the previous block of the same type
58
59 • add_args( @arguments )
60
61 Adds further arguments to the block; useful when merging blocks.
62
63 • formatted_text()
64
65 Returns text formatted appropriately for this block. Blocks don't
66 have to have formatters, but they may.
67
68 • formatter( $line_of_text )
69
70 Formats the $line using Text::WikiFormat::format_line(). You can
71 add your own formatter here; this is worth overriding.
72
73 • merge( $next_block )
74
75 Merges the current block with $next_block (the next block
76 encountered) if they're of the same type and are at the same level.
77 This adds the text and args of $next_block to the current block.
78 It's your responsibility to remove $next_block from whatever your
79 code iterates over.
80
81 • nests()
82
83 Returns true if this block should nest (as in lists and unordered
84 lists) for the active wiki formatting.
85
86 • nest( $next_block )
87
88 Nests $next_block under this block if the both nest and if
89 $next_block has a level greater than the current block. This
90 actually adds $next_block as a text item within the current block.
91 Beware.
92
94 chromatic, "chromatic at wgz dot org"
95
97 No known bugs.
98
100 Copyright (c) 2006, chromatic. Some rights reserved.
101
102 This module is free software; you can use, redistribute, and modify it
103 under the same terms as Perl 5.8.x.
104
105
106
107perl v5.38.0 2023-07-21 Text::WikiFormat::Blocks(3pm)