Skip to content

Commit

Permalink
Merge pull request #296 from vkottler/dev/5.8.4
Browse files Browse the repository at this point in the history
5.8.4 - Better rendering for markdown tables
  • Loading branch information
vkottler authored Dec 29, 2024
2 parents 688d909 + 3236996 commit c8edd16
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=runtimepy version=5.8.3
repo=runtimepy version=5.8.4
if: |
matrix.python-version == '3.12'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.4
hash=a0578deccfc29186901fc54d3849b52b
hash=f89c565370dd68d4215345aeab6feff4
=====================================
-->

# runtimepy ([5.8.3](https://pypi.org/project/runtimepy/))
# runtimepy ([5.8.4](https://pypi.org/project/runtimepy/))

[![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
![Build Status](https://github.com/vkottler/runtimepy/workflows/Python%20Package/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion local/configs/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ time_command: true

requirements:
- aiofiles
- vcorelib>=3.4.7
- vcorelib>=3.4.8
- svgen>=0.7.4
- websockets
- psutil
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 5
minor: 8
patch: 3
patch: 4
entry: runtimepy
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "runtimepy"
version = "5.8.3"
version = "5.8.4"
description = "A framework for implementing Python services."
readme = "README.md"
requires-python = ">=3.12"
Expand Down
4 changes: 2 additions & 2 deletions runtimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=b65d0c030290cfc108e2e5e85293e331
# hash=99838ab674af55409015e5abdd55fc6e
# =====================================

"""
Expand All @@ -10,7 +10,7 @@

DESCRIPTION = "A framework for implementing Python services."
PKG_NAME = "runtimepy"
VERSION = "5.8.3"
VERSION = "5.8.4"

# runtimepy-specific content.
METRICS_NAME = "metrics"
Expand Down
24 changes: 22 additions & 2 deletions runtimepy/net/html/bootstrap/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,14 @@ def slider(
return elem


TABLE_CLASSES = ["table", "table-hover", "table-striped", "table-bordered"]


def centered_markdown(
parent: Element, markdown: str, *container_classes: str
parent: Element,
markdown: str,
*container_classes: str,
table_classes: list[str] = None,
) -> Element:
"""Add centered markdown."""

Expand All @@ -188,7 +194,21 @@ def centered_markdown(

with StringIO() as stream:
writer = IndentedFileWriter(stream)
writer.write_markdown(markdown)

if table_classes is None:
table_classes = TABLE_CLASSES

def render_hook(data: str) -> str:
"""Make some adjustments to various element declarations."""

if table_classes:
data = data.replace(
"<table>", f'<table class="{' '.join(table_classes)}">'
)

return data

writer.write_markdown(markdown, hook=render_hook)
div(
text=stream.getvalue(),
parent=horiz_container,
Expand Down
2 changes: 1 addition & 1 deletion runtimepy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aiofiles
vcorelib>=3.4.7
vcorelib>=3.4.8
svgen>=0.7.4
websockets
psutil
Expand Down

0 comments on commit c8edd16

Please sign in to comment.