SWML::Parser - An SWML text document parser
use SWML::Parser;
$parser = SWML::Parser->new;
$parser->onerror (sub { ... });
$parser->parse_char_string ($string => $doc);
The SWML::Parser
module is an SWML text document parser. SWML is a markup language used in SuikaWiki. The parser converts a string of characters representing an SWML document into a DOM tree.
Following methods are available:
- $parser = SWML::Parser->new
-
Creates a new instance of the SWML parser.
- $parser->onerror ($code)
- $code = $parser->onerror
-
Get or set the error handler. Note that this version of the SWML parser does not report any error at all.
- $parser->parse_char_string ($string, $doc)
-
Parses a character string and constructs a DOM tree.
The first argument, $string, is a character string to be parsed.
The second argument, $doc is a
Document
object to which the parsed result is constructed. Any existing child node is removed before parsing.The
Document
object must be an instance of DOMDocument
interface, implementing the manakai DOM Perl Binding specification. Web::DOM::Document is an example of such DOM implementation.
The module requires Perl 5.8 or later.
- SWML
-
SuikaWiki Markup Language (SWML) <https://suikawiki.github.io/spec-swml/spec/>.
The SuikaWiki project <https://suikawiki.org/>.
Web::DOM::Document in the perl-web-dom package <https://github.com/manakai/perl-web-dom>.
Wakaba <wakaba@suikawiki.org>.
Copyright 2008-2020 Wakaba <wakaba@suikawiki.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.