Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-08-11 16:10:57

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

Should an article preview parse 'txp:' tags?

I have an article with Textile and txp: tags in it. When I preview the article from the admin-side, the Textile tags are parsed correctly, but the Textpattern tags are left as inline text, albeit in a different colour.

Is this expected? It looks…odd. Is there a setting I can change to enable txp: tag parsing in preview mode?

Thank you.

Offline

#2 2024-08-11 17:08:26

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

Re: Should an article preview parse 'txp:' tags?

Does unchecking the Sanitize checkbox change anything?


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 2024-08-11 17:29:59

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

Re: Should an article preview parse 'txp:' tags?

Bloke wrote #337579:

Does unchecking the Sanitize checkbox change anything?

Where do I find the Sanitize checkbox, please?

Edit: ah, now I see Sanitize on the dev code, not in production – ignore me!

Last edited by gaekwad (2024-08-11 17:31:11)

Offline

#4 2024-08-11 17:33:44

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,269
GitHub

Re: Should an article preview parse 'txp:' tags?

Closing – it looks like 4.9.0 will solve this.

Thanks, Bloke!

Offline

#5 2024-08-12 01:03:31

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,207
Website

Re: Should an article preview parse 'txp:' tags?

On 4.9 you should have two options (checkboxes): one to parse the txp:tags and one to sanitise tags e.a.

The first one is very useful when editing articles that are already live, before saving anything – which would push the content to full public view.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2024-11-11 14:58:31

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

Re: Should an article preview parse 'txp:' tags?

On a side note: should (unparsed) txp tags be syntax-colourized in Text mode? I have switched it off since it looks distracting, but there is only one line to change if it has defenders..

In HTML mode everything should be properly colourized now, including php code inside <txp:php />.

Offline

#7 2024-11-11 23:55:29

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,207
Website

Re: Should an article preview parse 'txp:' tags?

etc wrote #338186:

On a side note: should (unparsed) txp tags be syntax-colourized in Text mode? I have switched it off since it looks distracting, but there is only one line to change if it has defenders..

In HTML mode everything should be properly colourized now, including php code inside <txp:php />.

Yes!

But this has some bugs ATM

1. an inline link based on a shortcode, input markup

some text: <txp::pdf id="67" />.

generated HTML output in Preview text view

some text: <code class="language-markup txp-tag">&lt;txp::pdf id="67" /&gt;</code>

2. similar, a <txp:tag /> block such as

<txp:image escape="" id="1" wraptag="p" width="100" height="100" />

generated HTML output in Preview, text view

<code class="language-markup txp-tag">&lt;txp:image escape="" id="1" wraptag="p" width="100" height="100" /&gt;</code>

The offending css selector:

code {
  &.txp-tag {
    color: var(--txp-prism-token-8, hsl(270, 50%, 40%));
  }
}

All are coloured purple or red depending on the admin theme in use.

Last edited by phiw13 (2024-11-12 00:00:13)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2024-11-12 09:29:10

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

Re: Should an article preview parse 'txp:' tags?

phiw13 wrote #338191:

But this has some bugs ATM

All are coloured purple or red depending on the admin theme in use.

What’s wrong with it? This colour just makes txp tags stand out from the ‘normal’ text (or code), there is no syntax highlighting involved. Otherwise, there would be no visual difference in preview between a textiled code snippet

@<txp::pdf id="67" />@

producing

<code>&lt;txp::pdf id="67" /&gt;</code>

and a ‘real’ <txp::pdf id="67" /> tag. Themes can override .txp-tag rules if necessary.

Offline

#9 2024-11-12 11:03:37

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,207
Website

Re: Should an article preview parse 'txp:' tags?

etc wrote #338196:

What’s wrong with it? This colour just makes txp tags stand out from the ‘normal’ text (or code), there is no syntax highlighting involved. Otherwise, there would be no visual difference in preview between a textiled code snippet

<txp::pdf id=“67” />@…@

producing

<code>&lt;txp::pdf id="67" /&gt;</code>...

and a ‘real’ <txp::pdf id="67" /> tag. Themes can override .txp-tag rules if necessary.

Ok. Then, It is not a bug. I don’t really see the point of eliminating the distracting code colouring then.

(And of course I have already overwritten that).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#10 2024-11-13 01:08:34

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,207
Website

Re: Should an article preview parse 'txp:' tags?

Oleg,thanks for changing that to use some opacity. That is better.

But one thought, how about using the secondary / demoted custom prop. that I am suggesting here: forum.textpattern.com/viewtopic.php?pid=338204#p338204 ? That has several benefits, an admin theme can more easily redefine it for users needing some more contrast (prefers-contrast: more), for users preferring no transparency, for Windows users setting their OS to forced-colors mode, etc.

There are two instances: the code.txp-tag selector discussed here, and the txp-sanitized class.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#11 2024-11-13 11:01:25

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

Re: Should an article preview parse 'txp:' tags?

phiw13 wrote #338205:

how about using the secondary / demoted custom prop. that I am suggesting here: forum.textpattern.com/viewtopic.php?pid=338204#p338204 ?

Certainly a good idea, will implement it in the next round of css tweaks, thank you.

Offline

#12 2024-11-14 13:02:53

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

Re: Should an article preview parse 'txp:' tags?

I have added a Tester Egg, to fold/unfold sanitized elements and txp tags in text preview mode. Currently it works by ctrl+click on Sanitize button, replacing these elements with abbreviated versions. For example,

<txp:php a="Hello!">
    echo $a;
</txp:php>

becomes <txp:php…/> and can further be totally hidden via a css rule.

Having many large txp blocks in my articles (bad practice!), I find it useful, but it can certainly be improved UX-wise. Testers welcome.

Offline

Board footer

Powered by FluxBB