source: project/wiki/wiki-syntax-chicken @ 8883

Last change on this file since 8883 was 8883, checked in by sjamaan, 13 years ago

Write down the example stuff we discussed on IRC

File size: 2.3 KB
Line 
1== Introduction
2
3This page describes the syntax that will be implemented for the Chicken wiki.
4It is important to note that this is not currently supported, but it will be
5soon (nag [[Alejandro Forero Cuervo]] otherwise).
6
7== Tags for procedure-like definitions
8
9We will add support for the following tags:
10
11* {{procedure}}
12* {{macro}}
13
14Each of these should be used as follows:
15
16 <nowiki>&lt;procedure>(string-append a b ...)&lt;/procedure></nowiki>
17
18This will be rendered as follows (with some divs and spans for easy CSSing):
19
20[procedure] {{('''string-append''' a b ...)}}
21
22== Tags for other definitions
23
24The following tags will also be supported:
25
26* {{read}}
27* {{parameter}}
28* {{record}}
29* {{string}}
30* {{class}}
31* {{method}}
32
33They should be used as follows:
34
35 <nowiki>&lt;string>doctype:xhtml-1.0-strict&lt;/string></nowiki>
36
37They will be rendered as follows:
38
39[string] {{'''doctype:xhtml-1.0-strict'''}}
40
41== Tags for examples
42
43If you want to include examples, use the following code:
44
45 <nowiki>
46 &lt;example>
47 &lt;expr>(string-append "foo" "bar")&lt;/expr>
48 &lt;result>"foobar"&lt;/result>
49 &lt;/example>
50 </nowiki>
51
52If your example has more than one line, just put them within ''one''
53{{<expr>}} tag.  Do ''not'' put empty lines in an {{<example>}} tag.
54You can put empty lines within {{<expr>}}, though.
55
56If the example shows some interaction, use this:
57
58 <nowiki>
59 &lt;example>
60 &lt;expr>(prompt-for-number-and-show-factorial)&lt;/expr>
61 &lt;output>Enter a number:&lt;/output>
62 &lt;input>4&lt;/input>
63 &lt;output>24&lt;/output>
64 &lt;result>24&lt;/result>
65 &lt;/example>
66 </nowiki>
67
68If the result of the evaluation is not specified, omit the <nowiki>&lt;result></nowiki> part.
69
70If the example requires some set up to take place before the actual code,
71please add an <nowiki>&lt;init></nowiki> section:
72
73 <nowiki>
74 &lt;example>
75 &lt;init>(use format-modular)&lt;/init>
76 &lt;expr>(format #t "Objs: ~A~%" 24)&lt;/expr>
77 &lt;output>Objs: 24
78 &lt;/output>
79 &lt;/example>
80 </nowiki>
81
82The code in the <nowiki>&lt;init></nowiki> section will probably not be shown to the users unless the explicitly ask for it (ie. will be hidden with JavaScript, or shown with less emphasis than the actual code).
83
84We expect to automatically build a page including all the examples in the wiki, indicating whether or not they pass.
Note: See TracBrowser for help on using the repository browser.