Aion-Format
view release on metacpan or search on metacpan
## nous ($templates)
A simplified regex language for text recognition in HTML documents.
1. All spaces from the beginning and end are removed.
2. From the beginning of each line, 4 spaces or 0-3 spaces and a tab are removed.
3. Spaces at the end of the line and whitespace lines are replaced with `\s*`. 4. All variables in `{{ var }}` are replaced with `.*?`. Those. recognize everything.
4. All variables in `{{> var }}` are replaced with `[^<>]*?`. Those. do not recognize html tags.
4. All variables in `{{: var }}` are replaced with `[^\n]*`. Those. must be on the same line.
5. Expressions in double square brackets (`[[ ... ]]`) may not exist.
5. Double parentheses (`(( ... ))`) are used as parentheses. 5. `||` - or.
```perl
my $re = nous [
q{
<body>
<center>
<h2><a href={{> author_link }}>{{: author_name }}</a><br>
{{ title }}</h2>
},
q{
lib/Aion/Format.md view on Meta::CPAN
## nous ($templates)
A simplified regex language for text recognition in HTML documents.
1. All spaces from the beginning and end are removed.
2. From the beginning of each line, 4 spaces or 0-3 spaces and a tab are removed.
3. Spaces at the end of the line and whitespace lines are replaced with `\s*`. 4. All variables in `{{ var }}` are replaced with `.*?`. Those. recognize everything.
4. All variables in `{{> var }}` are replaced with `[^<>]*?`. Those. do not recognize html tags.
4. All variables in `{{: var }}` are replaced with `[^\n]*`. Those. must be on the same line.
5. Expressions in double square brackets (`[[ ... ]]`) may not exist.
5. Double parentheses (`(( ... ))`) are used as parentheses. 5. `||` - or.
```perl
my $re = nous [
q{
<body>
<center>
<h2><a href={{> author_link }}>{{: author_name }}</a><br>
{{ title }}</h2>
},
q{
lib/Aion/Format.pm view on Meta::CPAN
=item 2. From the beginning of each line, 4 spaces or 0-3 spaces and a tab are removed.
=item 3. Spaces at the end of the line and whitespace lines are replaced with C<\s*>. 4. All variables in C<{{ var }}> are replaced with C<.*?>. Those. recognize everything.
=item 4. All variables in C<< {{E<gt> var }} >> are replaced with C<< [^E<lt>E<gt>]*? >>. Those. do not recognize html tags.
=item 5. All variables in C<{{: var }}> are replaced with C<[^\n]*>. Those. must be on the same line.
=item 6. Expressions in double square brackets (C<[[ ... ]]>) may not exist.
=item 7. Double parentheses (C<(( ... ))>) are used as parentheses. 5. C<||> - or.
=back
my $re = nous [
q{
<body>
<center>
<h2><a href={{> author_link }}>{{: author_name }}</a><br>
{{ title }}</h2>
},
t/aion/format.t view on Meta::CPAN
# ## nous ($templates)
#
# A simplified regex language for text recognition in HTML documents.
#
# 1. All spaces from the beginning and end are removed.
# 2. From the beginning of each line, 4 spaces or 0-3 spaces and a tab are removed.
# 3. Spaces at the end of the line and whitespace lines are replaced with `\s*`. 4. All variables in `{{ var }}` are replaced with `.*?`. Those. recognize everything.
# 4. All variables in `{{> var }}` are replaced with `[^<>]*?`. Those. do not recognize html tags.
# 4. All variables in `{{: var }}` are replaced with `[^\n]*`. Those. must be on the same line.
# 5. Expressions in double square brackets (`[[ ... ]]`) may not exist.
# 5. Double parentheses (`(( ... ))`) are used as parentheses. 5. `||` - or.
#
done_testing; }; subtest 'nous ($templates)' => sub {
my $re = nous [
q{
<body>
<center>
<h2><a href={{> author_link }}>{{: author_name }}</a><br>
{{ title }}</h2>
},
q{
( run in 0.546 second using v1.01-cache-2.11-cpan-4d50c553e7e )