Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 277 lines (214 sloc) 8.487 kB
52f3521 added mowyw to the repository
moritz authored
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
10 SHORT HOWTO:
11 -----------
12
13 choose an empty directory, and there create the three directories
14 includes/
15 source/
16 online/
17
18 The `source/' directory contains the source files that will be processed by
19 mowyw. Each file in the `source/' directory is mapped to one file in the
20 `online/' directory. You should not write files into the `online/' directory
21 since they may be deleted or overwritten, and you should not modify existing
22 files in that directory since all changes are lost during the next run.
23 All files that might be included by others (including menus) should be in the
24 `includes' directory.
25
26 Now place a file index.html (or whatever you want it to be called) in the
27 'source/' directory.
28
29 If all your HTML files have a common header/footer, you may want to place them
30 in in the files `includes/header' and `includes/footer'.
31
32 For example `inlcudes/header' may contain
33
34 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
35 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
36
37 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
38 <head>
39 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
40 <link rel="stylesheet" type="text/css" media="screen, projection" href="style.css" />
41 <link rel="stylesheet" type="text/css" media="print" href="print.css" />
42
43 and `inlcudes/footer' may contain
44
45 </body>
46 </html>
47
48 and perhaps an additional footer line to be displayed in all pages.
49
50 Now write some content in the file `source/index.html' and then run mowyw.
51 You should get an output like that:
52
53 Processing File 'source/index.html'... DONE.
54
55 Now point your browser at source/index.html and see if it worked.
56 Files not ending in .html, .htm, .shtml, .xhtml etc. are not processed, just
57 copyied.
58
d255aa6 * prefixes and postfix are now configurable
moritz authored
59 You can change the default pathes with the following command line options to
60 mowyw:
61 --postfix=html
62 --includes-prefix=incl/
63 --source-prefix=src/
64 --destination-prefix=out/
65 --menu-prefix=incl/menu/
66 Note that if you whant the prefixes to be directories you have to include the
67 trailing slash (or whatever the directory separator on your OS is).
68
69 If you didn't change any heaer/footer/included files you can save processing
70 time by adding the command line option '--make', in which case mowyw will
71 compare the timestamps of the source file and designated output file and will
72 only process the source file if it is newer.
73
52f3521 added mowyw to the repository
moritz authored
74
75 INCLUDES:
76
77 So far mowyw didn't do much work for you, it just added header and footer
78 sections to all html files.
79 But it can do more for you: includes.
80 Just use the line
81
82 [[[include foo]]]
83
84 in your files, and the line will be replaced with the content of the file
85 `includes/foo'. It works pretty much like #inlcude "includes/foo" with a C pre
86 processor or <!-- #include virtual="includes/foo"--> with Server Side Includes
87 (SSI).
88
89 MENUS:
90
91 Suppose you want to write a navigation menu in your html files that look like
92 this:
93
94 menu
95 |
96 +-- foo
97 |
98 +-- bar
99 |
100 +-- baz
101
102 and if you click on foo, a sub menu opens:
103
104 menu
105 |
106 +-- foo
107 | |
108 | +-foo1
109 | +-foo2
110 | +-foo3
111 |
112 +-- bar
113 |
114 +-- baz
115
116 The way you do this with mowyw is simple:
117 create a file called `includes/menu-navigation' and fill it with something
118 like this:
119
120 <div class="menu">
121 Navigation:
122 <ul>
123 [[[item foo <li><a href="foo.html" {{class="#active"}}>foo</a>
124 {{<ul>
125 <li><a href="foo1">foo1</a></li>
126 <li><a href="foo2">foo2</a></li>
127 </ul>}}</li>]]]
128 [[[item bar <li><a href="bar.html" {{class="#active"}}>bar</a></li>]]]
129 [[[item baz <li><a href="baz.html" {{class="#active"}}>baz</a></li>]]]
130 </ul>
131 </div>
132
133 now in your file foo.html, you use the line
134 [[[menu navigation foo]]].
135 This line will be replaced by mowyw with:
136
137 <div class="menu">
138 Navigation:
139 <ul>
140 <li><a href="foo.html" class="#active">foo</a>
141 <ul>
142 <li><a href="foo1">foo1</a></li>
143 <li><a href="foo2">foo2</a></li>
144 </ul></li>
145 <li><a href="bar.html" >bar</a></li>
146 <li><a href="baz.html" >baz</a></li>
147 </ul>
148 </div>
149
150 Each menu item looks like this: [[[item label1 some_text]]]. If it is called as
151 [[[menu label1]]] it will produce some_text, and all double curly brackets {{ }}
152 are simply stripped, but the text between them remains.
153 If it is called with a different name, say [[[menu label2]]], the curly brackets
154 and the text between them are stripped.
155
d255aa6 * prefixes and postfix are now configurable
moritz authored
156 SYNTAX HILIGHTING
157
158 If you have both the Perl module Text::VimColor and Vim installed, you can use
159 the follwing construct to automagically generate syntax hilighted HTML markup:
160
161 <pre>[[[syntax perl]]]
162 #!/usr/bin/perl
163
164 sub blubb {
165 print "This sub only prints this stupid message\n";
166 }
167 [[[endsyntax]]]</pre>
168
169 The only argument to 'syntax' is the language that the code is in, if you use
170 a value that vim doesn't know it will try to guess the language.
171
172 The standard CSS classes are:
173 .synComment { color: #0000FF }
174 .synConstant { color: #FF00FF }
175 .synIdentifier { color: #008B8B }
176 .synStatement { color: #A52A2A ; font-weight: bold }
177 .synPreProc { color: #A020F0 }
178 .synType { color: #2E8B57 ; font-weight: bold }
179 .synSpecial { color: #6A5ACD }
180 .synUnderlined { color: #000000 ; text-decoration: underline }
181 .synError { color: #FFFFFF ; background: #FF0000 none }
182 .synTodo { color: #0000FF ; background: #FFFF00 none }
183
184 (taken from Text::VimColor)
185
186
52f3521 added mowyw to the repository
moritz authored
187 VERBATIM OUTPUT
188
189 If your website includes string like [[[ or ]]] etc., you can use the
190 verbatim-construct to prevent it from parsing:
191
192 [[[verbatim foobarbaz]]]
193 Things here inbetween will be printed out exactly as they stand here, you can
194 safely write things like
195 "in perl6 [...] returns array refs:
196 my $a = [2, [4, 5, [8, 9,10]]];"
197 note that the ']]]' will not cause any harm.
198 [[[endverbatim foobarbaz]]]
199
200 the name in the verbatim and in the endverbatim-package have to agree exactly
201 and my consist of alphabetic characters and numbers.
202
d255aa6 * prefixes and postfix are now configurable
moritz authored
203 COMMENTS
204
205 You can exclude parts entirly from showing up in the output by putting them
206 inside a comment:
207 [[[comment anything inside here will not show up in the output]]]
208 In a comment everything but ']]]' is allowed.
209
52f3521 added mowyw to the repository
moritz authored
210
211 OMITTING HEADER AND FOOTER
212
213 If you include a line like this:
214 [[[option no-header]]]
215 the header is _not_ prepended as usual.
216 You can achieve the following functionality for the footer with the line
217 [[[option no-footer]]]
218
219
8e20ed2 desribed setvar, readvar and scoping
moritz authored
220 SETTING AND READING VARIABLES
221
222 Suppose you want to add a different <title> to every page, but you want all
223 your HTML header to be in one specific place.
224 A way to achive this is with the setvar and readvar constructs. Place this in
225 your header file:
226 <html>
227 <head><title>[[[readvar title]]]</title>/head>
228 <body>
229 (of course you should use a doctype ;-)
230 And then in each source file you can use
231 [[[setvar title This is the title of this stupid page]]]
232 to set the title. If you forget to set a variable before using it a warning
233 will be emitted.
234
235 Scoping:
236 Variables are scoped in the sense that when you enter a new scope (by using
237 include, menu, item or automatically by including the header and footer) the
238 variables from the higher level scope are still available, but if you modify
239 them in local scope they will still be unmodified in the outer scope.
240 Example:
241 [[[setvar foo bar]]]
242 [[[include somefile]]]
243 [[[redavar foo]]] --- gives bar
244 In file somfile:
245 [[[readvar foo]]] --- gives bar
246 [[[setvar foo baz]]]
247 [[[readvar foo]]] --- gives baz
248 Therefore you can change the header's and footer's output by defining
249 variables in the main source file, but not the other way round.
250
251
d255aa6 * prefixes and postfix are now configurable
moritz authored
252 SYNTAX CHANGE
253 -------------
254 Version 0.0.3 and before used only double square brackets
255 (like [[include foo]]), but I noticed that double closing square brackets
256 are part of a typical CDATA declaration in xml files (and xhtml) like this:
257 <style type="text/css">
258 /*<![CDATA[*/
259 CSS Declarations
260 /*]]>*/
261 </style>
262
263 Now tripple square brackets (like [[[include foo]]]) are used.
264
265
52f3521 added mowyw to the repository
moritz authored
266 LIMITATIONS & BUGS
267 * Currently mowyw is not very flexible in many ways, for example files
268 outside the `include/' directory can't be included.
269
270
271 LICENSE:
272 This README file is covered by the GPL (2 or later), however
273 the code examples in this file are public domain, e.g. you may use it
274 however you like.
275 The program mowyw is published under the GPL, for details see the
276 executable
Something went wrong with that request. Please try again.