Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2010-09-26 03:55:00
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
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,477
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,477
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 ‘
@define('txt_quote_single_close', '& #8216;'); // CR für Deutsch war ’
@define('txt_quote_double_open', '& #8222;'); // CR für Deutsch war “
@define('txt_quote_double_close', '& #8220;'); // CR für Deutsch war ”
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
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,477
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
#25 2010-09-26 20:24:18
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Offline
#26 2010-09-26 20:42:45
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: [textile] Textile 2.2
net-carver
Yes. Thank you for your tips.
Why can affect a commented line the parsing process?
Offline
#27 2010-09-26 20:47:51
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [textile] Textile 2.2
GugUser
I don’t know why — but the PHP parser seems to pick up the ?> from the commented-out regex. If the regex isn’t commented out the parser correctly recognizes it as part of a string.
I don’t know if this is part of the PHP Parser’s defined behaviour.
— Steve
Offline
Re: [textile] Textile 2.2
net-carver wrote:
Your use of German quotation marks does raise some interesting localisation issues that will need some thought.
Offline
#29 2010-09-26 21:18:31
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: [textile] Textile 2.2
net-carver, an additional comment:
Five weeks ago I mentioned in the german forum that I would like a different replacement with either <abbr> or <span class="caps">, but not the two together. Because the <span> within the <abbr> together with a CSS rule, for example, abbr, .caps { font-size: .929em; } has a double effect.
Moreover, the dual element (with my abbr instead of acronym) <abbr title="Content Management System"><span class="caps">CMS</span></abbr> is not necessary in HTML.
I hope I can explain it with my poor English … ;-)
Offline
Re: [textile] Textile 2.2
Thanks for the feedback about the tests. I can imagine a set of tests being released that specify the version as well.
I don’t think this would hinder the development of new features if people felt there could be several versions floating around with tests that exercise each of them..e
Oh and on line 423:
‘/[([]3\/4[])]/’, // 3/2It should be:
‘/[([]3\/4[])]/’, // 3/4My worthless contribution… :)
Offline