Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2012-11-21 19:51:09

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

Re: Can I escape <p> without Textile?

Well, if it’s still there, then out the tank: replace <txp:body /> with

<txp:etc_query data='<txp:body />' replace="//p[not(node())]" />

Last edited by etc (2012-11-21 20:03:18)

Offline

#17 2012-11-21 20:26:04

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: Can I escape <p> without Textile?

Oops >

Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:smd_thumbnail id=“9” type=“main” /> -> Textpattern Notice: Onbekende afbeelding bij het verwerken van module “single_nolink_sidebar” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”
Tag foutmelding <txp:etc_query data=’<txp:body />’ replace=”//p[not(node())]” /> -> Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given bij het verwerken van module “single_nolink” op pagina “kostuums”

Last edited by RedFox (2012-11-21 20:34:51)

Offline

#18 2012-11-21 20:34:23

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

Re: Can I escape <p> without Textile?

Looks like single_nolink form does not exists? Ah, sh.., your php version is too old (should be at least 4.3.8 5.3.8). Well… back to rah_replace or let it be? :)

Edit: it was php 5.3.8, of course.

Last edited by etc (2012-11-22 09:01:04)

Offline

#19 2012-11-21 20:36:35

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: Can I escape <p> without Textile?

Offline

#20 2018-10-09 10:59:02

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: Can I escape <p> without Textile?

It’s 2018 and I still having <p>‘s all over the place. Using smd_macro gives:

<p></p><figure><p></p><img>...

Correct styling can’t be done. They have to leave. I’ve looked into etc_query and smd_query but that’s far beyond my scope. Can somebody help me, please!

And yes, I can use Textile but it isn’t what my client likes.

Last edited by RedFox (2018-10-09 11:03:49)

Offline

#21 2018-10-09 11:20:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,395
Website GitHub Mastodon Twitter

Re: Can I escape <p> without Textile?

You need a space, wrap in <notextile> or ==, or start with notextile.

Examples

<txp:hide> with .notextile</txp:hide>
notextile.. 
<figure>
<image id="##" />
<figcaption>caption here</figcaption>
</figure>
<txp:hide>with space</txp:hide>
 <figure>
 <image id="##" />
 <figcaption>caption here</figcaption>
 </figure>
<txp:hide>with equals</txp:hide>
something == <figure><image id="##" /><figcaption>caption here</figcaption></figure> == something more

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#22 2018-10-09 11:26:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,395
Website GitHub Mastodon Twitter

Re: Can I escape <p> without Textile?

Alternatively create a shortcode (in Textpattern 4.7 onwards)

<txp:if_yield name="caption"><figure<txp:if_yield name="class"> class="<txp:yield name="class" />"</txp:if_yield>><txp:image id='<txp:yield name="id" />' /><figcaption class="grid_24"><txp:yield name="caption" escape="tidy,textile" /></figcaption></figure><txp:else /><txp:image id='<txp:yield name="id" />'<txp:if_yield name="class"> class='<txp:yield name="class" />'</txp:if_yield> /></txp:if_yield>

All your client will need to type is

<txp::figure id="#" caption="caption here" />

with an optional class too:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#23 2018-10-09 11:50:34

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

Re: Can I escape <p> without Textile?

RedFox wrote #314491:

It’s 2018 and I still having <p>‘s all over the place.

Yep, Textile can create an invalid markup if you don’t pay attention. Now that Stef is in charge of it, we could probably disable wrapping in <p></p> the lines starting with a <tag> (html or txp). Meanwhile, you can try to style empty paragraphs as p:empty{display:none /*or whatever*/}.

And yes, I can use Textile but it isn’t what my client likes.

Why not to leave the text untouched then?

Offline

#24 2018-10-09 12:03:22

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: Can I escape <p> without Textile?

etc wrote #314494:

p:empty{display:none /*or whatever*/}.

Gosh … I’ve never thought about this one … superb! … :)

Why not to leave the text untouched then?

… now I can … thanks!

Last edited by RedFox (2018-10-09 12:04:27)

Offline

#25 2018-10-09 14:27:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,498
Website GitHub

Re: Can I escape <p> without Textile?

etc wrote #314494:

Now that Stef is in charge of it, we could probably disable wrapping in <p></p> the lines starting with a <tag> (html or txp).

Hehe, if that’s possible it’d be grand. Which reminds me, would you like commit access :)

failing that, a Pull Request is fine… hint hint


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#26 2018-10-09 20:49:53

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,218
Website GitHub

Re: Can I escape <p> without Textile?

RedFox wrote #314491:

It’s 2018 and I still having <p>‘s all over the place. Using smd_macro gives:

<p></p><figure><p></p><img>......

That doesn’t look like an initial <p> tag caused by textile when placing a tag at the beginning of a line, though. Surely that would be <p><figure> … </figure></p>.

If you’re getting that in your macro, you might need more if statements to only output certain code when there is actual content. Sometimes, I agree, though, sometimes it’s really hard to avoid, especially with if_first/if_last and if_different.

What you can also do is use smd_wrap and wrap your entire body block in:

<txp:smd_wrap_all transform="replace|string|<p></p>|"> … </txp:smd_wrap_all>

That should remove all empty <p> tags. If you have some that happen to have spaces between them, you may need:

<txp:smd_wrap_all transform="replace|regex|#<p>\s?<\/p>#|"> … </txp:smd_wrap_all>

If memory serves, \s? should replace <p> tags with spaces, carriage returns and tabs or nothing at all between them.


TXP Builders – finely-crafted code, design and txp

Offline

#27 2018-10-09 21:34:01

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

Re: Can I escape <p> without Textile?

jakob wrote #314501:

That doesn’t look like an initial <p> tag caused by textile when placing a tag at the beginning of a line, though. Surely that would be <p><figure> … </figure></p>.

I think that is <p><figure> … </figure></p>, but, since it is invalid (p accepts only phrasing content), browsers transform it into

<p></p><figure> … </figure><p></p>

Offline

#28 2018-10-10 15:24:25

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

Re: Can I escape <p> without Textile?

Bloke wrote #314498:

Which reminds me, would you like commit access :) … failing that, a Pull Request is fine…

Whichever is less work for you :-)

Offline

#29 2018-10-10 16:00:40

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

Re: Can I escape <p> without Textile?

Stef and etc in charge of Textile. Things are gonna get lively! :thumb up:

A-hem, hr(class). ;)

Offline

#30 2018-10-10 16:06:57

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

Re: Can I escape <p> without Textile?

etc wrote #314494:

p:empty{display:none;}.

I never knew about such a pseudo element before. All these many years of f-ing around with spaces and trying to remember whatever else escape. Kill me now. Though usually it’s not the p element I have to escape; it’s often other types of tags.

Yes, can we please just write on the left edge of the box without the workarounds. I mean, I’m sure there have been reasons to not touch Textile before, but if we have since evolved to a higher plane of existence/capability, let’s make it so.

Offline

Board footer

Powered by FluxBB