Permalink
Newer
Older
100644 191 lines (145 sloc) 5.36 KB
1
mowyw - mowyw writes your websites (or: Moritz writes your websites ;-)
2
3
For license of this file see the notice at the end of the file
4
5
moc is an offline CMS, that means it process sources files and generates
6
output files from them, usually HTML files, but php files and others are
7
possible as well (with some limitations though).
8
9
SYNTAX CHANGE
10
-------------
11
Version 0.0.3 and before used only double square brackets
12
(like [[include foo]]), but I noticed that double closing square brackets
13
are part of a typical CDATA declaration in xml files (and xhtml) like this:
14
<style type="text/css">
15
/*<![CDATA[*/
16
CSS Declarations
17
/*]]>*/
18
</style>
19
20
Now tripple square brackets (like [[[include foo]]]) are used.
21
22
23
SHORT HOWTO:
24
-----------
25
26
choose an empty directory, and there create the three directories
27
includes/
28
source/
29
online/
30
31
The `source/' directory contains the source files that will be processed by
32
mowyw. Each file in the `source/' directory is mapped to one file in the
33
`online/' directory. You should not write files into the `online/' directory
34
since they may be deleted or overwritten, and you should not modify existing
35
files in that directory since all changes are lost during the next run.
36
All files that might be included by others (including menus) should be in the
37
`includes' directory.
38
39
Now place a file index.html (or whatever you want it to be called) in the
40
'source/' directory.
41
42
If all your HTML files have a common header/footer, you may want to place them
43
in in the files `includes/header' and `includes/footer'.
44
45
For example `inlcudes/header' may contain
46
47
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
48
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
49
50
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
51
<head>
52
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
53
<link rel="stylesheet" type="text/css" media="screen, projection" href="style.css" />
54
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
55
56
and `inlcudes/footer' may contain
57
58
</body>
59
</html>
60
61
and perhaps an additional footer line to be displayed in all pages.
62
63
Now write some content in the file `source/index.html' and then run mowyw.
64
You should get an output like that:
65
66
Processing File 'source/index.html'... DONE.
67
68
Now point your browser at source/index.html and see if it worked.
69
Files not ending in .html, .htm, .shtml, .xhtml etc. are not processed, just
70
copyied.
71
72
73
INCLUDES:
74
75
So far mowyw didn't do much work for you, it just added header and footer
76
sections to all html files.
77
But it can do more for you: includes.
78
Just use the line
79
80
[[[include foo]]]
81
82
in your files, and the line will be replaced with the content of the file
83
`includes/foo'. It works pretty much like #inlcude "includes/foo" with a C pre
84
processor or <!-- #include virtual="includes/foo"--> with Server Side Includes
85
(SSI).
86
87
MENUS:
88
89
Suppose you want to write a navigation menu in your html files that look like
90
this:
91
92
menu
93
|
94
+-- foo
95
|
96
+-- bar
97
|
98
+-- baz
99
100
and if you click on foo, a sub menu opens:
101
102
menu
103
|
104
+-- foo
105
| |
106
| +-foo1
107
| +-foo2
108
| +-foo3
109
|
110
+-- bar
111
|
112
+-- baz
113
114
The way you do this with mowyw is simple:
115
create a file called `includes/menu-navigation' and fill it with something
116
like this:
117
118
<div class="menu">
119
Navigation:
120
<ul>
121
[[[item foo <li><a href="foo.html" {{class="#active"}}>foo</a>
122
{{<ul>
123
<li><a href="foo1">foo1</a></li>
124
<li><a href="foo2">foo2</a></li>
125
</ul>}}</li>]]]
126
[[[item bar <li><a href="bar.html" {{class="#active"}}>bar</a></li>]]]
127
[[[item baz <li><a href="baz.html" {{class="#active"}}>baz</a></li>]]]
128
</ul>
129
</div>
130
131
now in your file foo.html, you use the line
132
[[[menu navigation foo]]].
133
This line will be replaced by mowyw with:
134
135
<div class="menu">
136
Navigation:
137
<ul>
138
<li><a href="foo.html" class="#active">foo</a>
139
<ul>
140
<li><a href="foo1">foo1</a></li>
141
<li><a href="foo2">foo2</a></li>
142
</ul></li>
143
<li><a href="bar.html" >bar</a></li>
144
<li><a href="baz.html" >baz</a></li>
145
</ul>
146
</div>
147
148
Each menu item looks like this: [[[item label1 some_text]]]. If it is called as
149
[[[menu label1]]] it will produce some_text, and all double curly brackets {{ }}
150
are simply stripped, but the text between them remains.
151
If it is called with a different name, say [[[menu label2]]], the curly brackets
152
and the text between them are stripped.
153
154
VERBATIM OUTPUT
155
156
If your website includes string like [[[ or ]]] etc., you can use the
157
verbatim-construct to prevent it from parsing:
158
159
[[[verbatim foobarbaz]]]
160
Things here inbetween will be printed out exactly as they stand here, you can
161
safely write things like
162
"in perl6 [...] returns array refs:
163
my $a = [2, [4, 5, [8, 9,10]]];"
164
note that the ']]]' will not cause any harm.
165
[[[endverbatim foobarbaz]]]
166
167
the name in the verbatim and in the endverbatim-package have to agree exactly
168
and my consist of alphabetic characters and numbers.
169
170
171
OMITTING HEADER AND FOOTER
172
173
If you include a line like this:
174
[[[option no-header]]]
175
the header is _not_ prepended as usual.
176
You can achieve the following functionality for the footer with the line
177
[[[option no-footer]]]
178
179
180
LIMITATIONS & BUGS
181
* Currently mowyw is not very flexible in many ways, for example files
182
outside the `include/' directory can't be included.
183
184
185
LICENSE:
186
This README file is covered by the GPL (2 or later), however
187
the code examples in this file are public domain, e.g. you may use it
188
however you like.
189
The program mowyw is published under the GPL, for details see the
190
executable