diff --git a/CHANGELOG.md b/CHANGELOG.md index c66b7ae..400d4e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.3] - 2022-12-20 +- Adds the possibility to specify a `class` for the root HTML element of `cards` +- Fixes a bug in the `contribs` plugin (adds a carriage return before the + contribution fragment) + ## [0.1.2] - 2022-10-04 - Corrects the pattern handling name and email for the `contribs` plugin - Adds tests for the `contribs` plugin diff --git a/neoteroi/cards/html.py b/neoteroi/cards/html.py index eee0bfa..4cd0495 100644 --- a/neoteroi/cards/html.py +++ b/neoteroi/cards/html.py @@ -12,6 +12,7 @@ @dataclass class CardsViewOptions: id: str = "" + class_name: str = "" cols: int = 3 image_bg: bool = False @@ -36,9 +37,16 @@ def get_item_props(self, item: CardItem): return item_props + def _get_root_class(self): + base_class = f"nt-cards nt-grid cols-{self.options.cols}" + + if self.options.class_name: + return base_class + " " + self.options.class_name + return base_class + def build_html(self, parent, cards: Cards): root_element = etree.SubElement( - parent, "div", {"class": f"nt-cards nt-grid cols-{self.options.cols}"} + parent, "div", {"class": self._get_root_class()} ) for item in cards.items: diff --git a/neoteroi/contribs/__init__.py b/neoteroi/contribs/__init__.py index 28a8549..068a4d6 100644 --- a/neoteroi/contribs/__init__.py +++ b/neoteroi/contribs/__init__.py @@ -111,16 +111,20 @@ def _set_contributors(self, markdown: str, page: Page) -> str: page_file = page.file last_commit_date = self._get_last_commit_date(page_file) contributors = self._get_contributors(page_file) - return markdown + render_contribution_stats( - contributors, - last_commit_date, - ContribsViewOptions( - self.config["contributors_label"], - self.config["last_modified_label"], - self.config["show_last_modified_time"], - self.config["show_contributors_title"], - self.config["time_format"], - ), + return ( + markdown + + "\n\n" + + render_contribution_stats( + contributors, + last_commit_date, + ContribsViewOptions( + self.config["contributors_label"], + self.config["last_modified_label"], + self.config["show_last_modified_time"], + self.config["show_contributors_title"], + self.config["time_format"], + ), + ) ) def on_page_markdown(self, markdown, *args, **kwargs):