Skip to content

Commit

Permalink
Do not add column classes to tables with 2 columns
Browse files Browse the repository at this point in the history
Only do it for tables with 3, 4, or 5 columns.
  • Loading branch information
pcraig3 committed Sep 20, 2024
1 parent c2a828b commit c520532
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve

### Changed

- Add default width classes to markdown tables with 2-5 cols
- Add default width classes to markdown tables with 3,4,5 cols
- Updated column headers on NOFO index table
- "Top" link on nofo_edit page is always visible
- Appearing and disappearing was causing issues
Expand Down
4 changes: 1 addition & 3 deletions bloom_nofos/nofos/nofo.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ def convert_th(self, el, text, convert_as_inline):
def _determine_width_class_from_th_siblings(th_count=0):
# Determine the width class based on the number of <th> elements in the first table row
width_class = ""
if th_count == 2:
width_class = "w-50"
elif th_count == 3:
if th_count == 3:
width_class = "w-33"
elif th_count == 4:
width_class = "w-25"
Expand Down
4 changes: 1 addition & 3 deletions bloom_nofos/nofos/test_nofo.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ def test_table_1_th(self):

def test_table_2_ths(self):
html = "<table><tr><th>TH 1</th><th>TH 2</th></tr><tr><td>Cell 1</td><td>Cell 2</td></th></table>"
expected_markdown = (
"| TH 1 {: .w-50 } | TH 2 {: .w-50 } |\n| --- | --- |\n| Cell 1 | Cell 2 |"
)
expected_markdown = "| TH 1 | TH 2 |\n| --- | --- |\n| Cell 1 | Cell 2 |"
md_body = md(html)
self.assertEqual(md_body.strip(), expected_markdown.strip())

Expand Down

0 comments on commit c520532

Please sign in to comment.