Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-10-17 12:21:27

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

[textile] problem with link class in textile 2.4.1

this link "(various fancybox.iframe)Grizzly Bear":http://www.youtube.com/embed/AuG9i5cwGW0?rel=0;autoplay=1 displays a complicated class name in older textile version, but not in 2.4.1.

any idea, how to get it work in textile 2.4.1?

Last edited by Gallex (2012-10-17 13:39:56)

Offline

#2 2012-10-17 13:17:18

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

Re: [textile] problem with link class in textile 2.4.1

The problem is not Textile but the dot in your class name.

Offline

#3 2012-10-17 13:36:38

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

Re: [textile] problem with link class in textile 2.4.1

i know, but older version displayed this little more complicated class name. no chance to use it in 2.4.1?

Last edited by Gallex (2012-10-17 13:37:31)

Offline

#4 2012-10-17 17:44:23

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,259

Re: [textile] problem with link class in textile 2.4.1

I was a little curious how the stuff might look like where the magic happens. And found (maybe) a solution you could try.

Open classTextile.php,
search for
if (preg_match("/^([-a-zA-Z 0-9_
and replace two times with
if (preg_match("/^([-a-zA-Z 0-9_\.

This way you add one more allowed character. The first line incidence is for matching classes plus ID, the second one is responsible for classes only. One very similar line before the two might need the additional dot, too, but I can’t tell what it might process, so I’d leave it out. It won’t create these unusual classes, at worst.p.

{Edited to add the lacking backslash. – Uli}

Last edited by uli (2012-10-18 22:04:12)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2012-10-18 12:41:12

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

Re: [textile] problem with link class in textile 2.4.1

like this?

# If a textile class block attribute was found with a '#' in it
# split it into the css class and css id...
		if( false !== $hashpos ) {
				if (preg_match("/#([-a-zA-Z0-9_\.\:]*)$/", substr( $cls[1], $hashpos ), $ids))
						$id = $ids[1];
					if (preg_match("/^([-a-zA-Z 0-9_.]*)/", substr( $cls[1], 0, $hashpos ), $ids))
						$class = $ids[1];
				}
				else {
					if (preg_match("/^([-a-zA-Z 0-9_.]*)$/", $cls[1], $ids))
						$class = $ids[1];
				}
			}

it’s working! ;) hopefully everything else too…
thank’s uli!

Offline

#6 2012-10-18 22:01:17

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,259

Re: [textile] problem with link class in textile 2.4.1

Gallex wrote:

like this? <snip> if (preg_match("/^([-a-zA-Z 0-9_.

No, sorry, my fault. Like this: if (preg_match("/^([-a-zA-Z 0-9_\.

The dot in my first “solution” meant any character (thus covering also the dot, hence “working”), whereas an escaped dot (\.) means the literal dot.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2012-10-19 08:26:32

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

Re: [textile] problem with link class in textile 2.4.1

everything correctly now? anyway it’s working

if (preg_match("/\(([^()]+)\)/U", $matched, $cls)) {
			$matched = str_replace($cls[0], '', $matched);	# Consume entire class block -- valid or invalid...
			# Only allow a restricted subset of the CSS standard characters for classes/ids. No encoding markers allowed...
			if (preg_match("/\(([-a-zA-Z 0-9_\.\:\#]+)\)/U", $cls[0], $cls)) {
				$hashpos = strpos( $cls[1], '#' );
				# If a textile class block attribute was found with a '#' in it
				# split it into the css class and css id...
				if( false !== $hashpos ) {
					if (preg_match("/#([-a-zA-Z0-9_\.\:]*)$/", substr( $cls[1], $hashpos ), $ids))
						$id = $ids[1];
					if (preg_match("/^([-a-zA-Z 0-9_\.]*)/", substr( $cls[1], 0, $hashpos ), $ids))
						$class = $ids[1];
				}
				else {
					if (preg_match("/^([-a-zA-Z 0-9_\.]*)$/", $cls[1], $ids))
						$class = $ids[1];
				}
			}
		}

Offline

#8 2012-10-25 07:57:21

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

Re: [textile] problem with link class in textile 2.4.1

one thing i noticed – if uploaded file consist spaces, the generated link for textile, doesn’t work.

this link "info and programs.pdf":/file_download/3/info+and+programs.pdf doesn’t work.

is it because my modified classTextile.php file or general textile 2.4.1 problem?

Offline

#9 2012-10-25 11:22:12

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,259

Re: [textile] problem with link class in textile 2.4.1

Gallex wrote:

is it because my modified classTextile.php file or general textile 2.4.1 problem?

Use your original classTextile file, save the article in question again and have a look whether it’s working then :)

Last edited by uli (2012-10-25 11:22:32)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#10 2012-10-25 12:01:00

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

Re: [textile] problem with link class in textile 2.4.1

uli wrote:

Use your original classTextile file, save the article in question again and have a look whether it’s working then :)

i don’t want to use original because of this class name stuff. tryed (with modified classTextile file) to resave with “reset time to now” didn’t help either

Last edited by Gallex (2012-10-25 12:01:51)

Offline

#11 2012-10-25 13:06:53

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

Re: [textile] problem with link class in textile 2.4.1

Gallex wrote:

this link "info and programs.pdf":/file_download/3/info+and+programs.pdf doesn't work.

It works at Txstyle.org (although I’m not sure if it’s running Textile 2.4.1 or just 2.4).

You could try this syntax too:

this is ["info and programs.pdf":/file_download/3/info+and+programs.pdf]

Edit: removed some @ left-overs from quoting.

Last edited by maniqui (2012-10-25 13:29:48)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#12 2012-10-25 13:18:37

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] problem with link class in textile 2.4.1

That link does work. The following:

"info and programs.pdf":/file_download/3/info+and+programs.pdf

Generates:

<p><a href="/file_download/3/info%2Band%2Bprograms.pdf">info and programs.pdf</a></p>

As expected.

Offline

Board footer

Powered by FluxBB