FAQ 写文章
出自Gentoo Linux Wiki
| 一般 • Portage • Wiki |
目录 |
[编辑] 介绍
This article may be merged with some other in the future. The purpose of this page is to describe how to correctly create and format articles on this wiki. Feel free to look at the source code of this page by clicking the edit link above.
[编辑] Development
This article is under development by the admins. If you have any suggestions, please bring them up on the talk page or the devel mailing list.
[编辑] Trying this out
There is a safe place for you to try out what you learned. It's called the Sandbox.
[编辑] Outlining your document
It's usually a good idea to put section headers between == tags. Simply put equal signs on both sides of the heading on its own line. While using = Someheading = as a heading is acceptable, it creates awfully large fonts. For most articles, two equal signs is the level that should be used for headings. To create sub-headings use more equal signs. For example, the following will create a heading called Introduction with some text, and a subheading Abstract with some text.
| 代码: Example of Headers |
== Introduction == Hello World. === Abstract === This is the project abstract. Its heading appears smaller, and at the top outline is indented. |
[编辑] Preventing Wikification
Everything between <nowiki> and </nowiki> will not be wikified (processed by the wiki engine).
There are two other ways. The first is to use the <pre> tag. It works just like the <nowiki> tag, except that the contents of the tag are put in a box and it looks better than <nowiki> when spanning over multiple lines.
The second way is to add a space at the beginning of the line. It works just like the <nowiki> tag, except that some basic formatting is still available and the contents of the tag are put in a box. For example, you can still
link to articles.
Beware, it doesn't work very well in boxes.
To combine <nowiki> and a leading space works, but avoid doing it. Rather use the <pre> tag in those cases.
[编辑] Don't use HTML
It is usually not necessary to add raw HTML to wikis. Please use the formatting specified on the Help:Editing page. Bookmark that page and refer to it whenever you feel the itch to use plain HTML.
[编辑] Line breaks
If you need to make space between paragraphs, hit the Enter/Return key twice (you should have one blank line between paragraphs). There is no need for double <br /> tags. You can use the <br /> tag if you need to insert a single line break
like this one.
[编辑] Tables
Tables are explained in depth here.
[编辑] Other tags
- The <p> is not needed. Paragraphs are automatically created at double line breaks.
- The <hr /> tag can be created by typing ---- on its own line. But please don't, because its usually not needed. And whatever you do, do not place it at the top of your document. This may break Categories and Templates. Really, the only time it's reasonable to use <hr /> is when you're separating discussions on your own UserTalk page, and even then you can just use headings.
[编辑] Boxes
[编辑] The Gray Box
The gray box is what we use for code to be typed into a terminal, and also it's nested inside other boxes' content. To make a gray box you can:
- Put a space at the beginning of each line you want boxed. Note that if you use the '=' (equal sign) character, you should use the next method(s).
- Encapsulate the commands in <pre> tags
- Place a space at the beginning of a line followed by the <nowiki> tag, your content, and a </nowiki> tag at the end. Note, any extra spaces after the opening <nowiki> tag will be printed verbatim.
| 代码: Gray Box Nowiki Tags Example |
<nowiki>This line contains the = character and will not work if we don't use the <nowiki> tag.</nowiki> echo "bar" # this just has a space as the first character on the line |
will produce:
This line contains the = character and will not work if we don't use the <nowiki> tag. echo "bar" # this just has a space as the first character on the line
[编辑] Code, File, and Kernel Boxes
There are two colored boxes that gentoo-wiki uses. Boxes for Code and boxes for Files. Note: Code does not mean what you type into the terminal. Just use a gray box (see above) for that. Code boxes are used for program output, or actual programming code.
Colored boxes are a little more complex than what we've done so far. The format for creating a colored box is: {{Box Type|title|content}}. For editing readability, please start the content on a new line. Lets make one! The Code box is what you've seen throughout this wiki. The title is usually the program name. Then the output is placed in a gray box, with comments not in the gray box. Another example is the File box, which is red, and is used to denote the contents of a particular file. The last example, is the kernel box, which is "make menuconfig" for kernels. Here I chose to use a <pre> tag to make the gray box inside:
| 代码: making a kernel |
{{Box Kernel| Kernel Box Example|
Code maturity level options --->
[*] Prompt for development and/or incomplete code/drivers
[*] Select only drivers expected to compile cleanly
}}
|
will produce the following:
| Linux Kernel Configuration: Kernel Box Example |
Code maturity level options ---> [*] Prompt for development and/or incomplete code/drivers [*] Select only drivers expected to compile cleanly |
[编辑] Explanations
If you need to explain what you doing in-line with your code/file, simply break out of the preformatted text or use appropriate comment characters. Example follows:
| 代码: bash script |
#!/bin/bash echo "here I am using preformatted text to show you code" mutt # everything following the # character is a comment, so I can explain what I do emerge gcc This text is no longer preformatted, so I can use this space to explain the above command. # and so on |
[编辑] Template Quirks
Some characters need to be entered as HTML entities when used in boxes.
| Character name | ASCII | HTML Entity |
|---|---|---|
| Equality sign | = | = |
| Vertical bar (pipe) | | | | |
Alternatively, you can surround the problematic characters/lines with <nowiki></nowiki> tags.
[编辑] Filename and Useflag
These are awfully simple commands. The {{Filename}} tag is used to display the location of a file, and {{Useflag}} is used to specify a use flag. For example:
| 代码: Using Filename and Useflag |
And make sure that {{Useflag|gnome}} is specified as a useflag in {{Filename|/etc/make.conf}}.
|
will produce:
And make sure that gnome is specified as a useflag in /etc/make.conf.
[编辑] Codeline/Commandline
This is probably the most misunderstood tag. But don't let that intimidate you, the {{Commandline}} tag can make your articles much more readable when used correctly. {{Commandline}} is just for that -- a line of code, which is usually a command to be entered at the prompt. Commandline is designed for a single line. It's just a quick "do this" in your article. {{Commandline}} does not go on its own line. For commands that span more than one line, use a gray box or the appropriate colored box.
{{Codeline}} can still be used but is deprecated.
[编辑] Good Example
| 代码: Appropriate use |
After emerging your new kernel sources run {{Commandline|make menuconfig}} and
configure your kernel.
|
which produces: After emerging your new kernel sources run make menuconfig and configure your kernel.
[编辑] Bad Example
| 代码: Inappropriate use |
Now emerge some kernel<br>
{{Commandline|emerge gentoo-sources}}<br>
|
which produces:
Now emerge some kernel
emerge gentoo-sources
Note: This was wrong because {{Commandline}} was placed on its own line, and because the author had to use a <br /> tag to do it.
[编辑] ChangeLogs
There is no need to use ChangeLogs on the actual wiki pages. The wiki itself is capable of keeping track of changes. Just use the comment box when editing to specify what was changed.
