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

Table parsing issue #36

Open
noumantahir opened this issue Feb 23, 2022 · 4 comments
Open

Table parsing issue #36

noumantahir opened this issue Feb 23, 2022 · 4 comments

Comments

@noumantahir
Copy link
Collaborator

I have a clear lead on table rendering issue, but I have literally no idea how to fix it.....Need assistance @here since it is more html related....

The input we are getting from the post is missing closing </tr> tags that is causing the malfunction, if we put the tags manually, the problem goes away, but obviously we cannot always control such conditions. Details below elaborate my findings after experimenting with input post body for some time. I have put together a simplified table to replicate the source of issue.

        <table>
        <thead>
        <tr><th>Table 1 Header 1</th><th>Table 1 Header 2</th></tr>
        </thead>
        <tbody>
        <tr><td>Table 1 Body 1</td>
        <td>Table 1 Body 2</td>
        </tbody>
        </table>
        <table>
        <thead>
        <tr><th>Table 2 Header 1</th><th>Table 2 Header 2</th></tr>
        </thead>
        <tbody>
        <tr><td>Table 2 Body 1</td>
        <td>Table 2 Body 2</td> 
        </tbody>
        </table>

Body images show the input and output we are getting from render-helper.

Screenshot 2022-02-23 at 1 03 07 PM

Screenshot 2022-02-23 at 12 57 42 PM

Code image show where everything goes south.
Screenshot 2022-02-23 at 12 59 30 PM

Since closing table tags was removed the renderer tries to cramp everything in a single table, The resulting table is rendered something like this.
Screenshot 2022-02-23 at 1 03 59 PM

However if we feed the sample post body directly to renderer, it works just fine even without the closing </tr> tags in table body. This leads me to conclusion that only if we are able to make render-helper not remove the closing table tags </table> that should as well fix the rendering issue we are experiencing.
Screenshot 2022-02-23 at 1 07 30 PM

@noumantahir
Copy link
Collaborator Author

noumantahir commented Feb 23, 2022

One hack I can think of is, before processing or html, check if there exist a </tr> tag just before </tbody>, if it does not, place one and process the body.

BEOFRE:

 <table>
<table>
    <thead>
        <tr>
            <th>Table 1 Header 1</th>
            <th>Table 1 Header 2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Table 1 Body 1</td>
            <td>Table 1 Body 2</td>
    </tbody>
</table>

AFTER

<table>
    <thead>
        <tr>
            <th>Table 1 Header 1</th>
            <th>Table 1 Header 2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Table 1 Body 1</td>
            <td>Table 1 Body 2</td>
        </tr> //---------------------------manually added tr tag before render-helper processing
    </tbody>
</table>

Precautions: not sure how this would respond if there are more than one rows per table without </tr> tag

@feruzm
Copy link
Member

feruzm commented Feb 23, 2022

@noumantahir As this is user error in content body, I don't think we need to add any workaround yet. Unless it is quite common issue.

@noumantahir
Copy link
Collaborator Author

@feruzm my guess is, the platform user used to create this post content is the one we should check.... perhaps we can reach out to user for understanding more about that platform

@feruzm
Copy link
Member

feruzm commented Feb 25, 2022

@noumantahir agreed, will write a comment and hope they will respond. Reference: https://ecency.com/hive-163772/@archimax72/villa-deste-in-tivoli-rome-engita

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

2 participants