Erlang Central

How to write HowTo's

From ErlangCentral Wiki

Contents

Author

User:Ludvig

Creating HowTo's

Introduction

The best way to start creating a new HowTo article is to look at the source of all the other HowTo's. The HowTo articles can be seen in Home Page - Learn Erlang - Tutorials. This is the best way to promote your article and let the others see.

Creating A New Page

A simple way to create a new Wiki page is to edit a URL to the title of the new page.

For instance, for a new page called 'Grokking OTP Principles' you can simply browse to a new URL that looks like this:

http://erlangcentral.org/wiki/index.php?title=Grokking_OTP_Principles

Creating a new page

Adding New Article To HowTo Category

The only thing you need to do to create a HowTo is to add the new article in to the HowTo category.

This is done by adding the line at the bottom of your HowTo article:

[[Category:HowTo]]

This will then automatically add the article to the HowTo category:

http://erlangcentral.org/wiki/index.php?title=Category:HowTo


You can also tag your article with multiple categories:

[[Category:HowTo]] [[Category:BasicErlang‏‎]]


Check the other existing categories here:

http://erlangcentral.org/wiki/index.php/Special:Categories

Embedding Erlang Code

Inserting Code

Erlang code can be embedded in pages using the <code></code> tags.

For example:

<code>
-module(myapp_bootstrap).
-export([start/0]).
  
start() ->
    odbc:start(),   
    application:load(myapp),
    application:start(myapp).
</code>

Result output:

-module(myapp_bootstrap).
-export([start/0]).
  
start() ->
    odbc:start(),   
    application:load(myapp),
    application:start(myapp).

The code tag can take a 'caption' attribute which will cause a caption to be displayed for the snippet. It is a good idea to use the code tags rather than try and format code samples yourself since future extensions to the Wiki will include syntax highlighting for appropriately marked up code.


Code Snippet

You can insert a code snippet and indicate the file name.

{{CodeSnippet|reltool.config|<pre>
...
{rel, "MyApp", "1.0.0",
    [kernel,
     stdlib,
     odbc]
},
...</pre>}}

Result output:

reltool.config

...
{rel, "MyApp", "1.0.0",
    [kernel,
     stdlib,
     odbc]
},
...


Text Section

You can also create a text section by just putting a space in front of each line: *space*Text Line 1.

Result output:

Text Line 1
Text Line 2
Text Line 3