Skip to content

Commit

Permalink
removed a print statement + better README
Browse files Browse the repository at this point in the history
  • Loading branch information
hvalev committed Aug 17, 2022
1 parent 1e68915 commit eb79293
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
61 changes: 31 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,37 @@ where data is a `list` of `dict` where each dict represents a row. Keys must be
Chaining `.setParams(...)` to a `markdownTable(data)` object allows you to pass the following keyword arguments:

```
| param | type | values | description |
|-----------------|-----------------|---------------|------------------------------------------------------------|
| row_sep | str | | Row separation strategy using `----` as pattern |
| | | always | Separate each row |
| | | topbottom |Separate the top (header) and bottom (last row) of the table|
| | | markdown | Separate only header from body |
| | | None | No row separators will be inserted |
| padding_width | int | | Allocate padding to all table cells |
| padding_weight | str | | Strategy for allocating padding within table cells |
| | | left | Aligns cell's contents to the end of the cell |
| | | right | Aligns cell's contents to the beginning of the cell |
| | | centerleft | Centers cell's contents with extra padding |
| | | | allocated to the beginning of the cell |
| | | centerright | Centers cell's contents with extra padding |
| | | | allocated to the end of the cell |
| padding_char | str | | Single character used to fill extra and |
| | | | normal padding with. Default is a blank |
| | | | space ` `. |
| newline_char | str | | Custom character appended to each row to |
| | | | force a newline. Default is `\n` |
| float_rounding | int | | Keep values up until `float_rounder` after the |
| | | | decimal dot. Default is `2`, but can also |
| | | | be set to `None` to not round down |
| | | | floats. |
| quote | bool | | If `true` (default) wrap the generated markdown |
| | | | table with block code quote |
| multiline | dict<Any,int> | | Predefine the column width by passing a |
| | | | dict() with keys matching those of the |
| | | | passed data and values -- the desired width |
| | | | for each corresponding column. |
| param | type | values | description |
|-----------------|-----------------|---------------|----------------------------------------------------|
| row_sep | str | | Row separation strategy using `----` as pattern |
| | | always | Separate each row |
| | | topbottom | Separate the top (header) and bottom |
| | | | (last row) of the table |
| | | markdown | Separate only header from body |
| | | None | No row separators will be inserted |
| padding_width | int | | Allocate padding to all table cells |
| padding_weight | str | | Strategy for allocating padding within table cells |
| | | left | Aligns cell's contents to the end of the cell |
| | | right | Aligns cell's contents to the beginning of the cell|
| | | centerleft | Centers cell's contents with extra padding |
| | | | allocated to the beginning of the cell |
| | | centerright | Centers cell's contents with extra padding |
| | | | allocated to the end of the cell |
| padding_char | str | | Single character used to fill extra and |
| | | | normal padding with. Default is a blank |
| | | | space ` `. |
| newline_char | str | | Custom character appended to each row to |
| | | | force a newline. Default is `\n` |
| float_rounding | int | | Keep values up until `float_rounder` after |
| | | | the decimal dot. Default is `2`, but |
| | | | can also be set to `None` to not |
| | | | round down floats. |
| quote | bool | | If `true` (default) wrap the generated |
| | | | markdown table with block code quote |
| multiline | dict<Any,int> | | Predefine the column width by passing a |
| | | | dict() with keys matching those of the |
| | | | passed data and values -- the desired |
| | | | width for each corresponding column. |
```

## Using it with a dataframe
Expand Down
2 changes: 1 addition & 1 deletion markdownTable/__gendesc__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
{'param': 'multiline', 'type': 'dict<Any,int>', 'values': '', 'description': 'Predefine the column width by passing a dict() with keys matching those of the passed data and values -- the desired width for each corresponding column.'},
]

widths = {'param': 17, 'type': 17, 'values': 15, 'description': 60}
widths = {'param': 17, 'type': 17, 'values': 15, 'description': 52}

print(markdownTable(params).setParams(padding_char=' ', padding_weight='centerleft', padding_width=3, row_sep='markdown', multiline=widths).getMarkdown())
1 change: 0 additions & 1 deletion markdownTable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def getMultilineRow(self, item):
buffer = 0
spacing_between_items = 0
while len(items) > 0:
print(items)
if len(items[0]) + buffer + spacing_between_items + self.padding_width <= self.var_padding[key]:
buffer += len(items[0])
single_row.append(items.pop(0))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="py-markdown-table",
version="0.3.2",
version="0.3.3",
author="hvalev",
description="A package used to generate basic markdown tables from a list of dicts",
long_description=long_description,
Expand Down

0 comments on commit eb79293

Please sign in to comment.