M204wiki style guide: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "==Overview== While the most important part of a wiki is the content, following a few simple rules in formatting wiki documentation pages can make it easier for people to use the ...")
 
m (Replaced content with "<p class="warn"><b>Note:</b> This page preserves the history of the page now known as Updating M204wiki, which apparently was created by a copy and paste instead of a ...")
 
(63 intermediate revisions by 6 users not shown)
Line 1: Line 1:
==Overview==
<p class="warn"><b>Note:</b> This page preserves the history of the page now known as [[Updating M204wiki]], which apparently was created by a copy and paste instead of a move of this "M204wiki style guide," which would have saved its history.
While the most important part of a wiki is the content, following a few simple rules in formatting wiki documentation pages can make it easier for people to use the wiki because the consistent look and feel of each page. In addition, following these rules can make it easier to write the pages as standard use of wiki and HTML tags makes it possible to convey information in the format of the text rather than having to state it explicitly.
 
Use of HTML tags and attributes that focus on the semantics of text also has some advantages:
<ul>
<li>It's easier to remember semantic tags and attributes than remembering the physical display characteristics of a certain kinds of text.
<li>It's easier for Sirius to tweak or customize the look and feel of text based on its semantics if the semantics of the text is explicit in the markup.
</ul>
In fact, as a general rule of thumb, if you're coding any explicit physical text attributes in your wiki markup, it's probably a sign that you're doing something wrong or that Sirius needs to expand its list of semantic classes.
 
For example, if you enter <code><nowiki>''Model204''</nowiki></code> or <code>&lt;i>Model 204&lt;/i></code> you're doing something wrong. You <strong>should</strong> enter <code>&lt;var class="product">Model 204&lt;/var></code>. Even if you're trying to emphasize something, like the "should" in the last sentence, you should use <code>&lt;strong>should&lt;/strong></code> not <code><nowiki>'''should'''</nowiki></code> or <code>&lt;b>should&lt;/b></code> though, admittedly, <code>&lt;strong></code> doesn't tell one a heck of a lot about the semantics of the enclosed word or words.
==Headers==
The outermost headers on any page should be level two headers so should have two equals sign on either side:
<p class="code"><nowiki>==This is a header==</nowiki>
</p>
==Syntax diagrams==
One of the most common documentation structures is syntax diagrams. Syntax diagrams show the format of a command, statement, or method invocation. While in an ideal world there would be a nice macro language for specifying the key elements of a syntax diagrams, we don't live in an ideal world so most of work of indicating syntax must be done manually.
 
The first rule of syntax diagrams is that they must be contained inside a <code>&lt;p></code> element with a class of <code>syntax</code>:
<p class="code">&lt;p class="syntax">
... syntax diagram goes here
&lt;/p>
</p>
There are other rules that must be observed:
<ul>
<li>All keywords that must be typed literally as in the syntax diagram must start with an upper case character.
<li>All syntax terms that are <strong>not</strong> literals should start with lower case letters.
<li>[http://en.wikipedia.org/wiki/Camel_case Camel case] should be used for artifical compound word such as, for example, <code>veryImportantParameter</code>. Of course, keywords can also use this kind of captilization but, because keywords must begin with upper case characters, the casing is, strictly speaking, referred to as [http://en.wikipedia.org/wiki/Pascal_case Pascal case].
<li>Optional words or phrases must be inside of square brackets. These can be nested if, for example, an optional keyword appears inside an optional clause. Note that for <var>Callable</var> methods, the target (including the equal sign) should be inside square brackets. Note also that, strictly speaking, the syntax diagram for functions is not really correct as a function can be used in a context where its result is not assigned to a variable, but the standard syntax diagram shows an assignment to a variable. It's not obvious how we can make the syntax diagram more accurate without losing information or making it needlessly complex.
<li>Similary, methods can apply to variables or the results of expressions. This dichotomy <strong>can</strong> be expressed by not using the percent sign in the syntax term for the method object (nor for parameters). This "rule" is currently not followed everywhere &mdash; some places use the percent sign at the start of syntax terms that might be variables or results of expressions and some don't. For now, the recommendation is that the percent sign be used only where a percent variable is required. Perhaps, some day, this will turn into a rule. 
<li>The standard <var class="product">Model 204</var> continuation character dash (<code>-</code>) should be used to continue each line where the syntax is continued on the next line. While more than 90% of the time, syntax diagrams will refer to a single line statement or a command, it's still good discipline to stick with this rule so multi-line syntax is obvious.  
</ul>
==Examples==

Latest revision as of 01:17, 1 January 2014

Note: This page preserves the history of the page now known as Updating M204wiki, which apparently was created by a copy and paste instead of a move of this "M204wiki style guide," which would have saved its history.