HTML table to “graphical text” for code comments -


After

There is a tool (based on the ideal command line) that helps in converting source for HTML tables in graphical text For use in code comment (maybe sounds for HTML tables), in the form shown below

For example, the following HTML table source was given

  & lt ;? Table border = 1 & gt; & Lt; Captions & gt; A test table with merged cells & lt; / CAPTION & gt; & Lt; TR & gt; & Lt; Th rowspan = 2 & gt; & Lt; Th colspan = 2 & gt; By average & lt; Th rowspan = 2 & gt; Other & lt; BR & gt; Category & LT; Th & gt; Miscellaneous & LT; TR & gt; & Lt; Th & gt; From the height & lt; Th & gt; Weight of & lt; TR & gt; & Lt; Th align = left> Men's & lt; TD & gt; 1.9 & LT; TD & gt; 0.003 & LT; TR & gt; & Lt; Th align = left rowspan = 2 & gt; Women's & lt; TD & gt; 1.7 & LT; TD & gt; 0.002 & lt; / Table & gt;  

To embed the device code comments (like / * ... * / ), some output will do the following:

 < Code> / * A test table with merged cell + ---------- + ------------------- + ----- ---- - + -------- + | | Average | Others | Miscellaneous | | + --------- + --------- + Category + -------- | | | Height | Weight | | | | ---------- + --------- + --------- + ---------- + ------- - | | Men | 1.9 | 0.003 | | | | ---------- + --------- + --------- + ---------- + ------- - | | Women | 1.7 | 0.002 | | | + ---------- + --------- + --------- + ---------- + ------- Background: A piece of code that reads values ​​from HTML tables can be commented with commentary depicting text based graphical representations of complex HTML table layouts. Someone can later retain the code to find it easy to understand, for example, how to slice a piece of code and break the value on dicing an HTML table or some cell posts. 

This tool is written in Python:

See:

DashTable

HTML table in ASCII table, colspan and embection; Rossoon's permission!


Comments