Skip to content

Commit

Permalink
Fix #27, #28
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoPrevato committed Dec 20, 2022
1 parent 1971d02 commit ebc4218
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion neoteroi/cards/html.py
Expand Up @@ -12,6 +12,7 @@
@dataclass
class CardsViewOptions:
id: str = ""
class_name: str = ""
cols: int = 3
image_bg: bool = False

Expand All @@ -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:
Expand Down
24 changes: 14 additions & 10 deletions neoteroi/contribs/__init__.py
Expand Up @@ -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):
Expand Down

0 comments on commit ebc4218

Please sign in to comment.