App-Mowyw

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

 |   +-foo3
 |
 +-- bar
 |
 +-- baz

The way you do this with mowyw is simple:
create a file called `includes/menu-navigation' and fill it with something
like this:

<div class="menu">
Navigation:
<ul>
	[% item foo <li><a href="foo.html" {{class="#active"}}>foo</a> 
		{{<ul>
			<li><a href="foo1">foo1</a></li>
			<li><a href="foo2">foo2</a></li>
		</ul>}}</li> %]
	[% item bar <li><a href="bar.html" {{class="#active"}}>bar</a></li> %]
	[% item baz <li><a href="baz.html" {{class="#active"}}>baz</a></li> %]
</ul>
</div>

now in your file foo.html, you use the line
[% menu navigation foo %].
This line will be replaced by mowyw with:

<div class="menu">
Navigation:
<ul>
	<li><a href="foo.html" class="#active">foo</a> 
		<ul>
			<li><a href="foo1">foo1</a></li>
			<li><a href="foo2">foo2</a></li>
		</ul></li>
	<li><a href="bar.html" >bar</a></li>
	<li><a href="baz.html" >baz</a></li>
</ul>
</div>

Each menu item looks like this: [% item label1 some_text %]. If it is called as
[% menu label1 %] it will produce some_text, and all double curly brackets {{ }}
are simply stripped, but the text between them remains.
If it is called with a different name, say [% menu label2 %] the curly brackets
and the text between them are stripped.

SYNTAX HILIGHTING

If you have both the Perl module Text::VimColor and Vim installed, you can use
the follwing construct to automagically generate syntax hilighted HTML markup:

<pre>[% syntax perl %]
#!/usr/bin/perl

sub blubb {
	print "This sub only prints this stupid message\n";
}
[% endsyntax %]pre>

If you don't have Text::VimColor installed, the characters '&', '<' and '>'
will still be automatically escaped.

The only argument to 'syntax' is the language that the code is in, if you use
a value that vim doesn't know it will try to guess the language.

The standard CSS classes are:
.synComment    { color: #0000FF }
.synConstant   { color: #FF00FF }
.synIdentifier { color: #008B8B }
.synStatement  { color: #A52A2A ; font-weight: bold }
.synPreProc    { color: #A020F0 }
.synType       { color: #2E8B57 ; font-weight: bold }
.synSpecial    { color: #6A5ACD }
.synUnderlined { color: #000000 ; text-decoration: underline }
.synError      { color: #FFFFFF ; background: #FF0000 none }
.synTodo       { color: #0000FF ; background: #FFFF00 none }

(taken from Text::VimColor)


VERBATIM OUTPUT

If your website includes string like [% or %] etc., you can use the
verbatim-construct to prevent it from parsing:

[% verbatim foobarbaz %]
Things here inbetween will be printed out exactly as they stand here, you can
safely write things like 
"in perl6 [...] returns array refs:
my $a = [2, [4, 5, [8, 9,10]]];"
note that the ']]]' will not cause any harm.
[% endverbatim foobarbaz %]

the name in the verbatim and in the endverbatim-package have to agree exactly
and my consist of alphabetic characters and numbers.

COMMENTS

You can exclude parts entirly from showing up in the output by putting them
inside a comment:
[% comment anything inside here will not show up in the output %]
In a comment everything but ']]]' is allowed.


OMITTING HEADER AND FOOTER

If you include a line like this:
[% option no-header %]
the header is _not_ prepended as usual.
You can achieve the following functionality for the footer with the line
[% option no-footer %]


SETTING AND READING VARIABLES

Suppose you want to add a different <title> to every page, but you want all
your HTML header to be in one specific place.
A way to achive this is with the setvar and readvar constructs. Place this in
your header file:
<html>
	<head><title>[% readvar title %]</title>/head>



( run in 2.126 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )