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

html2rst/htm2md and complex table #18

Open
anto1ne opened this issue Jun 13, 2021 · 0 comments
Open

html2rst/htm2md and complex table #18

anto1ne opened this issue Jun 13, 2021 · 0 comments

Comments

@anto1ne
Copy link

anto1ne commented Jun 13, 2021

Hi

Thank you for this great tool.

I tried to use the html2rst/htm2md functions but I think I met an issue.

I have got an html table which looks like this

image

        <style type="text/css">
        table {vertical-align: middle;margin: 0 auto;font-size:12px;color:#333333;width:100%;border-width: 1px;border-color: #729ea5;border-collapse: collapse;}
        table th {font-size:12px;background-color:#acc8cc;border-width: 1px;padding: 8px;border-style: solid;border-color: #729ea5;text-align:left;}
        table tr {background-color:#ffffff;}
        table td {font-size:12px;border-width: 1px;padding: 0px;border-style: solid;border-color: #729ea5;}
        </style>
        <table>
<tr><td rowspan="16">Jasmin (M, 2018)</td><td rowspan="8">Tassou (M, 2020)</td><td rowspan="4">Bastidon (M, 2017)</td><td rowspan="2">Kappa (M, 2017)</td><td rowspan="1">Savary (M, 2015)</td></tr>
<tr><td rowspan="1">Rolex (F, 2012)</td></tr>
<tr><td rowspan="2"><b>Coquine (F, 2021)</b></td><td rowspan="1">Jérico (M, 2012)</td></tr>
<tr><td rowspan="1">Apostrophe (F, 2020)</td></tr>
<tr><td rowspan="4">Danette (F, 2013)</td><td rowspan="2">Magritt (M, 2019)</td><td rowspan="1">Sarcouf (M, 2013)</td></tr>
<tr><td rowspan="1">Joufflu (F, 2012)</td></tr>
<tr><td rowspan="2">Xio (F, 2020)</td><td rowspan="1">Caleu (M, 2017)</td></tr>
<tr><td rowspan="1">Sirène (F, 2013)</td></tr>
<tr><td rowspan="8">Epinette (F, 2020)</td><td rowspan="4">Beaulinge (M, 2015)</td><td rowspan="2">Ramsès (M, 2019)</td><td rowspan="1">Eigouzo (M, 2015)</td></tr>
<tr><td rowspan="1">Yoshi (F, 2015)</td></tr>
<tr><td rowspan="2">Chiper (F, 2013)</td><td rowspan="1">Gastounet (M, 2020)</td></tr>
<tr><td rowspan="1">Trampoline (F, 2012)</td></tr>
<tr><td rowspan="4">Garance (F, 2018)</td><td rowspan="2">Octave  (M, 2018)</td><td rowspan="1">Benvengu (M, 2020)</td></tr>
<tr><td rowspan="1">Prune (F, 2017)</td></tr>
<tr><td rowspan="2">Eve (F, 2014)</td><td rowspan="1">Youka (M, 2012)</td></tr>
<tr><td rowspan="1">Kalamity (F, 2020)</td></tr>
<tr><td rowspan="16">Etoile (F, 2011)</td><td rowspan="8">Sauron (M, 2021)</td><td rowspan="4">QuoVadis (M, 2020)</td><td rowspan="2">Hélico (M, 2011)</td><td rowspan="1">Arlesien (M, 2020)</td></tr>
<tr><td rowspan="1">Kalmie (F, 2016)</td></tr>
<tr><td rowspan="2">Lumière (F, 2010)</td><td rowspan="1">Talleyran (M, 2021)</td></tr>
<tr><td rowspan="1"><b>Coquine (F, 2021)</b></td></tr>
<tr><td rowspan="4">Soupolait (F, 2019)</td><td rowspan="2">Darius (M, 2010)</td><td rowspan="1">Camai_2 (M, 2013)</td></tr>
<tr><td rowspan="1">Rutabaga (F, 2020)</td></tr>
<tr><td rowspan="2">Ursulita (F, 2021)</td><td rowspan="1">Papagai (M, 2019)</td></tr>
<tr><td rowspan="1">Biloute (F, 2010)</td></tr>
<tr><td rowspan="8">Choupette (F, 2021)</td><td rowspan="4">Faucon (M, 2012)</td><td rowspan="2">Felin (M, 2012)</td><td rowspan="1">Papagai (M, 2019)</td></tr>
<tr><td rowspan="1">Caxixi (F, 2014)</td></tr>
<tr><td rowspan="2">Caroline (F, 2011)</td><td rowspan="1">Hussard (M, 2014)</td></tr>
<tr><td rowspan="1">Stich (F, 2015)</td></tr>
<tr><td rowspan="4">Anis (F, 2014)</td><td rowspan="2">Bariton (M, 2013)</td><td rowspan="1">Raimu (M, 2018)</td></tr>
<tr><td rowspan="1">Coach (F, 2011)</td></tr>
<tr><td rowspan="2">Salopette (F, 2018)</td><td rowspan="1">Liquis (M, 2020)</td></tr>
<tr><td rowspan="1">Rutabaga (F, 2020)</td></tr>
</table>

and I tried to convert it to rst and I have this result
We can see that rowspan are not correct

>>> print(dashtable.html2rst(an.pedigree("html")))
+------------------+---------------------+---------------------+-----------------------+-----------------------+
| Jasmin (M, 2018) | Tassou (M, 2020)    | Bastidon (M, 2017)  | Kappa (M, 2017)       | Savary (M, 2015)      |
|                  |                     |                     |                       +-----------------------+
|                  |                     |                     |                       | Rolex (F, 2012)       |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     | **Coquine (F, 2021)** | Jérico (M, 2012)      |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     |                       | Apostrophe (F, 2020)  |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     | Danette (F, 2013)   | Magritt (M, 2019)     | Sarcouf (M, 2013)     |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Joufflu (F, 2012)     |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     | Xio (F, 2020)         | Caleu (M, 2017)       |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Sirène (F, 2013)      |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  | Epinette (F, 2020)  | Beaulinge (M, 2015) | Ramsès (M, 2019)      | Eigouzo (M, 2015)     |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     |                       | Yoshi (F, 2015)       |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     | Chiper (F, 2013)      | Gastounet (M, 2020)   |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Trampoline (F, 2012)  |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     | Garance (F, 2018)   | Octave  (M, 2018)     | Benvengu (M, 2020)    |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Prune (F, 2017)       |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     |                     | Eve (F, 2014)         | Youka (M, 2012)       |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Kalamity (F, 2020)    |
+------------------+---------------------+---------------------+-----------------------+-----------------------+
| Etoile (F, 2011) | Sauron (M, 2021)    | QuoVadis (M, 2020)  | Hélico (M, 2011)      | Arlesien (M, 2020)    |
|                  |                     |                     |                       +-----------------------+
|                  |                     |                     |                       | Kalmie (F, 2016)      |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     | Lumière (F, 2010)     | Talleyran (M, 2021)   |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     |                       | **Coquine (F, 2021)** |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     | Soupolait (F, 2019) | Darius (M, 2010)      | Camai_2 (M, 2013)     |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Rutabaga (F, 2020)    |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     | Ursulita (F, 2021)    | Papagai (M, 2019)     |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Biloute (F, 2010)     |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  | Choupette (F, 2021) | Faucon (M, 2012)    | Felin (M, 2012)       | Papagai (M, 2019)     |
|                  |                     |                     +-----------------------+-----------------------+
|                  |                     |                     |                       | Caxixi (F, 2014)      |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     | Caroline (F, 2011)    | Hussard (M, 2014)     |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Stich (F, 2015)       |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     | Anis (F, 2014)      | Bariton (M, 2013)     | Raimu (M, 2018)       |
|                  |                     +---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Coach (F, 2011)       |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     |                     | Salopette (F, 2018)   | Liquis (M, 2020)      |
|                  +---------------------+---------------------+-----------------------+-----------------------+
|                  |                     |                     |                       | Rutabaga (F, 2020)    |
+------------------+---------------------+---------------------+-----------------------+-----------------------+

the result with htm2md looks like this
rowspan does not seem to be correct, and html2md should not add a header (is it mandatory ?)

>>> print(dashtable.html2md(an.pedigree("html")))
| Jasmin (M, 2018) |  Tassou (M, 2020)   | Bastidon (M, 2017)  |    Kappa (M, 2017)    |   Savary (M, 2015)    |
|------------------|---------------------|---------------------|-----------------------|-----------------------|
|                  |                     |                     |                       |    Rolex (F, 2012)    |
|                  |                     |                     | **Coquine (F, 2021)** |   Jérico (M, 2012)    |
|                  |                     |                     |                       | Apostrophe (F, 2020)  |
|                  |                     |  Danette (F, 2013)  |   Magritt (M, 2019)   |   Sarcouf (M, 2013)   |
|                  |                     |                     |                       |   Joufflu (F, 2012)   |
|                  |                     |                     |     Xio (F, 2020)     |    Caleu (M, 2017)    |
|                  |                     |                     |                       |   Sirène (F, 2013)    |
|                  | Epinette (F, 2020)  | Beaulinge (M, 2015) |   Ramsès (M, 2019)    |   Eigouzo (M, 2015)   |
|                  |                     |                     |                       |    Yoshi (F, 2015)    |
|                  |                     |                     |   Chiper (F, 2013)    |  Gastounet (M, 2020)  |
|                  |                     |                     |                       | Trampoline (F, 2012)  |
|                  |                     |  Garance (F, 2018)  |   Octave  (M, 2018)   |  Benvengu (M, 2020)   |
|                  |                     |                     |                       |    Prune (F, 2017)    |
|                  |                     |                     |     Eve (F, 2014)     |    Youka (M, 2012)    |
|                  |                     |                     |                       |  Kalamity (F, 2020)   |
| Etoile (F, 2011) |  Sauron (M, 2021)   | QuoVadis (M, 2020)  |   Hélico (M, 2011)    |  Arlesien (M, 2020)   |
|                  |                     |                     |                       |   Kalmie (F, 2016)    |
|                  |                     |                     |   Lumière (F, 2010)   |  Talleyran (M, 2021)  |
|                  |                     |                     |                       | **Coquine (F, 2021)** |
|                  |                     | Soupolait (F, 2019) |   Darius (M, 2010)    |   Camai_2 (M, 2013)   |
|                  |                     |                     |                       |  Rutabaga (F, 2020)   |
|                  |                     |                     |  Ursulita (F, 2021)   |   Papagai (M, 2019)   |
|                  |                     |                     |                       |   Biloute (F, 2010)   |
|                  | Choupette (F, 2021) |  Faucon (M, 2012)   |    Felin (M, 2012)    |   Papagai (M, 2019)   |
|                  |                     |                     |                       |   Caxixi (F, 2014)    |
|                  |                     |                     |  Caroline (F, 2011)   |   Hussard (M, 2014)   |
|                  |                     |                     |                       |    Stich (F, 2015)    |
|                  |                     |   Anis (F, 2014)    |   Bariton (M, 2013)   |    Raimu (M, 2018)    |
|                  |                     |                     |                       |    Coach (F, 2011)    |
|                  |                     |                     |  Salopette (F, 2018)  |   Liquis (M, 2020)    |
|                  |                     |                     |                       |  Rutabaga (F, 2020)   |
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

1 participant