Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-02 04:52:02

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

no_widow Everywhere

A small (I hope) feature suggestion:

It would be great to have a no_widow attribute on nearly every template tag. Keeping widows out of the paragraphs in articles would be a nice typographical touch, and I’m particularly keen to have this option for <txp:custom_field />. When I use an article list for navigation, I’ll sometimes shorten the article titles and use a custom field with a longer “title” as the main page heading.

I think this might be doable as a plugin, but it just seems more natural as part of the built-in tags.

Offline

#2 2007-06-02 08:02:29

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: no_widow Everywhere

This would only be possible for javascript enable UA. And that could be quite some work for the UA to do, if a lot of things are no-widowed.

Offline

#3 2007-06-02 08:22:03

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: no_widow Everywhere

Might be a little overdoing it for general use, though that’s likely arguable. You could, though, very easily make this as a plugin (a tag you can wrap around text and/or other Txp tags).

Offline

#4 2007-06-02 15:08:44

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: no_widow Everywhere

On this matter, I must say the no-widow is usually causing more problems than it is solving any. There are circumstances where it’s useful, but also many where it’s not (sIFR, titles in menu-bars, etc.). I usually turn it off. Parhaps it should be off by default.

This being said, having a nowidow="[1/0]" attribute in any content tag would be very very nice indeed (default : 0 of course).

Last edited by guiguibonbon (2007-06-02 15:09:01)

Offline

#5 2007-06-02 18:05:37

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: no_widow Everywhere

Jeremie said

This would only be possible for javascript enable UA.

How do you figure? It’s already being done in server-side Python with the Typogrify filter for Django. Typogrify has even been ported to PHP as a WordPress plug-in.

guiguibonbon said

This being said, having a nowidow="[1/0]" attribute in any content tag would be very very nice indeed (default : 0 of course).

Sounds like a reasonable approach.

Mary said

You could, though, very easily make this as a plugin (a tag you can wrap around text and/or other Txp tags).

Unless I’m thinking about it the wrong way, it really would be pretty easy. I actually considered attempting it myself, but haven’t been able to find the time. Like I said, though, it seems to make the most sense as (eventually) part of the core.

There’s no reason that both couldn’t happen. If the core feature is turned off by default (per guiguibonbon’s suggestion), there would be no conflict with a pre-existing plugin. Hmm… this could make a good “my first plugin” project for me, provided I can squeeze it in somewhere.

Offline

#6 2007-06-03 11:52:14

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: no_widow Everywhere

There’s not much point in adding the functionality to every tag, when it defaults to off, because the same effect can be achieved with a simple wrapper-tag, and if I am not mistaken plugins like that existed or were ported to textpattern right around the time Alex added it to core. So something like: <txp:nowidow><txp:whatever /></txp:nowidow>
Somebody who cares enough to find out about the functionality and enable it, won’t mind whether it’s an attribute or a wrapper tag; and the latter is a lot less work, less maintenance, more flexibility etc. ONly when it defaults to on, though, it makes sense to use an attribute for turning it off.

Offline

#7 2007-06-03 20:36:53

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: no_widow Everywhere

I’ve got a plugin written and (lightly) tested. I’ll be posting a forum thread for it soon.

Offline

#8 2007-06-03 21:58:03

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: no_widow Everywhere

Okay, I don’t have the proper permissions to post a thread in the Author Support forum just yet. Meanwhile, here’s the info from my own website.

Offline

#9 2007-06-04 18:50:41

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: no_widow Everywhere

Logoleptic wrote:

How do you figure? It’s already being done in server-side Python with the Typogrify filter for Django. Typogrify has even been ported to PHP as a WordPress plug-in.

I don’t see how the server could compute the placement of rendered item on the UA, since it doesn’t know how the UA compute and render them.

Ok, I’ve read the typogrify page. What it does is to swap regular space to non breaking one. Smart, but an alteration of this magnitude is not for everyone. And it has side effect on several cases. However, it could be quite nice to have a tag or plugin to do it where we want.

Offline

#10 2007-06-08 06:43:11

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: no_widow Everywhere

Update: The plugin’s official forum thread has been started.

Offline

Board footer

Powered by FluxBB