Style guide

Revision as of 02:58, 7 May 2013 by Guomubai (talk | contribs)

This page gives example code and advice for styling the wiki. If editors stick to these guidelines, the Chinese Grammar Wiki will have a consistent style and appearance, which is beneficial to users.

Chinese Grammar Wiki articles always have an introduction, and there is usually a grammar structure section, an example sentences section, and a further reading (sources) section. As long as you have two or more sections, there will be a "contents" box that automatically comes up.

Most articles follow this basic pattern, though some do not. Some basic grammar patterns in A1 and many of the comparison articles follow different patterns, though they are based on the above framework. Some of the tricker/more complicated grammar points have long articles with multiple sections. Ultimately, it is up to the editor to decide what works best.

Introduction Section

Every article begins with an introduction that summarizes the grammar point. In the introduction paragraph, when the grammar point is first introduced, the pinyin is provided in parentheses. Like this 例子 (lìzi).

Grammar Structure

After the introduction, there is a section for the grammar structure (or pattern). They are set in a special code called "jiegou".

Wrap structures (or patterns) in a <div> with class jiegou. Be sure to leave a blank line after opening the <div> and before closing it with a </div>.

Subject + 把 + Object + Verb

Note that the text inside the "structures" class is enlarged, but no spaces are collapsed, as they are with tables and lists with the class liju.

Usually the grammar structure section uses linguistic terms like "subject", "object", "verbs" etc., however we can be flexible sometimes. For example, grammar patters like this one use terms like "cause" and "effect".

When writing an example, some parts of speech are too long and should be abbreviated:

  • Noun, Subject, Object, Verb: okay to spell out
  • Adj, Adv: Should be abbreviated

Make sure to put a space between between each element of the grammar pattern (between each word and symbol).

EX: Subject + 在 + location + verb phrase

Besides the grammar pattern, this section may also include other information that would be helpful, such as context, situations the grammar pattern is used in, or any other information.

Example sentences

Example sentences are a vital part of the Chinese Grammar Wiki. To effectively use them, make sure you do the following.

Lists

Example sentences usually come together as a group of lists.

Wrap the entire list (or lists, if you want separate sections) in a <div> with class liju. Separate words with spaces. Be sure to leave a blank line after opening the <div> and before closing it with a </div>.

A single list of example sentences:

  • 你 有 没有 记住 我的 名字?
  • 他 是 不 是 我们 昨天 看到 的 人?

A group of lists with example sentences:

  • 谁 能 把 ‘ 打喷嚏 ’ 的 ‘ 嚏 ’ 写 对
  • 我们 刚才 听到 的 音乐 是 哪个 乐队 的 ?
  • 你 有 没有 记住 我的 名字?
  • 他 是 不 是 我们 昨天 看到 的 人?

A list of example sentences, some of which are correct, and some of which are incorrect. Note: for this type of list, an HTML list must be used instead of the normal wiki shorthand list so that the individual list item elements (<li>) can be styled with the proper CSS classes.

  • 作业 做 完 了 吗 ? (This is a comment to add some explanation.)
  • 你 把 作业 了 吗 ?
  • 作业 做 完 了 吗 ?
  • 你 把 作业 做 做 完 了 吗 ? (This is a comment to add some explanation.)
  • 作业 做 完 了 吗 ?
  • 作业 做 做 完 了 吗 ?

Note the "(This is a comment to add some explanation.)" in the above examples. This is a bit of text that can be used to set up a context or add other details that puts the example sentence into a proper perspective.

If you ever need to add spaces back into text inside a list which is wrapped in a <div> with class liju, there are two ways to do it:

  1. For small chunks of texts, wrap the target text in a <span> tag with class spaced. Note that class expl has its own style, which includes normal spacing between words (see the code above).
  2. For entire lines in cases where you're using an HTML list, simply add the class spaced to the appropriate <li> elements. You can add multiple classes to one element, as long as you put a space in between the names (example: <li class="x spaced">).

Remember: if most of the list is in Chinese (is should be the case with examples sentences), wrap the whole list in a <div> with class liju to get the proper style, then target the English content with a <span> tag with class spaced. If most of the table is in English, don't wrap the whole table in a <div> with class liju; instead just target the Chinese content with a <span> tag with class liju. (Note that in this case, the style of the list will look totally different.)

Individual Sentences

Sometimes you may need to just use a single sentence as an example (specifically, within other texts). Style individual example sentences as described below.

The wiki uses mainly <div> tags to enclose groups of sample sentences in tables or lists, but occasionally also makes use of <span> tags for snippets of Chinese within other text. Whether it's a <div> tag or a <span> tag, however, both shoul