Line wrapping in Code Macro

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Line wrapping in Code Macro

Jamal
Hi,

Is there a way to force line wrapping in the Code macro? Right now, long lines simply extend outside the bounds of the box.

Thanks,

Jamal
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

vmassol
Administrator
Hi,

On 17 Dec 2014 at 19:59:53, Jamal ([hidden email](mailto:[hidden email])) wrote:

> Hi,
>  
> Is there a way to force line wrapping in the Code macro? Right now, long
> lines simply extend outside the bounds of the box.

The code macros displays the code exactly as it is.

However you can customize the CSS used if you wish by using the syntax (in XWiki Syntax 2.0+):

(% style=“…css here…” %)
{{code}}

{{/code}}

See http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HParameters

Thanks
-Vincent


> Thanks,
>  
> Jamal
>  
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

Jamal
Thanks for the reply, Vincent.

That was my first thought, but here's the weird thing: when I add CSS styles that way, the code block ends up getting rendered as a paragraph (<P> tag) with the style applied in a SPAN, instead of being rendered in a DIV as it normally is.

This changes the look completely, and with forced line breaks it gets quite messy.

But since the macro has a place to specify a CSS class, I guess I could just create a class to handle the line breaking.

I'm still pretty new to Xwiki, can you tell me what best place/way is to add a CSS class that I can use on any page?

Thanks,

Jamal
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

Thomas Mortagne
Administrator
This is because that's actually what you asked with this syntax. To
customise the macro itself you can use cssClass parameter, see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Box+Macro#HParametersdefinition
(code macro inherits box macro).

On Thu, Dec 18, 2014 at 10:14 PM, Jamal <[hidden email]> wrote:

> Thanks for the reply, Vincent.
>
> That was my first thought, but here's the weird thing: when I add CSS styles
> that way, the code block ends up getting rendered as a paragraph (<P> tag)
> with the style applied in a SPAN, instead of being rendered in a DIV as it
> normally is.
>
> This changes the look completely, and with forced line breaks it gets quite
> messy.
>
> But since the macro has a place to specify a CSS class, I guess I could just
> create a class to handle the line breaking.
>
> I'm still pretty new to Xwiki, can you tell me what best place/way is to add
> a CSS class that I can use on any page?
>
> Thanks,
>
> Jamal
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593510.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users



--
Thomas Mortagne
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

Jamal
Thanks Thomas,

That's what I was thinking, so my other question was about the best place/way to add the class.

I tried following instructions for customizing the skin, but everything I tried broke the formatting. I'm still not clear on what Flamingo files I need to import before adding custom classes.

I ended up adding some less code in the color theme, but I'd prefer a solution that works with any theme.

Any pointers here would be much appreciated.

Thanks,

Jamal
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

Thomas Mortagne
Administrator
Usually the clean way from upgrade point of view and which works
whatever is the current skin is to add custom class is a ssx, see
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial
(associated with the whole wiki in your use case probably). Either you
introduce a new class that should be set in the code macro or you
modify "code" css class.

On Mon, Dec 22, 2014 at 5:49 PM, Jamal <[hidden email]> wrote:

> Thanks Thomas,
>
> That's what I was thinking, so my other question was about the best
> place/way to add the class.
>
> I tried following instructions for customizing the skin, but everything I
> tried broke the formatting. I'm still not clear on what Flamingo files I
> need to import before adding custom classes.
>
> I ended up adding some less code in the color theme, but I'd prefer a
> solution that works with any theme.
>
> Any pointers here would be much appreciated.
>
> Thanks,
>
> Jamal
>
>
>
>
> --
> View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593539.html
> Sent from the XWiki- Users mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/users



--
Thomas Mortagne
_______________________________________________
users mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Line wrapping in Code Macro

Jamal
Yes that worked perfectly. Thanks very much for your replies.

Jamal