Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Attribute hreflang and type for links
It would be quite nice to be able to specify a lang for the link used in the articles (parsed by Textile) and maybe also the type, aka the use of the hreflang
and type
attributes for the a
tag.
Offline
Re: Attribute hreflang and type for links
Oh!
I’ll support this.
Doing it manually is no biggie for me, but not eveyone is inclined to handcode html.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
#3 2005-10-31 08:04:06
- succhi
- New Member
- From: Brisbane, Australia
- Registered: 2005-03-25
- Posts: 4
Re: Attribute hreflang and type for links
Does anyone know if this has moved forward. In classTextile.php it appears there is provision for attributes but that don’t seem to be captured in the regex and thus aren’t used. I am not very strong with regex yet so I have spent far too long looking at this. I just need a simple way to add a class attribute to a link.
From what is in classTextile
<pre>
$this->clas = “(?:\([^)]+\))”; //(class)
$this->lnge = “(?:\[[^]]+\])”; //[language]
$this->styl = “(?:\{[^}]+\})”; //{style}
$this->c = “(?:{$this->clas}?{$this->styl}?{$this->lnge}?|”
.”{$this->styl}?{$this->lnge}?{$this->clas}?|”
.”{$this->lnge}?{$this->styl}?{$this->clas}?)”;
return preg_replace_callback(‘/
([\s[{(]|[[:punct:]])? # $pre
“ # start
(’ . $this->c . ‘) # $atts
([^”]+) # $text
\s?
(?:\(([^)]+)\)(?=”))? # $title
“:
(\S+\b) # $url
(\/)? # $slash
([^\w\/;]*) # $post
(?=\s|$)
/Ux’, array(&$this, “fLink”), $text);
</pre>
It looks like you should be able to write
"(class)link text(title)":http://url.com
Offline