Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links failing when there is class, text and title, all in in parentheses #131

Closed
gocom opened this issue Dec 20, 2013 · 4 comments
Closed

Comments

@gocom
Copy link
Member

gocom commented Dec 20, 2013

The following:

"(class)(text)(title)":http://example.com/

"(class) (text)(title)":http://example.com/

"(class)(text) (title)":http://example.com/

"(class) (text) (title)":http://example.com/

Generates:

<p><a class="class" href="http://example.com/" style="padding-left:1em;padding-right:1em;">(title)</a></p>

<p><a href="http://example.com/">(class) (text)(title)</a></p>

<p><a class="class" href="http://example.com/" style="padding-left:1em;padding-right:1em;">(title)</a></p>

<p><a href="http://example.com/">(class) (text) (title)</a></p>

There seems to be no way to have class, title and content in parentheses at the same time.

@gocom
Copy link
Member Author

gocom commented Dec 20, 2013

The text seems to get eaten and parentheses are interpreted as padding.

@netcarver
Copy link
Contributor

I had a quick look at this last night and it seems to be the $this->c definition that's causing it.

        $this->c = "(?:$this->clas|$this->styl|$this->lnge|$this->hlgn)*";

This regex allows repeated classes/styles etc so it's matching the class and text from (class)(text)(title) via the $this->clas part (the title is pulled off by the link parsing regex and used as the link text as the attribute gobbled it.) Then the attribute parsing code takes the (class)(text) that it got passed as the attributes and correctly pulls the class from it leaving (text) which then gets parsed as left and right padding. What a mess.

I'm going to do more work on the link parsing code anyway over the Christmas break so I'll take a closer look at fixing this as I do what I already had planned.

netcarver referenced this issue Dec 23, 2013
Add UNICODE spaces to the test suite.
@ghost ghost assigned netcarver Dec 28, 2013
netcarver pushed a commit that referenced this issue Dec 28, 2013
@netcarver
Copy link
Contributor

Pushed a fix for this as part of the new branch (now merged into master and removed: see db84396 in particular with regard to this issue). Uses a new pattern that cuts out the * from the attributes regular expression but still allows matching of language/style/class#id in any order.

netcarver pushed a commit that referenced this issue Dec 28, 2013
@netcarver
Copy link
Contributor

Closed by a45f808.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants