Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-02-10 12:30:05

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Captions with paragraph breaks

My multi-paragraph image captions are flowing into a single paragraph.

I’m using

<txp:image_info type="caption" wraptag="p" class="cap" />

Obviously, I’m like to retain the breaks I have in my caption box. Ta!

Offline

#2 2021-02-10 12:43:56

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,246
Website GitHub

Re: Captions with paragraph breaks

Try:

<txp:image_info type="caption" wraptag="div" class="cap" escape="textile" />

As long as you have a blank line between paragraphs in your caption, passing it through Textile will convert each to <p> tags. That has the advantage that you can also use any other Textile formatting in your captions.

Last edited by Bloke (2021-02-10 12:48:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2021-02-10 12:58:19

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Captions with paragraph breaks

Bloke wrote #328710:

Try:

<txp:image_info type="caption" wraptag="p" class="cap" escape="textile" />...

As long as you have a blank line between paragraphs in your caption, passing it through Textile will convert each to <p> tags. That has the advantage that you can also use any other Textile formatting in your captions.

That lost my p class, so I wrapped it in a div (which kept the class) and tweaked my css to blanket the p in style:

<txp:image_info type="caption" wraptag="div" class="cap" escape="textile" />

Thank you Bloke!

Offline

#4 2021-02-10 12:59:20

nobi-wan
Member
Registered: 2021-02-05
Posts: 19

Re: Captions with paragraph breaks

Bloke wrote #328710:

Try:

<txp:image_info type="caption" wraptag="div" class="cap" escape="textile" />...

As long as you have a blank line between paragraphs in your caption, passing it through Textile will convert each to <p> tags. That has the advantage that you can also use any other Textile formatting in your captions.

I see you spotted that and fixed it too :)

Offline

#5 2021-02-10 13:02:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,246
Website GitHub

Re: Captions with paragraph breaks

nobi-wan wrote #328714:

I see you spotted that and fixed it too :)

Yeah, sorry. I should have tested it before posting!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB