Making list with multiline and/or Code macro

Hello everyone,

I recently setup an xwiki instance to migrate from Trac wiki.

I currently have a 10.4 xwiki community.

I noticed some of my listings are broken.

I have the following code:

  1. Set the data directory. This should be “data” or the running Wig executable won’t be able to find the data properly.

{{code}}
setndenv DvRoot data
{{/code}}

  1. To run the Code IDE for Wig, you MUST launch it from the command line with:

{{code}}
rvl_id.sh
{{/code}}

  1. Running a program

I need to put space between the listing and code macro, but this seems to break the number listing.

instead of having

  1. Set the data directory. This should be “data” or the running Wig executable won’t be able to find the data properly.
    [THE CODE Content]
  2. To run the Code IDE for Wig, you MUST launch it from the command line with:
    [THE CODE Content]
  3. Running a program

I get :
1 Set the data directory. This should be “data” or the running Wig executable won’t be able to find the data properly.
[THE CODE Content]
1 To run the Code IDE for Wig, you MUST launch it from the command line with:
[THE CODE Content]
1 Running a program

Is that possible to have listings with multi-line or even code macro inside?

Hi
you can try to add the newlines with Shift+Enter before and after the code macro (this works most of the time) or you can add a group markup ((( ...))) in the source view, see Group Markup in Xwiki Syntax Guide, e.g.

1. Text (((
CODE
)))
1. More Text (((
MORE 
CODE
)))

Hello,

Thanks for replying, I will try this solution out as it could be helpful later, but as of now, I solved my problem by doing this:

I switched from code macro to varbatim block ( {{{ )
I made a style object to modify the span class of verbatim to mimic a {{code}} styling.
It looks like this :
pre {
background: #f7f7f7;
border: 1px solid #d7d7d7;
margin: 1em 1.75em;
padding: .25em;
overflow: auto;
}

.wikimodel-verbatim {
width: 100%;
display: inline-block;
font-family: sans-serif;
white-space: pre-wrap;
background-color: #f7f7f7;
border: 1px solid #d7d7d7;
margin: 1em 1.75em;
padding: .25em;
overflow: auto;
}

I need 2 different style override as using the verbatim class inline and outline does not use the same class once the page is generated.

so far it looks ok, but I will have a look at what you suggested.

Cheers,

Hi,

I may be overdoing it but I’m not a huge fan of solutions that mimic looks. Markup gives a meaning to things.

Having code in a code macro explicitly makes clear that it is code. Having code in a verbatim blocks just tells you that there is something that the interpreter should not touch.

Consider the following examples.

  1. This {{code}} generates this {{{output}}}

  2. This {{{output}}} is generated by this {{code}}

  3. This {{{code}}} generates this {{{output}}}.

Now try to extract the code via script.
Maybe I have converted too many <pre> to code/source macros already. :slight_smile:

Hi,

I did not realise how useful this would be. I used to put a newline whenever I used a macro like HTML, flash, table of content… Now I just need to wrap my macro in between ((( ))) and the wiki is all happy.

Using group is the way to go, too bad the documentation does not really state that macro can be used inline if using group syntax. It would have simplified my task a lot.

Thanks again for taking the time to find a solution for me.