Authoring Online Articles

Online articles should be delivered in a text file called page.src.txt. You can just store your article, together with your figures, in a .zip or .tar.gz article and send it directly to your editor. To make things simpler for our readers, listings are just embedded directly in the article's code; our system automatically reformat long listings so that they won't take up too much screen space.

You should always use a UTF-8-compliant text editor to create your text files. This will ensure that all special characters are encoded properly for our system to read.

Your article should be composed of two sections: the masthead and the body.

The Masthead

The masthead of your article must contain three elements:

For example, suppose you're writing an article on connecting to a MySQL database; your masthead could look something like the following:

  1. =t=Connecting to a MySQL Database=t=
  2.  
  3. =b=Marco Tabini=b=
  4.  
  5. =d=Ever wondered in how many ways you can connect to a MySQL database?
  6. Authors of online articles have been debating this very topic ever
  7. since MySQL was first developed!
  8.  
  9. This article explores the many facets of database connections—from
  10. ''mysql_connect()'' all the way to PDO.=d=
As you can see, Ceres uses special tags to indicate the beginning and end of each element. For example, the =t= tag is used to indicate the beginning and end of the title, while =b= indicates the beginning and end of the byline, and =d= indicates the beginning and end of the deck.

Note that you cannot have any line breaks inside the title or byline. Line breaks are, however, allowed inside the deck.

The Body

Once you have completed the masthead, you can move on to the body of the article. Here, there are only a handful of rules to keep in mind.

First of all, for the most part you can type your text directly as if you were using a word processor; if you need to use characters outside the standard ASCII set, such as accented letters, em-dashes, and so forth, you can type them directly without having to worry about special encoding. On those operating systems that do not support extended character sets natively, most editors usually provide key combinations that make it possible to enter them anyway.

In any case, you need to ensure that, if you use non-ASCII character, your text editor is capable of saving files in UTF-8 format. This is very important, as our system may be unable to properly display your text otherwise.

Other than this particular precaution, there is very little that you need to worry about; paragraphs in your text are separated by two newline characters (in other words, press Enter twice and you've started a new paragraph), and there is no need to indent the first line of a new paragraph.

Formatting Text

Our system supports three types of inline text format:

These three inline formats can, of course, be combined. For example: //**bold italic**// becomes bold italic. You can also escape the tag sequences by prefixing them with a backslash. For example, \ //not italic is printed as “//not italic”.

Headings

Headings (like the one above this line) are used to break up your article into smaller units that the reader can use as reference points to navigate the text. Ceres only recognizes one level of headings, identified by the =h= tag:

  1. This is the last paragraph of the previous section.
  2.  
  3. =h=This is a heading=h=
  4.  
  5. This is the first paragraph of the next section.
Note that the text of the heading must be all in one line (no line breaks!) and that it must be isolated from the previous and next paragraphs by an empty line.

Lists

Ceres only supports unordered lists. A list block is identified by a line that starts with a dash, followed by a space. For example:

  1. This is normal text.
  2.  
  3. - This is the first element of a list
  4. - This is the second
  5.  
  6. - This is the beginning of a new list
  7. - And this is its second element
The source code above will be rendered as follows:

This is normal text.

Note that a list must be preceded and followed by an empty line (which tells the parser to stop looking for list elements).

Code Listings

Code listings are encapsulated by a <code> tag, which must be on a line of its own:

  1. <code>
  2. $x = 10;
  3. $y = 20;
  4. echo $x * $y;
  5. </code>
The source code above becomes:

  1. $x = 10;
  2. $y = 20;
  3. echo $x * $y;
Note that you should not indent the first level of your code, as the system already provides the indentation for you. You should, however, indent any subsequent levels (using either tabs or spaces). For example:

  1. <code php>
  2. $x = 10;
  3. $y = 20;
  4. if ($y > $x) {
  5.   echo $x * $y;
  6. }
  7. </code>
This will result in the following:

  1. $x = 10;
  2. $y = 20;
  3. if ($y > $x) {
  4.   echo $x * $y;
  5. }
As you noticed in this last example, Ceres supports syntax highlighting for PHP code. In fact, it supports highlighting a large number of different languages, which you can specify inside the <code> tag. The list is too long to include here, but chances are that any language you may need to highlight is actually supported by Ceres—including SQL, XML and HTML.

IMPORTANT: code listings should be wrapped at 70 characters.

Tables

Tables can be inserted directly in the body of your article using a syntax that is very similar to HTML (but much simpler and stricter). Here's an example:

  1. <table center>
  2. <tr>
  3.   <th>Position Name</th>
  4.   <th>Level</th>
  5.   <th>Salary</th>
  6. </tr>
  7. <tr>
  8.   <td center>**CEO**</td>
  9.   <td>Senior</td>
  10.   <td right>€100,000</td>
  11. </tr>
  12. <tr>
  13.   <td center>Vice President</td>
  14.   <td>Senior</td>
  15.   <td right>€90,000</td>
  16. </tr>
  17. <tr>
  18.   <td center>Senior Architect</td>
  19.   <td>Senior</td>
  20.   <td right>€70,000</td>
  21. </tr>
  22. <tr>
  23.   <td center>Developer</td>
  24.   <td>Intermediate</td>
  25.   <td right>€50,000</td>
  26. </tr>
  27. </table>
As you can see, the syntax is very similar to straight HTML. In fact, the only difference is that, instead of using align=“center” or valign=“top”, you simply specify one of left, right, center for horizontal alignment and top, bottom and middle for vertical alignment. As you can see above, the aligment parameters can be used to align both table cells and the table itself.

Here's what the table above will be rendered like:

Position Name Level Salary
CEO Senior €100,000
Vice President Senior €90,000
Senior Architect Senior €70,000
Developer Intermediate €50,000

Images

Images can be embedded in your article by using the {{figure}} tag:

  1. {{figure http://picasso.phparch.com/image.php/132920 center}}
This will result in the following:

Images are floated on the current paragraph, and you can align them either to the left, right or center.

Note that you should never embed external images (we did here just to give you an idea of what the figure tag looks like). Instead, you should store your images in a folder and reference them by filename only. You can them archive the folder together with your article and send it to your editor.

For example, suppose you have two images: figure1.png and figure2.jpg. You can store both images in the img folder that you send together with your article to the editor, and then reference them as follows:

  1. {{figure figure1.png}}
  2. {{figure figure2.jpg}}

Note that any images you send must be in one of the following formats: GIF, PNG, JPG (RGB only), TIF (RGB only), BMP. Our software is capable of handling these formats and converting them to a web-readable format.

Callouts

A callout is a section of text that the Ceres interpreter highlights for visibility; you can use it for warnings, notes, or to otherwise attract the reader's attention.

Here's an example:

  1. {{callout You should never run while holding scissors;
  2. it can be bad for your health}}
This will be rendered as follows:

You should never run while holding scissors; it can be bad for your health

Page Breaks

Page breaks can be inserted using the {{pagebreak}} tag on a line of its own:

  1. {{pagebreak}}
An article can have an arbitrary number of page breaks; the system automatically maps the index to the appropriate page and regenerates any dynamic content required on a per-page basis (such as client scripts, for example).

Ceres Resources