Skip to content

Commit

Permalink
Fix logging bugs in `md2md_convert_github_style_alert_to_hexo_style_a…
Browse files Browse the repository at this point in the history
…lert_filter`.
  • Loading branch information
Zhaopudark committed Feb 25, 2024
1 parent 6094cae commit f2e178d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Pandoc-Filter 0.2.x
## Release 0.2.7
Fix logging bugs in `md2md_convert_github_style_alert_to_hexo_style_alert_filter`.

## Release 0.2.6
Add `md2md_convert_github_style_alert_to_hexo_style_alert_filter`, which can convert the [github-style alert](https://github.com/orgs/community/discussions/16925) to hexo-style alert.The github-style alert is based on pandoc's `BlockQuote` element, while the hexo-style alert is based on [hexo tag plugins](https://hexo.io/docs/tag-plugins#Note).We use a general mode to confirm the hexo-style alert type, which are widely used in the hexo community by many themes, such as
- [hexo-theme-butterfly](https://butterfly.js.org/posts/4aa8abbe/?highlight=%25+endnote#%E6%A8%99%E7%B1%A4%E5%A4%96%E6%8E%9B%EF%BC%88Tag-Plugins%EF%BC%89),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ def _get_and_map_alerts(input_string:str)->tuple[str,str]|None:
case [pf_para,*rest] if isinstance(pf_para,pf.Para) and len(rest)>0 and len(pf_para.content)==1 and isinstance(pf_para.content[0],pf.Str):
pf_str:pf.Str = pf_para.content[0]
if (maybe_alert_type:=_get_and_map_alerts(pf_str.text)) is not None:
tracing_logger.logger.info(f"---",elem)
tracing_logger.logger.info(f"+++",content)
tracing_logger.logger.info(f"---{elem}")
tracing_logger.logger.info(f"+++{content}")
content = [pf.Para(pf.Str(maybe_alert_type[0])),
*rest,
pf.Para(pf.Str(maybe_alert_type[1]))]
return content
case [pf_para] if isinstance(pf_para,pf.Para) and isinstance(pf_para.content[0],pf.Str):
pf_str:pf.Str = pf_para.content[0]
if (maybe_alert_type:=_get_and_map_alerts(pf_str.text)) is not None:
tracing_logger.logger.info(f"---",elem)
tracing_logger.logger.info(f"+++",content)
tracing_logger.logger.info(f"---{elem}")
tracing_logger.logger.info(f"+++{content}")
for index,item in enumerate(pf_para.content[1::]):
if isinstance(item,pf.LineBreak) or isinstance(item,pf.SoftBreak) or isinstance(item,pf.Space):
continue
Expand Down
2 changes: 1 addition & 1 deletion src/pandoc_filter/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .utils import check_pandoc_version

check_pandoc_version(required_version='3.1.0')
__version__ = '0.2.6'
__version__ = '0.2.7'

0 comments on commit f2e178d

Please sign in to comment.