diff --git a/tagmark/core/data.py b/tagmark/core/data.py index d3ce51d..a3b4438 100644 --- a/tagmark/core/data.py +++ b/tagmark/core/data.py @@ -1,6 +1,7 @@ import json import re from dataclasses import dataclass, field +from urllib.parse import quote_plus from pathlib import Path from typing import Iterable @@ -257,6 +258,10 @@ def count_total(self): def count_github(self): return self.filtered_tagmark.count_github_url + @property + def as_url_param(self): + return quote_plus(self.value) + def filter( self, tagmark: Tagmark, diff --git a/tagmark/tools/maketagdoc.toml.default b/tagmark/tools/maketagdoc.toml.default index 05aff77..db08a57 100644 --- a/tagmark/tools/maketagdoc.toml.default +++ b/tagmark/tools/maketagdoc.toml.default @@ -14,7 +14,7 @@ regex = "{{((.*?):(.*?))}}" [formatter.value.format_expression] total = "[All TagMarks]({url_base}) `Total {filter.count_total} (Github {filter.count_github})`" tag = "{tag_item.formatted_name}" # `tag_item` is the instance on tagmark.core.tag.TagItem -filter = "{url_base}/?tags={filter.value}" # `filter` is the instance of tagmark.core.data.TagmarkFilter -tag_filter_counts = "[{tag_item.formatted_name}]({url_base}/?tags={filter.value}) `Total {filter.count_total} (Github {filter.count_github})`" -tag_filter = "[{tag_item.formatted_name}]({url_base}/?tags={filter.value})" -filter_counts = "({url_base}/?tags={filter.value}) `Total {filter.count_total} (Github {filter.count_github})`" \ No newline at end of file +filter = "{url_base}/?tags={filter.as_url_param}" # `filter` is the instance of tagmark.core.data.TagmarkFilter +tag_filter_counts = "[{tag_item.formatted_name}]({url_base}/?tags={filter.as_url_param}) `Total {filter.count_total} (Github {filter.count_github})`" +tag_filter = "[{tag_item.formatted_name}]({url_base}/?tags={filter.as_url_param})" +filter_counts = "({url_base}/?tags={filter.as_url_param}) `Total {filter.count_total} (Github {filter.count_github})`" \ No newline at end of file diff --git a/tests/data/maketagdoc_result.md b/tests/data/maketagdoc_result.md index bcfe195..3f4d089 100644 --- a/tests/data/maketagdoc_result.md +++ b/tests/data/maketagdoc_result.md @@ -2,6 +2,6 @@ * [All TagMarks](https://pwnfan.github.io/tagmark) `Total 2 (Github 2)` -* test line #1: line start, [library / moudle / package](https://pwnfan.github.io/tagmark/?tags=library) `Total 2 (Github 2)`. line middle, [development bookmarks with count](https://pwnfan.github.io/tagmark/?tags=dev) `Total 2 (Github 2)`, line end. +* test line #1: line start, [library / package / module](https://pwnfan.github.io/tagmark/?tags=library) `Total 2 (Github 2)`. line middle, [development bookmarks with count](https://pwnfan.github.io/tagmark/?tags=dev) `Total 2 (Github 2)`, line end. * test line #2: {{xxxyyy}} -* test line #3: line start, [library / moudle / package](https://pwnfan.github.io/tagmark/?tags=library). line middle, [development bookmarks without count]https://pwnfan.github.io/tagmark/?tags=dev AND license , only tag: `development` , line end. +* test line #3: line start, [library / package / module](https://pwnfan.github.io/tagmark/?tags=library). line middle, [development bookmarks without count]https://pwnfan.github.io/tagmark/?tags=dev+AND+license , only tag: `development` , line end.