BoboTiG / ebook-reader-dict

Finally decent dictionaries based on the Wiktionary for your beloved eBook reader. Daily updates & 14 languages supported so far.
http://www.tiger-222.fr/?d=2020/04/17/22/14/21-un-dictionnaire-alternatif-et-complet-pour-votre-liseuse
MIT License
412 stars 24 forks source link

[FR] Render wikitables in etymology #1024

Closed BoboTiG closed 3 years ago

BoboTiG commented 3 years ago

Wikicode:

: {| class="wikitable"
! [[cas sujet]]
! [[cas régime]]
! [[cas sujet]] + ''[[-esse]]''
|-
| [[pechere]]
| [[pecheur]]
| [[pecheresse]]
|-
| [[enchantere]]
| [[enchanteur]]
| [[enchanteresse]]
|}

Output:

{| class="wikitable"

Expected:

lasconic commented 3 years ago

Do you know if HTML table can be rendered on Kobo ?

BoboTiG commented 3 years ago

I have no idea for now.

lasconic commented 3 years ago

I just tested the following:

<table>
            <tr>
                <th>Firstname</th>
                <th>Lastname</th>
            </tr>
            <tr>
                <td>Peter</td>
                <td>Griffin</td>
            </tr>
            <tr>
                <td>Lois</td>
                <td>Griffin</td>
            </tr>
        </table>

in constants.py --> WORD_FORMAT, after the definition.

then generate a dictionary with:

$ mkdir nuit
$ python -m wikidict fr --gen-dict=nuit --output=nuit

Load on kobo and search for nuit

screen_001

lasconic commented 3 years ago

Something like this works ! It adds borders to the table and make the text bigger. We just need to find the right size.

<w>
    <p>
        <a name="{word}"/><b>{current_word}</b>{pronunciation}{gender}
        <br/>
        <br/>
        {etymology}
        <ol>{definitions}</ol>
        <table>
            <tr>
                <th>Firstname</th>
                <th>Lastname</th>
            </tr>
            <tr>
                <td>Peter</td>
                <td>Griffin</td>
            </tr>
            <tr>
                <td>Lois</td>
                <td>Griffin</td>
            </tr>
        </table>
    </p>
    <style>
        table, th, td {{
            border: 1px solid black;
            font-size:20pt;
        }}
    </style>
    {var}
</w>
BoboTiG commented 3 years ago

Excellent!

lasconic commented 3 years ago

font-size:1em screen_002

font-size: 2.5em screen_003

BoboTiG commented 3 years ago

font-size: 2.5em seems quite ideal :+1: