www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

How do you put code in a Wiki page ?
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=3&t=110
Page 1 of 1

Author:  SteveO [ Fri May 23, 2008 2:13 pm ]
Post subject:  How do you put code in a Wiki page ?

I'm trying to write a Wiki page and want to put some code in. I've seen that these tags are used;

<code>
</code>

However, although I can see this working for Francis's pages I cannot get it to work for mine. the following;

<code>
hello
world

</code>

Just doesn't work, comes out just printing "hello world" with no borders or anything. It's driving me spare. I can copy and paste Francis' example and that's fine but if I try editing what Francis has done it stops displaying correctly, even just putting a line at the top of his code.

I'm really really puzzled, is it anything to do with carriage returns (that I may be invisibly copying from Francis example) but are not being entered when I type in manually.

Help please :)

Also are their any good offline Wiki Editors to make editing Wiki pages easier ? When I tried looking for one I was unsure if it'd work with this Wiki engine.

Author:  Samwise [ Fri May 23, 2008 4:44 pm ]
Post subject:  Re: How do you put code in a Wiki page ?

Steve,

Ignore the <code> tags, they're superfluous in Francis' wikicode.

By simply indenting each line with a space, the text is stopped from being reformatted (it still interprets Wiki markup and special characters, like &rarr;):

hello

world

Alternatively, the <pre> tags will also stop the text being reformatted, but will instead ignore Wiki markup (but not special characters, like &rarr;):

<pre>
hello
world
</pre>

Useful link on Wikitext, the markup language, found through the Help page here:

http://meta.wikimedia.org/wiki/Help:Wikitext

They might exist, but I've not personally gone looking for an off-line editor, persay, though someone may also have written a definition language template for syntax colouring in popular programming editors (maybe Notepad++?) - you'd have to look. I think I've heard you might be able to use TiddlyWiki as an off-line wiki and then synchronise it with an online MediaWiki wiki, such as ours, using plugins - though I've never tried it.

Sam.

Author:  SteveO [ Fri May 23, 2008 9:45 pm ]
Post subject:  Re: How do you put code in a Wiki page ?

Thanks Sam,

No time till Sunday or Monday now to add my article but that's a great help, I've always found Wiki pages hard to work out, that guide will come in handy.

I'd have never dreamt of just starting with a space char !

Author:  FrancisL [ Mon May 26, 2008 4:16 pm ]
Post subject:  Re: How do you put code in a Wiki page ?

My code was inserted straight from spooled programs so automatically had a space character prefixed to each line. I guess my pages just worked by luck! :D

I didn't know that the [code] tags were not needed, but to be honest I prefer them so that it is clearer while editing to see what is what.

Kind regards,

Francis.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/