Toolbox: Difference between revisions

    From KDE UserBase Wiki
    (→‎Add a code snippet: corrected spelling error)
    (→‎Add a link: corrected spelling of myLanguage, and clarified the reasoning for using the special link markup)
    Line 117: Line 117:
    There are two kinds of links to learn, internal ones, to another userbase page, and external URL links.
    There are two kinds of links to learn, internal ones, to another userbase page, and external URL links.


    For an internal link the format <nowiki>[[PageLayout]]</nowiki>, where you want to display the name of the page, does work, but it is not ideal, particularly for translation to docbook.  It is better to use the form <nowiki>[[Special:myLanguags/PageLayout|Page Layout]]</nowiki>, as it avoids problems at the translator stage. You often need to include the link in a sentence, so in that case you would use  
    For an internal link the format <nowiki>[[PageLayout]]</nowiki>, where you want to display the name of the page, does work, but it is not ideal, particularly for translation to docbook.  It is better to use the form <nowiki>[[Special:myLanguage/PageLayout|Page Layout]]</nowiki>, as it directs to the correctly translated page, if one exists. You often need to include the link in a sentence, so in that case you would use  


    {{Input|1=<nowiki>[[Special:myLanguage/PageLayout|this page]]</nowiki>}}
    {{Input|1=<nowiki>[[Special:myLanguage/PageLayout|this page]]</nowiki>}}

    Revision as of 10:30, 26 January 2011

    Information

    This page offers examples of formatting code for common tasks


    Do not add an i18n language bar

    {{Template:I18n/Language Navigation Bar|Toolbox}}

    New pages should not have this language bar. It related to the old style of translation and will not work with page translation extension. The new style language bar will be added by the software when the first translation is made.

    Add an introductory screenshot and description

    Whenever possible we begin an application's top-level page with this. The code to achieve it is

    {|class="tablecenter vertical-centered"
    |[[Image:YourScreenshot.png|250px|thumb]]
    |Your descriptive text
    |}
    

    Format your text

    Use Headings

    Headings automatically form part of your Table of Contents, so need to be structured. Their place in the tree is governed by multiple '=' characters at each end of the heading. Avoid using a single one - that denotes a page heading, and the automatic page heading should be used. Your major headings will use '==text goes here==', the next level, '===more text===' and so on.

    Use bold and italic

    Blips are used to specify bold and italic words.

    Use '''bold text''' to specify bold text and ''italic text'' to specify italic text.

    In order to ensure we get easy and accurate translations, please adhere to the typographical guidelines.

    Add a code snippet

    We distinguish code that the user inputs from terminal output by the use of templates. {{Input|1=this piece of code is input by the user}} displays

    this piece of code is input by the user

    Code output by a terminal is shown similarly, using {{Output|1=the user would read this in konsole}} which displays as

    the user would read this in konsole

    Be aware that very long lines can be problematic. Wherever possible display the code in reasonably short lines.

    Note, that space characters at the beginning of a line are eaten by the template parser. If you need to indent code lines use nonbreakable spaces, or use the templates {{Tab}}, {{Tab2}}, {{Tab3}}, {{Tab4}} which inserts respectively 4, 8, 12 and 16 spaces. For example, you can write

    {{Input|1=No indent
    {{Tab}}indented one tab
    {{Tab3}}indented three tabs 
    }}

    to get

    No indent
        indented one tab
                indented three tabs

    For some reason, the Tab templates produce to much vertical spacing if the Input (or Output) template immediately follows on the same line as the preceding text. Start the Input template on a new line!

    Beware, that in templates, the pipe character (|) is used to separate arguments - even when the template only takes one! If Your code snippet contains pipe characters, they have to be entered as a character code or you can use Template:! like this: {{Input|1=some code {{!}} more code}} displays

    some code | more code


    You can also combine input/output areas with GeSHi syntaxhiglighting. An input area like this

    {{Input|<syntaxhighlight lang="php" line>
    # Initialise common code
    $preIP = dirname( __FILE__ );
    require_once( "$preIP/includes/WebStart.php" );
    </syntaxhighlight>}}

    will result in

    # Initialise common code
    $preIP = dirname( __FILE__ );
    require_once( "$preIP/includes/WebStart.php" );
    

    Add indents

    ":" is used for an indent, and was used in multiples in some old pages. This is deprecated, and causes some problems, so the multiples will be removed as they are found. A single ":" indents by four characters.

    Lists, numbered and bulleted

    * is the symbol to use for bulletted lists. ** gives a second level:

    * One star
    * Next point
    ** Sub-point
    * Third point

    produces

    • One star
    • Next point
      • Sub-point
    • Third point

    Numbered lists are produced in the same way, using '#'.

    # A single hash
    # Second point
    ## A sub-point
    # Third point

    produces

    1. A single hash
    2. Second point
      1. A sub-point
    3. Third point

    This is less useful than the bulletted list.

    Add a link

    There are two kinds of links to learn, internal ones, to another userbase page, and external URL links.

    For an internal link the format [[PageLayout]], where you want to display the name of the page, does work, but it is not ideal, particularly for translation to docbook. It is better to use the form [[Special:myLanguage/PageLayout|Page Layout]], as it directs to the correctly translated page, if one exists. You often need to include the link in a sentence, so in that case you would use

    [[Special:myLanguage/PageLayout|this page]]

    which displays

    this page

    External links are slightly different so

    [http://techbase.kde.org/Schedules our road map]

    displays

    our road map, which would take you straight to the techbase page.

    One last thing to note - when you preview your page, the links are live. This gives you two benefits. You can check (by hovering) that your links are set up as you expected, and you can use a red link to create a new page.

    Illustrate your text

    Add a single image, centered

    [[Image:KMail-kde4.png|250px|center]]

    Note that you can change the position of the image, but the default is left. The size of the image depends on the circumstances, but for screenshots I recommend no less than 250px and no more than 500px.

    Make the image clickable, and add a caption

    Where you need to show more detail, create a moderately sized image, clickable, so that the full-size can be seen. Simply add the parameter '|thumb' within the image parentheses.

    A caption can also be added as a parameter, but will only show if '|thumb' is present.

    Use tables to precisely place multiple images

    {|class="tablecenter" style="border: 1px solid grey;"
    |[[Image:Desktop-config-customized.png|230px|center]]||[[Image:Desktop-settings-rightclick.png|230px|center]]
    |-
    |[[Image:Desktop-theme-details-dialog.png|230px|center]]||[[Image:Plasma-multiple-themes.png|230px|center]]
    |}

    displays


    Note that all the parameters for one image are contained within [[...]], and cells are separated by '||'. To start a new line, insert '|-' on an otherwise-empty line, then '|' at the start of the next one.

    Add Notes and Warnings

    Where a note or warning is relevant within your text, use these templates:

    {{Info|This is general information}} displays

    Information

    This is general information


    {{Note|Some important information at this point}} displays

    Note

    Some important information at this point


    {{Tip|A helpful piece of advice, something to remember}}displays

    Tip

    A helpful piece of advice, something to remember


    {{Warning|Take care - this is a dangerous thing to do}} displays

    Warning

    Take care - this is a dangerous thing to do


    KDE3 and KDE SC 4 versions of applications

    By default, KDE SC 4 is assumed. If the KDE SC 4 version is not yet ready for release, or where only a KDE 3 version exists, it may be necessary to document the KDE3 version. In this case you should add an icon {{KDE3}} which displays Should you be writing about a KDE3 version and KDE SC 4 version on the same page, use icons for both - {{KDE4}} which displays

    Other Useful Templates

    Community Applications

    The final consideration concerns those applications which are not distributed as core KDE applications. These need to be indicated by an icon, placing {{Community-app}}


     See footnote


    at the end of your sentence or line, just as you would to denote a footnote in general writing. You then need to add {{Community-app-footnote}} which will create a footnote, like this:



    Support for this application can be found from the project's home page


    Making major edits to Existing Pages

    If a page is likely to be open for editing for some time there is a danger of conflicts - someone else may edit at the same time, and saving your edit will cancel out theirs, or vice versa. The way to avoid that is to make a temporary entry, directly under the language bar, using {{Being_Edited}} which will display

    Currently Being Edited

    This page is currently being edited.
    If this notice persists for an unreasonable time, please either notify irc.freenode.org #kde-www or report on Claus chr's Talk page

    Note: Pages should not normally be marked for translation while they are being actively worked on


    Don't forget to remove it when you have finished!

    Adding a new complex page

    If you need to be able to work on a page for quite some time, over several days, for instance, you may like to use the Construction template - {{Construction}}, which displays

    Under Construction

    This is a new page, currently under construction!


    Links to Pages in the Neighbourhood

    You can add links to a preceding or a following page using the following templates as described here:

    {{Prevnext|Previous Pagename|Following Pagename|The page before this page|This page you should read later}}


    For first pages with no preceeding page or last pages with no following page use this:

    {{Next|Following Pagename|This page you should read later}}
    {{Prev|Previous Pagename|The page before this page}}


    Adding a List of Sub-Pages

    {{Input|1=== Subpages of {{FULLPAGENAME}} == {{Special:PrefixIndex/{{FULLPAGENAME}}/}}

    is very useful when you want to list subpages with active links, such as

    Subpages of Toolbox

    It does, however, also list all "other-language" pages, so use with discretion.