On 31/08/06, Kang-min Liu <[EMAIL PROTECTED]> wrote:

On 2006/8/31, at 上午 12:34, Andrew Morgan wrote:

> I find it pain to add a double space at the beginning of each line if
> I want to add a big chunk of code to my pages.
>
> Is there any other way of putting in code?
> Some bulletin boards have a [CODE] [/CODE] command that contains
> the code.
>
> I know that those commands are specific to those boards, but I was
> wondering whether the principle could be applied.
> i.e. only need a command a the start and at the end of the code block
> instead of on every line


Try the ".pre" wafl block like this:

.pre
print "Hello";
.pre

It'll generate a <pre> element. Also, Kwiki::ShellBlock for shell
commands:

.shell
     % cat foo       # ...
     $ less bar      # ...
     C:\> type baz   # ...
.shell


Cheers,
Liu Kang-min
[EMAIL PROTECTED]





Thanks. I eventually got .pre to work when I realised that it required
the Kwiki::PreformattedBlocks plugin.
It creates the elements like this  <pre class="formatter_pre"> </pre>

Obviously this links to the CSS and how it appears is how
class="formatter_pre" is defined.
However, what if you wanted one style for code and one style for
things like signatures.
Would I have to create a new plugin to do this? Maybe copy
PreformattedBlocks and make a ".pre2" command that created the <pre>
elements with a different class style attribute?

Would this be easy enough, considering I have never made a plugin
before (or even programmed in Perl)?

Or is there a better way to do it?


/Andrew

Reply via email to