Skip to content

Support print_table, print_wrapped, print_in_columns in Thor::Shell::HTML #439

@maxlinc

Description

@maxlinc

I've got a nice-to-have feature request. No bug or urgent need, but it doens't look hard to implement. I just wanted to make sure Thor::Shell::HTML is deprecated before working on a PR.

I'm not really sure who is using Thor::Shell::HTML or how they use it. I haven't seen much documentation or usage so I realize it might be partially supported.

Having said that, I have come across situations where I'd like a command I'd like to give users the option between text (Thor::Shell::Colored), Markdown or HTML output. This makes a lot of sense for the print_table command, which has:

Text tables (color not shown on GitHub)

Suite  Scenario     Implementor  Status
Katas  hello world  ruby         Fully Verified (2 of 2)
Katas  hello world  java         Fully Verified (2 of 2)
Katas  hello world  python       Fully Verified (2 of 2)
Katas  quine        ruby         <Not Found>
Katas  quine        java         Fully Verified (2 of 2)
Katas  quine        python       Fully Verified (2 of 2)

Markdown Tables (not in original markdown, but common extension supported by GFM and others)

Suite | Scenario | Implementor | Status
------|----------|-------------|-------
Katas | hello world | ruby | Fully Verified (2 of 2)
Katas | hello world | java | Fully Verified (2 of 2)
Katas | hello world | python | Fully Verified (2 of 2)
Katas | quine | ruby | <Not Found>
Katas | quine | java | Fully Verified (2 of 2)
Katas | quine | python | Fully Verified (2 of 2)

HTML (equivalent to GFM-rendered Markdown)

<table>
  <thead><tr>
    <th>Suite</th>
    <th>Scenario</th>
    <th>Implementor</th>
    <th>Status</th>
  </tr></thead>
  <tbody>
    <tr>
      <td>Katas</td>
      <td>hello world</td>
      <td>ruby</td>
      <td>Fully Verified (2 of 2)</td>
    </tr>
    <tr>
      <td>Katas</td>
      <td>hello world</td>
      <td>java</td>
      <td>Fully Verified (2 of 2)</td>
    </tr>
    <tr>
      <td>Katas</td>
      <td>hello world</td>
      <td>python</td>
      <td>Fully Verified (2 of 2)</td>
    </tr>
    <tr>
      <td>Katas</td>
      <td>quine</td>
      <td>ruby</td>
      <td></td>
    </tr>
    <tr>
      <td>Katas</td>
      <td>quine</td>
      <td>java</td>
      <td>Fully Verified (2 of 2)</td>
    </tr>
    <tr>
      <td>Katas</td>
      <td>quine</td>
      <td>python</td>
      <td>Fully Verified (2 of 2)</td>
    </tr>
  </tbody>
</table>

If I use the current Thor::Shell::HTML I get HTML colors mixed with ASCII tables, resulting in:

<span style="color: green;">Suite</span>  <span style="color: green;">Scenario</span>     <span style="color: green;">Implementor</span>  <span style="color: green;">Status</span>
Katas<span style="color: white;"></span>  hello world<span style="color: white;"></span>  ruby<span style="color: white;"></span>         <span style="color: green;">Fully Verified (2 of 2)</span>
Katas<span style="color: white;"></span>  hello world<span style="color: white;"></span>  java<span style="color: white;"></span>         <span style="color: green;">Fully Verified (2 of 2)</span>
Katas<span style="color: white;"></span>  hello world<span style="color: white;"></span>  python<span style="color: white;"></span>       <span style="color: green;">Fully Verified (2 of 2)</span>
Katas<span style="color: white;"></span>  quine<span style="color: white;"></span>        ruby<span style="color: white;"></span>         <span style="color: red;"><Not Found></span>
Katas<span style="color: white;"></span>  quine<span style="color: white;"></span>        java<span style="color: white;"></span>         <span style="color: green;">Fully Verified (2 of 2)</span>
Katas<span style="color: white;"></span>  quine<span style="color: white;"></span>        python<span style="color: white;"></span>       <span style="color: green;">Fully Verified (2 of 2)</span>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions