Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#109 2014-02-17 07:16:56

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: smd_wrap: conditionally wrap stuff with tags and labels

Oh, right. The ol’ escape="" attribute. I always forget about that. Yep, that get’s both the custom field and the caption fields working with links now. Thanks, Sac!

Offline

#110 2015-02-19 21:54:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_wrap: conditionally wrap stuff with tags and labels

Just to report that some examples on docs aren’t working as expected.
For example:

<txp:smd_wrap delim="@"
     transform="date|%A, %d %B, %Y %l:%M%p">
2011-9-12 05:30:00
</txp:smd_wrap>

That one won’t work as is.
The fix: use <txp:smd_wrap_all></txp:smd_wrap_all> instead.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#111 2015-02-20 08:54:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: smd_wrap: conditionally wrap stuff with tags and labels

maniqui wrote #288432:

some examples on docs aren’t working as expected

Ooops, well spotted. I’ll fix those at some point, thank you.


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

#112 2015-05-23 00:56:11

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: smd_wrap: conditionally wrap stuff with tags and labels

I tried many versions, but in each case the content was wrapped with paragraphs.

<span itemprop="name">
	<txp:smd_wrap transform="textile">
		<txp:title />
	</txp:smd_wrap>
</span>
<txp:smd_wrap transform="textile">
	<span itemprop="name">
		<txp:title />
	</span>
</txp:smd_wrap>
<txp:smd_wrap transform="textile">
	<span itemprop="name">
		<txp:custom_field name="title" escape="" />
	</span>
</txp:smd_wrap>
<span itemprop="name">
	<txp:smd_wrap item="<txp:title />" transform="textile" />
</span>

The only way I found was this:

<span itemprop="name">
	<txp:smd_wrap transform="textile,replace|regex|'<\/?p>'|">
		<txp:title />
	</txp:smd_wrap>
</span>

Is it really necessary to work with replace or is there a better solution?

Offline

#113 2015-05-23 11:04:54

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: smd_wrap: conditionally wrap stuff with tags and labels

By default smd_wrap trim white space.
Try to add trim="0"

<txp:smd_wrap transform="textile" trim="0"> 
    <txp:title />
</txp:smd_wrap>

Offline

#114 2015-05-23 13:13:16

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: smd_wrap: conditionally wrap stuff with tags and labels

Oh, sorry, that’s a misunderstanding. I had shown the code parts structured for a better understanding. But in practice, everything was a single line without spaces. Unfortunately trim="0" doesn’t help. I think I have to do it with replace.

Offline

#115 2015-05-23 13:22:14

etc
Developer
Registered: 2010-11-11
Posts: 5,211
Website GitHub

Re: smd_wrap: conditionally wrap stuff with tags and labels

GugUser wrote #291032:

everything was a single line without spaces. Unfortunately trim="0" doesn’t help.

It’s Textile that wraps it in <p />. Not sure, but adding (and then removing) a space before <txp:title /> could help:

<txp:smd_wrap transform="textile,trim" trim="0"> <txp:title /></txp:smd_wrap>

Offline

#116 2015-05-23 13:29:05

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: smd_wrap: conditionally wrap stuff with tags and labels

Yes, that works too. What is better, replace or trim?

Offline

#117 2015-05-23 17:20:36

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,734
Website

Re: smd_wrap: conditionally wrap stuff with tags and labels

Personally, I’d do the replace, not because one or the other is better or worse, but because it’s explicit and it doesn’t matter if you – or someone else – forgets to deliberately leave a space (or inadvertently tidies up those ‘sloppy spaces’ in the code :-)


TXP Builders – finely-crafted code, design and txp

Offline

#118 2015-05-23 17:25:39

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: smd_wrap: conditionally wrap stuff with tags and labels

I think this is a good argument.

Offline

#119 2015-05-23 18:48:51

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: smd_wrap: conditionally wrap stuff with tags and labels

Personnaly, I would like Textile propose a inline mode… No textile block, just a mode that parse inline blocks.
Alternatively I use a white space.

Offline

#120 2015-09-10 00:09:58

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: smd_wrap: conditionally wrap stuff with tags and labels

I have a problem with the following code:

<txp:smd_wrap transform="textile,replace|regex|'<\/?p>'|"><txp:title /></txp:smd_wrap>

If the title has a part like _example_, then it is parsed correctly by the Textile processor, like <em>example</em>. But if the title has a part like "example", then the simple quotes are not converted in typographic quotes how else usually happened in the main text field.

Does anyone know why?

Offline

Board footer

Powered by FluxBB