owlscribble 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +12 -0
- data/Manifest.txt +15 -0
- data/README.txt +180 -0
- data/Rakefile +17 -0
- data/TODO +7 -0
- data/examples/markup.html +343 -0
- data/examples/markup.owl +300 -0
- data/examples/scribblify.rb +27 -0
- data/examples/template.rhtml +37 -0
- data/lib/owlscribble.rb +715 -0
- data/test/test_lists.html +108 -0
- data/test/test_lists.owl +46 -0
- data/test/test_owlscribble.rb +125 -0
- data/test/test_toc.html +123 -0
- data/test/test_toc.owl +59 -0
- metadata +70 -0
data/HISTORY
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
== 0.9.0 / 2007-November-25
|
2
|
+
|
3
|
+
* Added each_wiki_link and each_wiki_command to handle these during processing
|
4
|
+
instead of forcing the user to change the document after it's been created.
|
5
|
+
|
6
|
+
* Added support for [[[Odd! Page Name]] some link text] page links.
|
7
|
+
|
8
|
+
* Updated to use TagTreeScanner v0.8 so controlling tag attributes is simpler.
|
9
|
+
|
10
|
+
== 0.8.0 / 2005-July-4
|
11
|
+
|
12
|
+
* First public release
|
data/Manifest.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
HISTORY
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
TODO
|
6
|
+
examples/markup.html
|
7
|
+
examples/markup.owl
|
8
|
+
examples/scribblify.rb
|
9
|
+
examples/template.rhtml
|
10
|
+
lib/owlscribble.rb
|
11
|
+
test/test_lists.html
|
12
|
+
test/test_lists.owl
|
13
|
+
test/test_owlscribble.rb
|
14
|
+
test/test_toc.html
|
15
|
+
test/test_toc.owl
|
data/README.txt
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
= OWLScribble
|
2
|
+
Author:: Gavin Kistner (mailto:phrogz@mac.com)
|
3
|
+
Copyright:: Copyright (c)2005-2007 Gavin Kistner
|
4
|
+
License:: MIT License
|
5
|
+
Version:: 0.9.0 (2007-November-25)
|
6
|
+
|
7
|
+
== Overview
|
8
|
+
|
9
|
+
OWLScribble converts a specific set of wiki text markup into HTML.
|
10
|
+
(The syntax used in the markup is a knockoff of the markup used by OpenWiki;
|
11
|
+
the 'OWL' in OWLScribble means "OpenWiki-like".)
|
12
|
+
|
13
|
+
The OWLScribble.each_wiki_link method provides a way to customize the HTML
|
14
|
+
produced for individual in-wiki page links. (Since the URLs for such links
|
15
|
+
is custom to each site, and the user may wish to perform DB queries to control
|
16
|
+
the display and/or linking of various links.)
|
17
|
+
|
18
|
+
The OWLScribble.each_wiki_command method provides a way to handle special
|
19
|
+
processing instructions used in the markup.
|
20
|
+
|
21
|
+
|
22
|
+
== Features
|
23
|
+
|
24
|
+
* Automatically wraps logical document sections in HTML tags for CSS styling.
|
25
|
+
|
26
|
+
* Flexible markup allows non-standard wiki page names, with optional
|
27
|
+
alternative text displayed for wiki links.
|
28
|
+
|
29
|
+
* Control over the HTML used for wiki links via custom block processing.
|
30
|
+
|
31
|
+
* Mixed bulleted and numbered lists, with many list numbering styles.
|
32
|
+
|
33
|
+
* HTML table support.
|
34
|
+
|
35
|
+
* Arbitrary processing directives with a block to control the produced HTML.
|
36
|
+
|
37
|
+
* Built-in ##TableOfContents## directive uses the nested headings in the
|
38
|
+
document to produce a hierarchical hyperlinked TOC.
|
39
|
+
|
40
|
+
* Access to a DOM-like tag hierarchy after parsing the markup but prior to
|
41
|
+
generating HTML, allowing arbitrary changes as necessary.
|
42
|
+
|
43
|
+
|
44
|
+
== Example Usage
|
45
|
+
|
46
|
+
require 'owlscribble'
|
47
|
+
|
48
|
+
# Tell the library how to handle links the way I like them:
|
49
|
+
OWLScribble.each_wiki_link do |tag, page_name, link_text|
|
50
|
+
tag.name = "a"
|
51
|
+
tag.href = "page/view/#{CGI.escape(page_name)}"
|
52
|
+
tag.title = "View #{page_name.dewikiword}"
|
53
|
+
# tag.text is already set to something reasonable
|
54
|
+
end
|
55
|
+
|
56
|
+
# Tell the library how to handle commands the way I need:
|
57
|
+
OWLScribble.each_wiki_command do |tag, command, params|
|
58
|
+
case command
|
59
|
+
when 'Include' # Include(page_name) or Include(page_name,rev)
|
60
|
+
tag.name = 'div'
|
61
|
+
tag.class = 'sub_page'
|
62
|
+
page_name, revision = params
|
63
|
+
# All elements in the params array are strings
|
64
|
+
revision = Integer( revision ) rescue nil
|
65
|
+
tag.text = fetch_page( page_name, revision )
|
66
|
+
else
|
67
|
+
tag.name = 'span'
|
68
|
+
tag.class = 'unhandled_command'
|
69
|
+
tag.text = "###{command}( #{params.join ', '} )##"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
owl = OWLScribble.new( the_string_to_parse )
|
75
|
+
puts owl.to_html
|
76
|
+
|
77
|
+
== Markup
|
78
|
+
|
79
|
+
See the link:../examples/markup.html file for documentation on the markup itself.
|
80
|
+
|
81
|
+
This page itself was produced using OWL markup; see link:../examples/markup.owl to see the
|
82
|
+
source.
|
83
|
+
|
84
|
+
== Customizing the Document
|
85
|
+
=== Wiki Links
|
86
|
+
OWLScribble supports three ways to specify a link to a specific 'page', indicated by name:
|
87
|
+
* <b><tt>WikiWords</tt></b> <i>(aka CamelCase)</i> are assumed to be page links.
|
88
|
+
* <b><tt>[WikiWord some other text]</tt></b> creates a link to a page with alternate text.
|
89
|
+
* <b><tt>[[Some Page! Name]]</tt></b> allows link creation to pages whose names are not WikiWords.
|
90
|
+
<i>(For more information on creating links, see the link:../docs/markup.html documentation.)</i>
|
91
|
+
|
92
|
+
Because OWLScribble cannot know how to create URLs for such items, you must either supply an
|
93
|
+
_each_wiki_link_ block _before intitialization_ (see example above) to transform tags on the fly,
|
94
|
+
or else spin through the <tt>wiki_links</tt> property on the OWLScribble instance to manipulate
|
95
|
+
them before creating the final HTML.
|
96
|
+
|
97
|
+
If you don't supply an _each_wiki_link_ block, the following example shows how to mutate these
|
98
|
+
non-HTML tags into HTML anchors with a custom url, leaving the text of the link untouched:
|
99
|
+
|
100
|
+
require 'cgi'
|
101
|
+
owl.wiki_links.each{ |tag|
|
102
|
+
tag.name = :a
|
103
|
+
page = tag.attributes[ :page ]
|
104
|
+
tag.attributes[ :href ] = "view?#{CGI.escape(page)}"
|
105
|
+
tag.attributes.delete( :page )
|
106
|
+
}
|
107
|
+
|
108
|
+
=== Wiki Commands
|
109
|
+
In addition to links to wiki pages, OWLScribble allows the user to
|
110
|
+
specify ommands using the following format. For example:
|
111
|
+
* <tt>##TableOfContents##</tt> - include a table of contents here
|
112
|
+
* <tt>##DEPRECATED##</tt> - mark this page for future deletion
|
113
|
+
* <tt>##Include(PageName)##</tt> - include the contents of another page at this location
|
114
|
+
* <tt>##RedirectTo(PageName)##</tt> - show the specified page instead
|
115
|
+
* <tt>##AnyCommand(Param1,Param2,Param3)##</tt> - anything you want
|
116
|
+
|
117
|
+
OWLScribble handles the +TableOfContents+ command automatically, building a table of contents
|
118
|
+
from the hierarchy of heading levels and replacing any <tt>##TableOfContents##</tt>
|
119
|
+
commands with copies of that TOC. Additionally, every section following
|
120
|
+
a header tag is wrapped in a <tt><div class="section">...</div></tt> block,
|
121
|
+
providing a nested hierarchy of sections in the page itself. (This is
|
122
|
+
primarily useful for applying CSS to sections, such as visual indentation.)
|
123
|
+
|
124
|
+
For the other commands, it is up to you to handle them. The simplest method is (as with links)
|
125
|
+
to supply an _each_wiki_command_ block to the OWLScribble class before creating any instances.
|
126
|
+
(See the example above.) Also as with with the links, you may also choose to run through the
|
127
|
+
+wiki_commands+ array after initialization but before calling #to_html, changing the non-HTML
|
128
|
+
<tt>"wiki_command"</tt> tags into something else.
|
129
|
+
|
130
|
+
With the default _each_wiki_command_ block, these tags have a <tt>:do</tt> attribute
|
131
|
+
which is the string name of the command, and may have a <tt>:params</tt> attribute that
|
132
|
+
contains a comma-delimited list of parameters supplied by the user. If they are not removed or
|
133
|
+
changed, these tags will show up in the HTML output. For example, this input text:
|
134
|
+
== Engineering ==
|
135
|
+
Here's the home page from engineering:
|
136
|
+
|
137
|
+
##Include(EngineeringHome)##
|
138
|
+
|
139
|
+
will produce the following HTML:
|
140
|
+
<h2 id="Engineering">Engineering</h2>
|
141
|
+
<div class="section">
|
142
|
+
<p>Here's the home page from engineering:</p>
|
143
|
+
<wiki_command do="Include" param="EngineeringHome">##Include(EngineeringHome)##</wiki_command>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
The presence of these tags should not affect the functioning or rendering
|
147
|
+
of the produced HTML in any modern browser, but it will be syntactically invalid.
|
148
|
+
|
149
|
+
|
150
|
+
== Requirements
|
151
|
+
|
152
|
+
* OWLScribble is based on (and hence requires) the +TagTreeScanner+ library
|
153
|
+
(http://tagtreescanner.rubyforge.org). Installing this gem should have
|
154
|
+
already informed you of the requirement and given you a chance to install it.
|
155
|
+
|
156
|
+
|
157
|
+
== License
|
158
|
+
|
159
|
+
(The MIT License)
|
160
|
+
|
161
|
+
Copyright (c) 2005-2007 Gavin Kistner
|
162
|
+
|
163
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
164
|
+
a copy of this software and associated documentation files (the
|
165
|
+
'Software'), to deal in the Software without restriction, including
|
166
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
167
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
168
|
+
permit persons to whom the Software is furnished to do so, subject to
|
169
|
+
the following conditions:
|
170
|
+
|
171
|
+
The above copyright notice and this permission notice shall be
|
172
|
+
included in all copies or substantial portions of the Software.
|
173
|
+
|
174
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
175
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
176
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
177
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
178
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
179
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
180
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/owlscribble.rb'
|
6
|
+
|
7
|
+
Hoe.new('owlscribble', OWLScribble::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'owlscribble'
|
9
|
+
p.author = 'Gavin Kistner'
|
10
|
+
p.email = 'phrogz@mac.com'
|
11
|
+
p.summary = "Converts a specific syntax of text markup into HTML. (The syntax is similar to OpenWiki's.)"
|
12
|
+
p.description = IO.read( 'README.txt' )[ /= Overview\n(.+?)^=/m, 1 ].rstrip
|
13
|
+
p.changes = IO.read( 'HISTORY' )[ /^=[^\n]+\n+(.+?)(?:^=|\Z)/m, 1 ].rstrip
|
14
|
+
p.remote_rdoc_dir = ''
|
15
|
+
end
|
16
|
+
|
17
|
+
# vim: syntax=Ruby
|
data/TODO
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
* Speed optimizations, once it's feature-complete
|
2
|
+
|
3
|
+
* Process indented paragraphs like lists, just to calculate minimal depth from many spaces
|
4
|
+
|
5
|
+
* Inline commands for <br>? Some auto-br inclusion?
|
6
|
+
|
7
|
+
* More unit tests (especially around each_wiki_link and each_wiki_command)
|
@@ -0,0 +1,343 @@
|
|
1
|
+
<html><head><title>Welcome to the Jungle</title>
|
2
|
+
<style type="text/css">
|
3
|
+
body { margin:1em 2em; font-size:90%; font-family:'Trebuchet MS', serif; margin-bottom:30em }
|
4
|
+
|
5
|
+
a:link, a:visited { color:#009 }
|
6
|
+
a.newwikilink { color:#900 }
|
7
|
+
|
8
|
+
h1,h2,h3,h4,h5,h6 { margin-bottom:0.2em; margin-top:2em; border-bottom:1px solid #999; font-family:sans-serif }
|
9
|
+
h1 { font-size:120% }
|
10
|
+
h2 { font-size:110% }
|
11
|
+
h3,h4 { font-size:100% }
|
12
|
+
h5,h6 { font-size:90% }
|
13
|
+
h4,h5,h6 { font-style:italic }
|
14
|
+
|
15
|
+
ul, ol { margin:0; padding:0; margin-left:1.5em; margin-bottom:0.8em }
|
16
|
+
ul ol, ol ul, ul ul, ol ol { margin-left:1.5em }
|
17
|
+
li { margin-bottom:0 }
|
18
|
+
p { margin:0; margin-bottom:0.7em }
|
19
|
+
pre { background:#ffd; padding:0.5em; border:1px solid #993 }
|
20
|
+
.todo { font-weight:bold; color:#900 }
|
21
|
+
.section { margin-left:1em }
|
22
|
+
table { border-collapse:collapse; margin-bottom:1em }
|
23
|
+
td { border:1px solid #ccc; padding:0.1em 0.5em; font-size:85% }
|
24
|
+
pre, code, tt { color:#060 }
|
25
|
+
|
26
|
+
dt { font-weight:bold }
|
27
|
+
|
28
|
+
.indent1 { margin-left:2em }
|
29
|
+
.indent2 { margin-left:4em }
|
30
|
+
.indent3 { margin-left:6em }
|
31
|
+
.indent4 { margin-left:8em }
|
32
|
+
.indent5 { margin-left:10em }
|
33
|
+
.indent6 { margin-left:12em }
|
34
|
+
</style>
|
35
|
+
</head><body>
|
36
|
+
<h1 id="TableofContents">Table of Contents</h1>
|
37
|
+
<div class="section">
|
38
|
+
<div class="toc"><ul><li><a href="#TableofContents">Table of Contents</a></li><li><a href="#WelcometoOWLScribble">Welcome to OWLScribble!</a><ul><li><a href="#WhatisOWLScribble">What is OWLScribble?</a></li><li><a href="#SupportedMarkup">Supported Markup</a><ul><li><a href="#Paragraphs">Paragraphs</a><ul><li><a href="#IndentedParagraphs">Indented Paragraphs</a></li></ul></li><li><a href="#PreformattedText">Preformatted Text</a></li><li><a href="#BasicInlineStyling">Basic Inline Styling</a></li><li><a href="#Headings">Headings</a></li><li><a href="#Linking">Linking</a><ul><li><a href="#PreventingLinking">Preventing Linking</a></li></ul></li><li><a href="#Lists">Lists</a><ul><li><a href="#BulletedLists">Bulleted Lists</a></li><li><a href="#NumberedLists">Numbered Lists</a></li><li><a href="#MixingLists">Mixing Lists</a></li><li><a href="#DefinitionLists">Definition Lists</a></li></ul></li><li><a href="#Tables">Tables</a></li></ul></li><li><a href="#ProcessingDirectives">Processing Directives</a></li><li><a href="#Miscellaneous">Miscellaneous</a></li></ul></li></ul></div>
|
39
|
+
</div>
|
40
|
+
<h1 id="WelcometoOWLScribble">Welcome to OWLScribble!</h1>
|
41
|
+
<div class="section">
|
42
|
+
<p><i>An introduction to the <span>OWLScribble</span> markup language.</i></p>
|
43
|
+
<h2 id="WhatisOWLScribble">What is OWLScribble?</h2>
|
44
|
+
<div class="section">
|
45
|
+
<p><span>OWLScribble</span> is a wiki markup language <i>based on</i> the markup used by <a href="hTTp://www.openwiki.org/">OpenWiki</a>. It was designed for use with the <span>SewWiki</span> project by <a href="dummylinktopage?GavinKistner" class="newwikilink">Gavin Kistner</a>.</p>
|
46
|
+
</div>
|
47
|
+
<h2 id="SupportedMarkup">Supported Markup</h2>
|
48
|
+
<div class="section">
|
49
|
+
<h3 id="Paragraphs">Paragraphs</h3>
|
50
|
+
<div class="section">
|
51
|
+
<pre>Paragraphs start on a line of their own
|
52
|
+
and may be continued onto multiple
|
53
|
+
consecutive lines.
|
54
|
+
|
55
|
+
A double line break indicates the start
|
56
|
+
of a new paragraph.
|
57
|
+
|
58
|
+
If the start of the text is indented at all,
|
59
|
+
however, then it is treated as preformatted
|
60
|
+
text.</pre>
|
61
|
+
<p>Paragraphs start on a line of their own
|
62
|
+
and may be continued onto multiple
|
63
|
+
consecutive lines.</p>
|
64
|
+
<p>A double line break indicates the start
|
65
|
+
of a new paragraph.</p>
|
66
|
+
<pre>If the start of the text is indented at all,
|
67
|
+
however, then it is treated as preformatted
|
68
|
+
text.
|
69
|
+
</pre>
|
70
|
+
<h4 id="IndentedParagraphs">Indented Paragraphs</h4>
|
71
|
+
<div class="section">
|
72
|
+
<pre> : An exception to the indented-paragraph rule is this.
|
73
|
+
: Paragraphs (on a single line)
|
74
|
+
: with whitespace preceding a colon
|
75
|
+
: are indented based on the amount of space
|
76
|
+
: But, as seen here, each line is its own paragraph.</pre>
|
77
|
+
<p class="indent1">An exception to the indented-paragraph rule is this.</p>
|
78
|
+
<p class="indent2">Paragraphs (on a single line)</p>
|
79
|
+
<p class="indent2">with whitespace preceding a colon</p>
|
80
|
+
<p class="indent2">are indented based on the amount of space</p>
|
81
|
+
<p class="indent1">But, as seen here, each line is its own paragraph.</p>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
<h3 id="PreformattedText">Preformatted Text</h3>
|
85
|
+
<div class="section">
|
86
|
+
<pre> {{{
|
87
|
+
for ( var i=0; i<10; ++i ){
|
88
|
+
alert( 'hi!' );
|
89
|
+
}
|
90
|
+
}}}</pre>
|
91
|
+
<pre>for ( var i=0; i<10; ++i ){
|
92
|
+
alert( 'hi!' );
|
93
|
+
}</pre>
|
94
|
+
<p>To be clear about the start and end, you may
|
95
|
+
specify preformatted text by wrapping it in
|
96
|
+
<tt>{{{...}}}</tt> over multiple lines.</p>
|
97
|
+
<p>Such text is automatically unindented by the
|
98
|
+
amount of indentation on the end markers.</p>
|
99
|
+
</div>
|
100
|
+
<h3 id="BasicInlineStyling">Basic Inline Styling</h3>
|
101
|
+
<div class="section">
|
102
|
+
<pre>This text **is bold**, this //is italic//,
|
103
|
+
and --this has been struck--.
|
104
|
+
|
105
|
+
//You can start a paragraph with an inline
|
106
|
+
style, but you cannot wrap it across lines.//
|
107
|
+
|
108
|
+
This is a @@code reference@@,
|
109
|
+
as is {{{this text}}}.
|
110
|
+
|
111
|
+
A double-exclamation point is a special
|
112
|
+
'todo' item. !!Add more examples!!
|
113
|
+
|
114
|
+
You can also ^^superscript^^ and
|
115
|
+
__subscript__ text, like H__2__O
|
116
|
+
or e^^pi*i^^.</pre>
|
117
|
+
<p>This text <b>is bold</b>, this <i>is italic</i>,
|
118
|
+
and <strike>this has been struck</strike>.</p>
|
119
|
+
<p><i>You can start a paragraph with an inline</i>
|
120
|
+
style, but you cannot wrap it across lines.<i></i></p>
|
121
|
+
<p>This is a <tt>code reference</tt>,
|
122
|
+
as is <tt>this text</tt>.</p>
|
123
|
+
<p>A double-exclamation point is a special
|
124
|
+
'todo' item. <span class="todo">TODO - Add more examples</span></p>
|
125
|
+
<p>You can also <sup>superscript</sup> and
|
126
|
+
<sub>subscript</sub> text, like H<sub>2</sub>O
|
127
|
+
or e<sup>pi*i</sup>.</p>
|
128
|
+
<ul>
|
129
|
+
<li><i>Unlike <span>OpenWiki</span>, you are not allowed to underline text. Sorry, but underlining is reserved for links in hyperlinked documents.</i></li>
|
130
|
+
</ul>
|
131
|
+
</div>
|
132
|
+
<h3 id="Headings">Headings</h3>
|
133
|
+
<div class="section">
|
134
|
+
<pre>= Heading Level 1 =
|
135
|
+
== Heading Level 2 ==
|
136
|
+
=== Heading Level 3 ===
|
137
|
+
==== Heading Level 4 ====
|
138
|
+
===== Heading Level 5 =====
|
139
|
+
====== Heading Level 6 ======</pre>
|
140
|
+
<p>Headings must begin at the start of the line. Markup inside headings is ignored. (For example,
|
141
|
+
<tt>== My //Sweet// Heading ==</tt> will not make the word italic, but will instead show the <tt>//</tt> characters in the output.)</p>
|
142
|
+
</div>
|
143
|
+
<h3 id="Linking">Linking</h3>
|
144
|
+
<div class="section">
|
145
|
+
<pre> * Visit SiteMap, HomePage, or WhereDoIBegin to get started.
|
146
|
+
* Visit the [[What is a Wiki?]] page if you're really lost.
|
147
|
+
* Visit hTTp://www.google.com to find stuff on the web.
|
148
|
+
* The [hTTp://www.microsoft.com company that shall not be named] thinks they can beat Google.
|
149
|
+
* This page was edited by [GavinKistner the Wiki Gardener].
|
150
|
+
* See [[[Foo/Bar/Jim/Jam]] the Jam page] for more deliciousness.</pre>
|
151
|
+
<ul>
|
152
|
+
<li>Visit <a href="dummylinktopage?SiteMap" class="newwikilink">Site Map</a>, <a href="dummylinktopage?HomePage" class="newwikilink">Home Page</a>, or <a href="dummylinktopage?WhereDoIBegin" class="newwikilink">Where Do I Begin</a> to get started.</li>
|
153
|
+
<li>Visit the <a href="dummylinktopage?What+is+a+Wiki%3F" class="newwikilink">What is a Wiki?</a> page if you're really lost.</li>
|
154
|
+
<li>Visit <a href="hTTp://www.google.com">www.google.com</a> to find stuff on the web.</li>
|
155
|
+
<li>The <a href="hTTp://www.microsoft.com">company that shall not be named</a> thinks they can beat Google.</li>
|
156
|
+
<li>This page was edited by <a href="dummylinktopage?GavinKistner" class="newwikilink">the Wiki Gardener</a>.</li>
|
157
|
+
<li>See <a href="dummylinktopage?Foo%2FBar%2FJim%2FJam" class="newwikilink">the Jam page</a> for more deliciousness.</li>
|
158
|
+
</ul>
|
159
|
+
<p><span>OWLScribble</span> supports three styles of specifying a link:</p>
|
160
|
+
<ol>
|
161
|
+
<li>Text that looks like <span>URLs</span> are automatically linked. You must use a capital 'T' and lowercase letters in the protocol to get it recognized. (It's annoying, but designed to stop spam bots.) So <span>http://www.google.com/</span> will not be linked, but <tt>hTTp://www.google.com</tt> will yield: <a href="hTTp://www.google.com">www.google.com</a><ul>
|
162
|
+
<li><i>Supported protocols are http, https, and ftp.</i></li>
|
163
|
+
</ul></li>
|
164
|
+
<li><b><span>WikiWords</span></b> are automatically treated as links to other pages in the Wiki, and expanded out. For example, typing <tt>CapitalizedWordsScrunchedTogether</tt> produces "<a href="dummylinktopage?CapitalizedWordsScrunchedTogether" class="newwikilink">Capitalized Words Scrunched Together</a>".<ul>
|
165
|
+
<li><i>The <span>OWLScribble</span> class simply turns the above into the 'HTML' code: <tt><wiki_link page="CapitalizedWordsScrunchedTogether">Capitalized Words Scrunched Together</wiki_link></tt>. It is up to the consumer of <span>OWLScribble</span> to run through the <tt>#wiki_links</tt> collection and replace the above with something reasonable (such as an HTML anchor) after doing whatever it needs to do (such as a db lookup).</i></li>
|
166
|
+
</ul></li>
|
167
|
+
<li>If you want to create a wiki page whose name doesn't look like a <span>WikiWord</span>, you can wrap it in double square brackets, like <tt>See the [[Table of Contents]] page</tt>.<ul>
|
168
|
+
<li><i>Again, <span>OWLScribble</span> turns the above into: <tt><wiki_link page="Table of Contents">Table of Contents</wiki_link></tt>, leaving it up to the consumer of <span>OWLScribble</span> to change that tag into something better.</i></li>
|
169
|
+
<li>As seen in the last example above, you can use the double-square-bracket wiki link style along with outer brackets to supply different page text. <span>OWLScribble</span> turns the last example above into: <tt><wiki_link page="Foo/Bar/Jim/Jam">the Jam page</wiki_link></tt>.<i></i></li>
|
170
|
+
</ul></li>
|
171
|
+
</ol>
|
172
|
+
<p>With either <span>URLs</span> or <span>WikiWords</span>, you can optionally use an alternative description for the link text. As shown above, place a single set of square brackets around what you want linked, with the URL or <span>WikiWord</span> as the first item.</p>
|
173
|
+
<h4 id="PreventingLinking">Preventing Linking</h4>
|
174
|
+
<div class="section">
|
175
|
+
<pre>Sometimes you want to write something that looks like a
|
176
|
+
~WikiWord (such as ~OpenWiki) but you don't want it to
|
177
|
+
appear as a link to a page in the wiki.
|
178
|
+
|
179
|
+
You can either wrap it in preformatted text delimiters
|
180
|
+
like @@{{{OpenWiki}}}@@, or place a tilde (~) character right
|
181
|
+
before it, as in {{{~OpenWiki}}}.</pre>
|
182
|
+
<p>Sometimes you want to write something that looks like a
|
183
|
+
<span>WikiWord</span> (such as <span>OpenWiki</span>) but you don't want it to
|
184
|
+
appear as a link to a page in the wiki.</p>
|
185
|
+
<p>You can either wrap it in preformatted text delimiters
|
186
|
+
like <tt>{{{OpenWiki}}}</tt>, or place a tilde (~) character right
|
187
|
+
before it, as in <tt>~OpenWiki</tt>.</p>
|
188
|
+
</div>
|
189
|
+
</div>
|
190
|
+
<h3 id="Lists">Lists</h3>
|
191
|
+
<div class="section">
|
192
|
+
<h4 id="BulletedLists">Bulleted Lists</h4>
|
193
|
+
<div class="section">
|
194
|
+
<pre> 1 2 3 4 5 6
|
195
|
+
12345678901234567890123456789012345678901234567890123456789012345
|
196
|
+
* Bullet lists need **at least one space** before the asterisk.
|
197
|
+
* **A space** must appear after the asterisk.
|
198
|
+
* They may be nested to an arbitrary depth.
|
199
|
+
* Tabs may also be used for indentation.
|
200
|
+
* Mixing tabs and spaces is asking for trouble.</pre>
|
201
|
+
<ul>
|
202
|
+
<li>Bullet lists need <b>at least one space</b> before the asterisk.<ul>
|
203
|
+
<li><b>A space</b> must appear after the asterisk.<ul>
|
204
|
+
<li>They may be nested to an arbitrary depth.</li>
|
205
|
+
</ul></li>
|
206
|
+
</ul></li>
|
207
|
+
<li>Tabs may also be used for indentation.</li>
|
208
|
+
<li>Mixing tabs and spaces is asking for trouble.</li>
|
209
|
+
</ul>
|
210
|
+
</div>
|
211
|
+
<h4 id="NumberedLists">Numbered Lists</h4>
|
212
|
+
<div class="section">
|
213
|
+
<pre> 1 2 3 4 5 6
|
214
|
+
12345678901234567890123456789012345678901234567890123456789012345
|
215
|
+
1. Numbered lists must also have a space before the number.
|
216
|
+
1. The actual number doesn't matter...
|
217
|
+
3. ...but the period after the number does.
|
218
|
+
1. As well as the space after the period.
|
219
|
+
# You can also use the 'octothorp' if you like.
|
220
|
+
# //(A fancy name for the 'sharp' or 'pound' symbol.)
|
221
|
+
# Other types of numbered lists are supported beyond arabic.
|
222
|
+
a. For arabic lists, you can use 1, 2, 3, ... 23, etc.
|
223
|
+
a. but for the following, you must use the actual character.
|
224
|
+
a. A lowercase 'a' is for lowercase alphabetical lists.
|
225
|
+
A. An uppercase 'A' is for uppercase alphabetical lists.
|
226
|
+
i. A lowercase 'i' is for lowercase roman numeral lists.
|
227
|
+
I. An uppercase 'I' is for uppercase roman numeral lists.</pre>
|
228
|
+
<ol>
|
229
|
+
<li>Numbered lists must also have a space before the number.</li>
|
230
|
+
<li>The actual number doesn't matter...<ol>
|
231
|
+
<li>...but the period after the number does.</li>
|
232
|
+
<li>As well as the space after the period.</li>
|
233
|
+
</ol></li>
|
234
|
+
<li>You can also use the 'octothorp' if you like.<ol>
|
235
|
+
<li><i>(A fancy name for the 'sharp' or 'pound' symbol.)</i></li>
|
236
|
+
</ol></li>
|
237
|
+
<li>Other types of numbered lists are supported beyond arabic.<ol>
|
238
|
+
<li type="a">For arabic lists, you can use 1, 2, 3, ... 23, etc.</li>
|
239
|
+
<li type="a">but for the following, you must use the actual character.</li>
|
240
|
+
<li type="a">A lowercase 'a' is for lowercase alphabetical lists.</li>
|
241
|
+
<li type="A">An uppercase 'A' is for uppercase alphabetical lists.</li>
|
242
|
+
<li type="i">A lowercase 'i' is for lowercase roman numeral lists.</li>
|
243
|
+
<li type="I">An uppercase 'I' is for uppercase roman numeral lists.</li>
|
244
|
+
</ol></li>
|
245
|
+
</ol>
|
246
|
+
</div>
|
247
|
+
<h4 id="MixingLists">Mixing Lists</h4>
|
248
|
+
<div class="section">
|
249
|
+
<pre> 1 2 3 4 5
|
250
|
+
12345678901234567890123456789012345678901234567890123456789
|
251
|
+
* Bulleted and numbered lists may be alternately nested
|
252
|
+
1. And (as seen above)...
|
253
|
+
i. ...you can mix numbered list styles on the fly
|
254
|
+
* But woe unto you if you try to mix a bullet...
|
255
|
+
1. ...and a number in the same list.
|
256
|
+
* //Sorry buddy, but that doesn't fly.//</pre>
|
257
|
+
<ul>
|
258
|
+
<li>Bulleted and numbered lists may be alternately nested<ol>
|
259
|
+
<li>And (as seen above)...</li>
|
260
|
+
<li type="i">...you can mix numbered list styles on the fly</li>
|
261
|
+
</ol></li>
|
262
|
+
<li>But woe unto you if you try to mix a bullet...</li>
|
263
|
+
<li>...and a number in the same list.<ul>
|
264
|
+
<li><i>Sorry buddy, but that doesn't fly.</i></li>
|
265
|
+
</ul></li>
|
266
|
+
</ul>
|
267
|
+
</div>
|
268
|
+
<h4 id="DefinitionLists">Definition Lists</h4>
|
269
|
+
<div class="section">
|
270
|
+
<pre> 1 2 3 4 5
|
271
|
+
12345678901234567890123456789012345678901234567890123456789
|
272
|
+
; Semantic : of or relating to meaning in language
|
273
|
+
; Grok : to understand //completely//
|
274
|
+
; : to inherently and almost intuitively comprehend</pre>
|
275
|
+
<dl>
|
276
|
+
<dt>Semantic</dt>
|
277
|
+
<dd>of or relating to meaning in language</dd>
|
278
|
+
<dt>Grok</dt>
|
279
|
+
<dd>to understand <i>completely</i></dd>
|
280
|
+
<dd>to inherently and almost intuitively comprehend</dd>
|
281
|
+
</dl>
|
282
|
+
<ul>
|
283
|
+
<li><i>Unlike <span>OpenWiki</span>, you cannot 'nest' or indent definition lists.</i></li>
|
284
|
+
</ul>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
<h3 id="Tables">Tables</h3>
|
288
|
+
<div class="section">
|
289
|
+
<pre>|| **Age** || **Sex** || **Weight** ||
|
290
|
+
|| 32 || M || 180 ||
|
291
|
+
|| 30 || F || 150 ||
|
292
|
+
|||| //average// || **165** ||</pre>
|
293
|
+
<table>
|
294
|
+
<tr>
|
295
|
+
<td><b>Age</b></td>
|
296
|
+
<td><b>Sex</b></td>
|
297
|
+
<td><b>Weight</b></td>
|
298
|
+
</tr>
|
299
|
+
<tr>
|
300
|
+
<td>32</td>
|
301
|
+
<td>M</td>
|
302
|
+
<td>180</td>
|
303
|
+
</tr>
|
304
|
+
<tr>
|
305
|
+
<td>30</td>
|
306
|
+
<td>F</td>
|
307
|
+
<td>150</td>
|
308
|
+
</tr>
|
309
|
+
<tr>
|
310
|
+
<td colspan="2"><i>average</i></td>
|
311
|
+
<td><b>165</b></td>
|
312
|
+
</tr>
|
313
|
+
</table>
|
314
|
+
<p>You don't have to line up the bars from one row to the next, but you may
|
315
|
+
if you want the text representation to look clean. As seen above,
|
316
|
+
you can cause a cell to span multiple columns.</p>
|
317
|
+
</div>
|
318
|
+
</div>
|
319
|
+
<h2 id="ProcessingDirectives">Processing Directives</h2>
|
320
|
+
<div class="section">
|
321
|
+
<p>A processing directive appears as a pair of pound symbols with a command
|
322
|
+
inside, optionally followed by parameters to that command inside
|
323
|
+
parentheses. For example:</p>
|
324
|
+
<pre>##TableOfContents##
|
325
|
+
##IncludePage(ProcessingDirectives)##</pre>
|
326
|
+
<p><span>OWLScribble</span> currently recognizes the following directives:</p>
|
327
|
+
<ul>
|
328
|
+
<li><tt>##TableOfContents##</tt> - replaces the directive with a nested list representing the hierarchy of headers in the document, with links to those headers</li>
|
329
|
+
<li><tt>##DEPRECATED##</tt> - indicates that the document is no longer needed, and should be removed</li>
|
330
|
+
<li><tt>##BALETED##</tt> - <i>same as DEPRECATED</i></li>
|
331
|
+
<li><tt>##IncludePage(PageName)##</tt> - indicates that the contents of the other page should be included in this location</li>
|
332
|
+
</ul>
|
333
|
+
<p>Note that <span>OWLScribble</span> only handles the <tt>TableOfContents</tt> directive natively. The other directives are replaced with an empty non-HTML 'wiki_command' tag, such as <tt><wiki_command do="TableOfContents" /></tt> or <tt><wiki_command do="IncludePage" param="CommonFooter" /></tt>. It is up to the consumer of <span>OWLScribble</span> to handle and/or replace such tags with meaningful information.</p>
|
334
|
+
<p class="indent1"><i>There are two ways to handle these tags. One way is to parse and modify the HTML produced by <span>OWLScribble</span> as a string. This is effective, but not recommended.</i></p>
|
335
|
+
<p class="indent1"><i>The recommended mechanism for handling processing directives is to spin through the <tt>#wiki_commands</tt> collection of the <span>OWLScribble</span> object after initialization, processing the commands and replacing the tags as desired. Once this is done, call the <tt>#to_s</tt> or <tt>#to_html</tt> methods on the <span>OWLScribble</span> instance to get the final output.</i></p>
|
336
|
+
</div>
|
337
|
+
<h2 id="Miscellaneous">Miscellaneous</h2>
|
338
|
+
<div class="section">
|
339
|
+
<p>HTML entities are not needed (and do not work) inside <span>OWLScribble</span>; you can type <tt>"this & that"</tt> and it will produce the HTML <tt>this &amp; that</tt>, displaying as "this & that". Typing <tt>&amp;</tt> will actually show "&amp;".</p>
|
340
|
+
</div>
|
341
|
+
</div>
|
342
|
+
|
343
|
+
</body></html>
|