Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-03-04 11:34:50

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

Textile for titles... again, please.

Another topic the forum search is really failing me on. (Btw, the search results of newest to oldest is not very useful when the gold is old.)

I seam to recall it requiring an smd_ plugin of some type that does strip-n-swap magic or something? I don’t recall.

Offline

#2 2018-03-04 11:47:10

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

Re: Textile for titles... again, please.

In 4.7 we get Textile for anything:

<txp:title escape="textile" />
<txp:variable name="textile_me" escape="textile" />
...

or

<txp:title escape="tidy,textile" />

to avoid wrapping the title in <p />.

Offline

#3 2018-03-04 12:18:21

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

Re: Textile for titles... again, please.

Nice!

Offline

#4 2018-03-04 21:04:00

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

Re: Textile for titles... again, please.

Title field entry:

A review of _Bluebeard_

Form:

<txp:title escape="tidy,textile" />

Front-side:

A review of Bluebeard

Yay!

But, on permlink:

<a href="<txp:site_url />articles/<txp:article_url_title />
" title="<txp:title escape="tidy,textile" /> permlink"><txp:posted /></a>

I get:

A review of <em>Bluebeard</em> permlink

If I don’t use the escape, I get the Textile:

A review of _Bluebeard_ permlink

Any way to strip the syntax entirely from the title attribute? I don’t care about the formatting there, but the visible characters is fugly.

Offline

#5 2018-03-04 21:46:39

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

Re: Textile for titles... again, please.

Not sure it’s the best way, but here we go:

<a href="<txp:site_url />articles/<txp:article_url_title />"
    title="<txp:title escape="textile,tags,html" /> permlink"><txp:posted /></a>

Offline

#6 2018-03-05 09:47:45

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

Re: Textile for titles... again, please.

Thanks again.

I actually tried using this before asking, just as a guess, but it didn’t work:

<txp:title escape="tidy,textile,html" />

I should have removed tidy from the start, of course, since it wasn’t relevant in my case.

After playing around with it just now, this works (html has no discernible effect):

<txp:title escape="textile,tags" />

The title tag doc probably needs updated with the new escape attribute functionality. I can do it if there’s an explanation somewhere about all the possible attribute values and what they are for.

Might be easier if someone who knew did it quickly.

¯\_(ツ)_/¯

Offline

#7 2018-03-05 09:55:35

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

Re: Textile for titles... again, please.

Destry wrote #309652:

The title tag doc probably needs updated with the new escape attribute functionality. I can do it if there’s an explanation somewhere about all the possible attribute values and what they are for.

There is an explanation, but done very quickly :-) Note that (almost) every tag is concerned, not only <txp:title />.

Offline

#8 2018-03-05 15:27:22

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

Re: Textile for titles... again, please.

etc wrote #309653:

There is an explanation

Ah, good. I think I saw that before, actually, but didn’t understand the power of what I was looking at. ;)

I also just realized why tidy is important alongside textile. It keeps the pesky p tags out of things.

Offline

#9 2018-03-05 19:38:44

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

Re: Textile for titles... again, please.

Relevant things are not pushed at us. ©

;-)

Offline

#10 2018-03-06 15:47:50

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

Re: Textile for titles... again, please.

I was just testing some pages in the Firefox’s ‘reader’ view and realized some things there:

  1. You see format syntax in the title, if used (e.g. A title with _emphasized_ text).
  2. If you hide text strings in a span (e.g. display:none;) they appear in reader view (they do for me, which is not the effect I want).
  3. Using a custom field to add a conditional subtitle on article titles — something I think will be more popular when unlimited custom fields have their day — positions the subtitle down out of the reader header, out of title context.

I’m a big fan of browsers’ reader feature, so this has me rethinking how to do certain things and whether I should at all on some of them.

Offline

#11 2018-04-06 10:15:42

Gallex
Member
Registered: 2006-10-08
Posts: 1,289

Re: Textile for titles... again, please.

etc wrote #309622:

In 4.7 we get Textile for anything:

<txp:title escape="textile" />...

or

<txp:title escape="tidy,textile" />...

to avoid wrapping the title in <p />.

still wrapping my title in <p>

form:

<div class="article">
<txp:if_article_list>
<txp:if_excerpt>
<h2><txp:permlink><txp:title escape="tidy,textile" /></txp:permlink></h2>
<txp:excerpt />
<p class="meta"><txp:permlink>Loe edasi</txp:permlink></p>
<txp:else />
<h2><txp:permlink><txp:title escape="tide,textile" /></txp:permlink></h2>
<txp:body />
</txp:if_excerpt>
<txp:else />
<h1><txp:title escape="tide,textile" /></h1>
<txp:body />
</txp:if_article_list>
</div>

Offline

#12 2018-04-06 10:17:10

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

Re: Textile for titles... again, please.

Gallex wrote #310691:

still wrapping my title in <p>

Try: <txp:title escape=“tid{y},textile” /> ;-)


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