Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-09-25 15:58:09

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] Textile 2.2

All

We do have a test-suite available and if anyone would like to submit textile input + expected output you’d be most welcome to. Just email them to either myself or Stef. Indeed, if you do have ideas for potential future improvements/bugfixes/features then why not post them too.


Steve

Offline

#14 2010-09-26 00:36:11

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

Re: [textile] Textile 2.2

This are great news. Thank you very much Steve and Stef!

It seems to me that at the end of the classTextile file should be an ?> (line 1712).

There is also a source of problems in the hasRawText-function, line 645 in this part: …[^>]*?>.*</\1>….

Should not that be …[^>]*?\>.*</\1>…?

If I’m wrong, I apologize, I’m not a programmer. And I am very grateful for your work.

Offline

#15 2010-09-26 01:27:47

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

Re: [textile] Textile 2.2

GugUser wrote:

It seems to me that at the end of the classTextile file should be an ?> (line 1712).

It’s optional. Only opening is required by the parser. By not closing the block, eliminates the problem known as ‘exceed bytes at the end of the file’, which will cause problems if there.

Last edited by Gocom (2010-09-26 01:32:45)

Offline

#16 2010-09-26 03:55:00

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

Re: [textile] Textile 2.2

I came to mi comment, because I changed acronym in abbr and I added in the hasRawText-function more elements, “section|aside|figure|detail|header|footer|address|hgroup”. This produced an error (“unexpected end in line …”, in the last line). After I made the changes mentioned above (?\> in hasRawText and ?> at the end of the file), the changed/extended classTextile works again.

Offline

#17 2010-09-26 13:40:47

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] Textile 2.2

Hello GugUser

It seems to me that at the end of the classTextile file should be an ?> (line 1712).

Gocom is correct about the final ?> and the reason for leaving it out.

I came to mi comment, because I changed acronym in abbr and I added in the hasRawText-function more elements, “section|aside|figure|detail|header|footer|address|hgroup”. This produced an error (“unexpected end in line …”, in the last line).

Could you post all the changes you made (you mentioned two but only show one) so we can see what’s happening please.


Steve

Offline

#18 2010-09-26 13:48:38

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

Re: [textile] Textile 2.2

Hello net-carver

Could you post all the changes you made (you mentioned two but only show one) so we can see what’s happening please.

Can I send you the documented file? Where?

Offline

#19 2010-09-26 13:53:06

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] Textile 2.2

Hi GugUser

How many lines of code did you change? If it’s only a few you could use the forum’s bc.. to paste them into your next post — if it’s a lot, try pastebin or create a gist on github.com


Steve

Offline

#20 2010-09-26 15:01:15

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

Re: [textile] Textile 2.2

My changes (not much) in the file classTextile.php, v2.2 r3400:

(Blank space in the character entity only here in this example.)

@define('txt_quote_single_open',  '& #8218;');	// CR für Deutsch war &#8216
@define('txt_quote_single_close', '& #8216;');	// CR für Deutsch war &#8217
@define('txt_quote_double_open',  '& #8222;');	// CR für Deutsch war &#8220
@define('txt_quote_double_close', '& #8220;');	// CR für Deutsch war &#8221

in glyph_search:

// CR		'/\b(['.$abr.']['.$acr.']{2,})\b(?:[(]([^)]*)[)])/'.$mod,	// 3+ uppercase acronym
			'/\b(['.$abr.']['.$acr.']{1,})\b(?:[(]()[)])/'.$mod,		// KMS: 2+ uppercase abbreviation, erlaubt <abbr> (ohne title="")
			'/\b(['.$abr.']['.$acr.']{1,})\b(?:[(]([^)]*)[)])/'.$mod,	// CR: 2+ uppercase abbreviation, abbreviation statt acronym, <abbr> für zweistellige Begriffe
			'/(?<=\s|^|[>(;-])(['.$abr.']{3,})(['.$nab.']*)(?=\s|'.$pnc.'|<|$)(?=[^">]*?(<|$))/'.$mod,	// 3+ uppercase	// CR	wird in $glyph_replace wirkungslos

in glyph_replace:

// CR		'<acronym title="$2">$1</acronym>',		// 3+ uppercase acronym
			'<abbr>$1</abbr>',						// 2+ uppercase abbreviation		// KMS	neu: erlaubt <abbr> (ohne title="")
			'<abbr title="$2">$1</abbr>',			// 2+ uppercase abbreviation		// CR	'<acronym title="$2">$1</acronym>' durch '<abbr title="$2">$1</abbr>' ersetzt
// CR		'<span class="caps">glyph:$1</span>$2',	// 3+ uppercase
			'glyph:$1',								// 3+ uppercase				// CR	'<span class="caps">glyph:$1</span>$2' entfernt

in hasRawText:

// CR	$r = trim(preg_replace('@<(p|blockquote|div|form|table|ul|ol|dl|pre|h\d)[^>]*?\>.*</\1>@s', '', trim($text)));
		$r = trim(preg_replace('@<(p|blockquote|div|form|table|ul|ol|dl|pre|section|aside|figure|detail|header|footer|address|hgroup|h\d)[^>]*?\>.*</\1>@s', '', trim($text)));	// PW: plus HTML5-Elemente

and:

} // end class
?>

It works.

If I don’t escape in the hasRawText this part ]*?>, it produce an error:

“Parse error: syntax error, unexpected $end in /home/www/web300/html/miramicus/textpattern/lib/classTextile.php on line …” (last line of the file)

As I mentioned at the beginning: I’m not a programmer, I’m learning on.

Offline

#21 2010-09-26 16:14:04

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: [textile] Textile 2.2

Hi Stef.

On the new Textile tests website you could change this french sentence :

Ou est l‘école, l‘église s’il vous plâit?

by this one:

Où est l’école, l’église s’il vous plaît ?

IMHU it’s much better.

Cheers,

Last edited by Pat64 (2010-09-27 13:27:04)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#22 2010-09-26 18:42:13

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] Textile 2.2

GugUser

I’ll try out your changes later and see if I can reproduce the errors. If I can’t, I’ll ask you to pastie or gist your entire file for me to grab and test.

Your use of German quotation marks does raise some interesting localisation issues that will need some thought.

Pat64

thanks for the catch — I’ll update the example tonight.


Steve

Offline

#23 2010-09-26 19:46:32

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

Re: [textile] Textile 2.2

net-carver

You can download the file, that is easier.

Offline

#24 2010-09-26 19:46:38

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] Textile 2.2

Pat64

Website updated — thank you.

GugUser

Just delete this line from hasRawText()

// CR    $r = trim(preg_replace('@<(p|blockquote|div|form|table|ul|ol|dl|pre|h\d)[^>]*?\>.*</\1>@s', '', trim($text)));

Then change your extended line to remove the un-needed \ — like so…

$r = trim(preg_replace('@<(p|blockquote|div|form|table|ul|ol|dl|pre|section|aside|figure|detail|header|footer|address|hgroup|h\d)[^>]*?>.*</\1>@s', '', trim($text)));	// PW: plus HTML5-Elemente

You can then also remove the ending ?> from the file and all should work.

Please also note that your replacement expression for the 3+ uppercase letters should be …

 'glyph:$1$2',                                // 3+ uppercase                // CR    '<span class="caps">glyph:$1</span>$2' entfernt

… or you’ll loose trailing non-caps characters from matches like TXPish’ which your replacement would render as just TXP.


Steve

Offline

Board footer

Powered by FluxBB