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

Is it possible to create valid table code-set? #35

Open
nokimaro opened this issue Dec 9, 2014 · 4 comments
Open

Is it possible to create valid table code-set? #35

nokimaro opened this issue Dec 9, 2014 · 4 comments

Comments

@nokimaro
Copy link

nokimaro commented Dec 9, 2014

Yes it's easy to create bb-codes for table [table], [th], [tr], [td] with CodeDefinitionBuilder like this

//table
$builder = new CodeDefinitionBuilder('table', '<table>{param}</table>');
array_push($this->definitions, $builder->build());

//thead
$builder = new CodeDefinitionBuilder('th', '<th>{param}</th>');
array_push($this->definitions, $builder->build());

//tr
$builder = new CodeDefinitionBuilder('tr', '<tr>{param}</tr>');
array_push($this->definitions, $builder->build());

//td
$builder = new CodeDefinitionBuilder('td', '<td>{param}</td>');
array_push($this->definitions, $builder->build());

But how to create definitions to parse [tr] only if it's inside [table][/table], and parse [td] if it's inside [tr][/tr]

Any solutions?

@t1gor
Copy link

t1gor commented Dec 9, 2014

why is this a problem, first place? Do you use those short-codes somewhere else? Can you please provide an example?

@nokimaro
Copy link
Author

This short-codes for users use.
Simple table

[table]
[tr]
[td] content [td]
[tr]
[table]

Will be replaced to

<table>
<tr>
<td> content </td>
</tr>
</table>

But this will be invalid HTML, because no <table> around <td> etc...

[td]
[tr]
[table] invalid html [/table]
[/tr]
[/td]
<td>
<tr>
<table> invalid html</table>
</tr>
</td>

@lobodol
Copy link

lobodol commented Jan 5, 2015

My [table] BBCode is not converted, is it an issue ?

@Kubo2
Copy link
Contributor

Kubo2 commented Apr 6, 2015

@lobodol How can we know? We don't even know, how your actual code looks like.

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

No branches or pull requests

4 participants