Skip to content

Commit efa6206

Browse files
author
Chris White
committed
Updated documentation
1 parent ecea601 commit efa6206

File tree

3 files changed

+68
-94
lines changed

3 files changed

+68
-94
lines changed

L1.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,41 @@ XML::Axk::Core::L1 - ack-like XML processor, language 1
1414

1515
# PATTERNS AND ACTIONS
1616

17-
## `on {<matcher>} run {<action>} [, <when>]`
17+
- `on {<matcher>} run {<action>} [, <when>]`
1818

19-
Whenever `<matcher>` says that a node matches, run `<action>`.
20-
The optional `<when>` parameter says when in the course of processing to
21-
run `<action>`:
19+
Whenever `<matcher>` says that a node matches, run `<action>`.
20+
The optional `<when>` parameter says when in the course of processing to
21+
run `<action>`:
2222

23-
- `HI`
23+
- `HI`
2424

25-
When the node is first reached, before any of its children are processed
25+
When the node is first reached, before any of its children are processed
2626

27-
- `BYE`
27+
- `BYE`
2828

29-
After all of the node's children have been processed.
29+
After all of the node's children have been processed.
3030

31-
- `CIAO`
31+
- `CIAO`
3232

33-
Both `HI` and `BYE`. Suggestions for alternative terminology are welcome.
33+
Both `HI` and `BYE`. Suggestions for alternative terminology are welcome.
3434

35-
## `entering`, `whenever` `leaving`
35+
- `entering`, `whenever` `leaving`
3636

37-
entering {<matcher>} run {<action>}
38-
whenever {<matcher>} run {<action>}
39-
leaving {<matcher>} run {<action>}
37+
entering {<matcher>} run {<action>}
38+
whenever {<matcher>} run {<action>}
39+
leaving {<matcher>} run {<action>}
4040

41-
The same as `on {} run {}`, with `when` set to `HI`, `CIAO`, or `BYE`
42-
respectively.
41+
The same as `on {} run {}`, with `when` set to `HI`, `CIAO`, or `BYE`
42+
respectively.
4343

44-
## `perform { <action> } <matcher> [, <when>]`
44+
- `perform { <action> } <matcher> [, <when>]`
4545

46-
If you prefer RPN, or you want to save some characters, you can put the
47-
`<matcher>` after the `<action>` using `perform`. For example,
48-
the following two lines have exactly the same effect:
46+
If you prefer RPN, or you want to save some characters, you can put the
47+
`<matcher>` after the `<action>` using `perform`. For example,
48+
the following two lines have exactly the same effect:
4949

50-
on { xpath(q<//item>) } run {say "$NOW: " . $E->getTagName}, CIAO
51-
perform {say "$NOW: " . $E->getTagName} xpath(q<//item>), CIAO
50+
on { xpath(q<//item>) } run {say "$NOW: " . $E->getTagName}, CIAO
51+
perform {say "$NOW: " . $E->getTagName} xpath(q<//item>), CIAO
5252

5353
# VARIABLES
5454

@@ -67,41 +67,41 @@ that hold the state of the element being matched. This is similar to `$0`,
6767
- **$NOW**
6868

6969
The current phase, as a human-readable string: `entering` for `HI`,
70-
`leaving` for `BYE`, and `BOTH` for `CIAO`.
70+
`leaving` for `BYE`, and `both` for `CIAO`.
7171

7272
# MATCHERS
7373

74-
## `xpath('xpath expression')`
74+
- `xpath('xpath expression')`
7575

76-
Match nodes that match the given XPath expression. Remember that Perl will
77-
interpolate `@name` in double-quotes, so single-quote or `q{}` your XPath
78-
expressions.
76+
Match nodes that match the given XPath expression. Remember that Perl will
77+
interpolate `@name` in double-quotes, so single-quote or `q{}` your XPath
78+
expressions.
7979

80-
## `sel('selector')`
80+
- `sel('selector')`
8181

82-
Match nodes that match the given selector.
82+
Match nodes that match the given selector.
8383

84-
## `always`, `never`
84+
- `always`, `never`
8585

86-
Always or never match, respectively.
86+
Always or never match, respectively.
8787

8888
# SPECIAL ACTIONS
8989

90-
## `pre_all {<block>}`
90+
- `pre_all {<block>}`
9191

92-
Run `<block>` before any file is processed.
92+
Run `<block>` before any file is processed.
9393

94-
## `pre_file {<block>}`
94+
- `pre_file {<block>}`
9595

96-
Run `<block>($filename)` before each file is processed.
96+
Run `<block>($filename)` before each file is processed.
9797

98-
## `post_file {<block>}`
98+
- `post_file {<block>}`
9999

100-
Run `<block>($filename)` after each file is processed.
100+
Run `<block>($filename)` after each file is processed.
101101

102-
## `post_all {<block>}`
102+
- `post_all {<block>}`
103103

104-
Run `<block>` after all files have been processed.
104+
Run `<block>` after all files have been processed.
105105

106106
# AUTHOR
107107

lib/XML/Axk.pm

Lines changed: 6 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ __END__
2828
2929
XML::Axk - ack-like XML processor
3030
31-
=head1 VERSION
32-
33-
Axk version 0.1.1, which includes Core 0.1.0 and App 0.1.0 (or higher).
34-
Numbers follow L<Semantic versioning|https://semver.org>.
35-
3631
=head1 USAGE
3732
3833
use XML::Axk;
@@ -47,52 +42,19 @@ For details about the command-line interface, see L<XML::Axk::App>.
4742
4843
For details about the library interface, see L<XML::Axk::Core>.
4944
50-
=head1 OPTIONS
51-
52-
None yet!
53-
54-
A filename of C<-> represents standard input. To actually process a file
55-
named C<->, you will need to use shell redirection (e.g., C<< axk < - >>).
56-
57-
=head1 AUTHOR
58-
59-
Christopher White, C<cxwembedded at gmail.com>
60-
61-
=head1 BUGS
62-
63-
Please report any bugs or feature requests to C<bug-xml-axk at rt.cpan.org>, or
64-
through the web interface at
65-
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-Axk>. I will be notified,
66-
and then you'll automatically be notified of progress on your bug as I make
67-
changes.
68-
6945
=head1 SUPPORT
7046
7147
You can find documentation for this module with the perldoc command.
7248
73-
perldoc XML::Axk
49+
perldoc XML::Axk::App
50+
perldoc XML::Axk::Core
7451
75-
You can also look for information at:
52+
You can also look for information on the GitHub project page at
53+
L<https://github.com/interpreters/axk>.
7654
77-
=over 4
78-
79-
=item * RT: CPAN's request tracker (report bugs here)
80-
81-
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=XML-Axk>
82-
83-
=item * AnnoCPAN: Annotated CPAN documentation
84-
85-
L<http://annocpan.org/dist/XML-Axk>
86-
87-
=item * CPAN Ratings
88-
89-
L<http://cpanratings.perl.org/d/XML-Axk>
90-
91-
=item * Search CPAN
92-
93-
L<http://search.cpan.org/dist/XML-Axk/>
55+
=head1 AUTHOR
9456
95-
=back
57+
Christopher White, C<cxwembedded at gmail.com>
9658
9759
=head1 LICENSE AND COPYRIGHT
9860

lib/XML/Axk/L1.pm

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ XML::Axk::Core::L1 - ack-like XML processor, language 1
240240
241241
=head1 PATTERNS AND ACTIONS
242242
243-
=head2 C<< on {<matcher>} run {<action>} [, <when>] >>
243+
=over
244+
245+
=item * C<< on {<matcher>} run {<action>} [, <when>] >>
244246
245247
Whenever C<< <matcher> >> says that a node matches, run C<< <action> >>.
246248
The optional C<< <when> >> parameter says when in the course of processing to
@@ -262,7 +264,7 @@ Both C<HI> and C<BYE>. Suggestions for alternative terminology are welcome.
262264
263265
=back
264266
265-
=head2 C<entering>, C<whenever> C<leaving>
267+
=item * C<entering>, C<whenever> C<leaving>
266268
267269
entering {<matcher>} run {<action>}
268270
whenever {<matcher>} run {<action>}
@@ -271,7 +273,7 @@ Both C<HI> and C<BYE>. Suggestions for alternative terminology are welcome.
271273
The same as C<on {} run {}>, with C<when> set to C<HI>, C<CIAO>, or C<BYE>
272274
respectively.
273275
274-
=head2 C<< perform { <action> } <matcher> [, <when>] >>
276+
=item * C<< perform { <action> } <matcher> [, <when>] >>
275277
276278
If you prefer RPN, or you want to save some characters, you can put the
277279
C<< <matcher> >> after the C<< <action> >> using C<perform>. For example,
@@ -280,6 +282,8 @@ the following two lines have exactly the same effect:
280282
on { xpath(q<//item>) } run {say "$NOW: " . $E->getTagName}, CIAO
281283
perform {say "$NOW: " . $E->getTagName} xpath(q<//item>), CIAO
282284
285+
=back
286+
283287
=head1 VARIABLES
284288
285289
When an C<< <action> >> is running, it has access to predefined variables
@@ -299,44 +303,52 @@ The XML element that was matched
299303
=item B<$NOW>
300304
301305
The current phase, as a human-readable string: C<entering> for C<HI>,
302-
C<leaving> for C<BYE>, and C<BOTH> for C<CIAO>.
306+
C<leaving> for C<BYE>, and C<both> for C<CIAO>.
303307
304308
=back
305309
306310
=head1 MATCHERS
307311
308-
=head2 C<< xpath('xpath expression') >>
312+
=over
313+
314+
=item * C<< xpath('xpath expression') >>
309315
310316
Match nodes that match the given XPath expression. Remember that Perl will
311317
interpolate C<@name> in double-quotes, so single-quote or C<q{}> your XPath
312318
expressions.
313319
314-
=head2 C<< sel('selector') >>
320+
=item * C<< sel('selector') >>
315321
316322
Match nodes that match the given selector.
317323
318-
=head2 C<always>, C<never>
324+
=item * C<always>, C<never>
319325
320326
Always or never match, respectively.
321327
328+
=back
329+
322330
=head1 SPECIAL ACTIONS
323331
324-
=head2 C<< pre_all {<block>} >>
332+
=over
333+
334+
=item * C<< pre_all {<block>} >>
325335
326336
Run C<< <block> >> before any file is processed.
327337
328-
=head2 C<< pre_file {<block>} >>
338+
=item * C<< pre_file {<block>} >>
329339
330340
Run C<< <block>($filename) >> before each file is processed.
331341
332-
=head2 C<< post_file {<block>} >>
342+
=item * C<< post_file {<block>} >>
333343
334344
Run C<< <block>($filename) >> after each file is processed.
335345
336-
=head2 C<< post_all {<block>} >>
346+
=item * C<< post_all {<block>} >>
337347
338348
Run C<< <block> >> after all files have been processed.
339349
350+
=back
351+
340352
=head1 AUTHOR
341353
342354
Christopher White, C<cxwembedded at gmail.com>

0 commit comments

Comments
 (0)