Help:Adding a new programming example: Difference between revisions

From Rosetta Code
Content added Content deleted
m (→‎Navigation: Fixed mentions of GCC to point to compiler, not collection)
(Updated a few things)
Line 1: Line 1:
So you want to contribute code, eh? If you've used wikis before, it's actually very easy. If not, then you'll need a few pointers to get started.
So you want to contribute code, eh? If you've used wikis before, it's actually very easy. If not, then you'll need a few pointers to get started.


==Every page is editable (almost)==
==Every page is editable (almost)==
Almost every page in the wiki is editable. Even this page is editable. (See that tab at the top labeled "edit"?)
Almost every page in the wiki is editable. Even this page is editable. (See that tab at the top labeled "edit"?)


To edit a wiki, you need only click that "edit" tab, make changes in the text field on the resulting page, and click Submit. Really, though we'd rather you clicked Preview first, and then clicked submit once you were satisfied with how it looks.
To edit a wiki, you need only click that "edit" tab, make changes in the text field on the resulting page, and click Submit. Really, though we'd rather you clicked Preview first, and then clicked submit once you were satisfied with how it looks.


==Navigation==
==Navigation==
To add your own programming example, you must [[:Category:Solutions by Programming Task|navigate]] to the programming task to which you wish to add a solution to. Once you find your task, go ahead and click the Edit tab at the top of the page, find the place in the list of languages already applied where your language would fall alphabetically, and make your changes.
To add your own programming example, you must [[:Category:Solutions by Programming Task|navigate]] to the programming task to which you wish to add a solution to. Once you find your task, go ahead and click the Edit tab at the top of the page, find the place in the list of languages already applied where your language would fall alphabetically, and make your changes.


In order to maintain the readability, searchability and browseability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these [[Help:Programming Example Prototypes|programming example prototypes]]. A simple example should look something like this:
In order to maintain the readability, searchability and browseability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these [[Help:Programming Example Prototypes|programming example prototypes]]. A simple example should look something like this:


<nowiki>
<nowiki>
=={{header|C}}==
=={{header|C}}==
'''Compiler:''' [[gcc]] 4.0.1
{{works with|gcc|4.0.1}}
{{libheader|SDL}}
int main ( void ) {
int main ( void ) {
// Some code here
// Some code here
}</nowiki>
}</nowiki>


You don't have to use the C programming language, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you. To create a link, surround the text with double square brackets. For example, [[gcc]] would be represented as <nowiki>[[gcc]]</nowiki>.
You don't have to use the C programming language, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you using the "works with" template. You should also note any special [[libraries]] you use with the "libheader" template.


Finally, note the importance of the extra space in front of the code. That creates a dashed box around the code sample, and puts it in a monospace font.
Finally, note the importance of the extra space in front of the code. That creates a dashed box around the code sample, and puts it in a monospace font. Another option (popular for use with [[Python]] programs because of their whitespace scope) is to enclose code in <nowiki><pre></pre></nowiki> tags.


==Formatting==
==Formatting==
Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has [[JavaScript]] enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar.
Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has [[JavaScript]] enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar. See [[Help:Formatting]] for more help.


==Before you go==
==Before you go==

Revision as of 23:58, 7 March 2008

So you want to contribute code, eh? If you've used wikis before, it's actually very easy. If not, then you'll need a few pointers to get started.

Every page is editable (almost)

Almost every page in the wiki is editable. Even this page is editable. (See that tab at the top labeled "edit"?)

To edit a wiki, you need only click that "edit" tab, make changes in the text field on the resulting page, and click Submit. Really, though we'd rather you clicked Preview first, and then clicked submit once you were satisfied with how it looks.

Navigation

To add your own programming example, you must navigate to the programming task to which you wish to add a solution to. Once you find your task, go ahead and click the Edit tab at the top of the page, find the place in the list of languages already applied where your language would fall alphabetically, and make your changes.

In order to maintain the readability, searchability and browseability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these programming example prototypes. A simple example should look something like this:

 =={{header|C}}==
 {{works with|gcc|4.0.1}}
 {{libheader|SDL}}
  int main ( void ) {
       // Some code here
  }

You don't have to use the C programming language, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you using the "works with" template. You should also note any special libraries you use with the "libheader" template.

Finally, note the importance of the extra space in front of the code. That creates a dashed box around the code sample, and puts it in a monospace font. Another option (popular for use with Python programs because of their whitespace scope) is to enclose code in <pre></pre> tags.

Formatting

Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has JavaScript enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar. See Help:Formatting for more help.

Before you go

Now, why don't you wander over to the Sandbox and apply what you've learned?