Skip to content

Commit

Permalink
🐛 修复无源代码时多余的或
Browse files Browse the repository at this point in the history
  • Loading branch information
snowykami committed Aug 30, 2024
1 parent 1e85158 commit 4645b85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion litedoc/syntax/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ def markdown(self, lang: str, indent: int = 0, **kwargs) -> str:
origin_url = kwargs.get("bu") + f"{self.module_file_path}#L{self.lineno}"
# a_tag = f"\n\n[{get_text(lang, 'view_on_github')}]({origin_url})"
a_tag = f"<a href='{origin_url}' target='_blank'>{get_text(lang, 'view_on_github')}</a>"
or_and_a = f" {get_text(lang, 'or')} {a_tag}"
else:
a_tag = ""
md += PREFIX + f"\n<details>\n<summary> <b>{get_text(lang, 'src')}</b> {get_text(lang, 'or')} {a_tag}</summary>\n\n```python\n{self.src}\n```\n</details>\n\n"
or_and_a = ""
md += PREFIX + f"\n<details>\n<summary> <b>{get_text(lang, 'src')}</b>{or_and_a}</summary>\n\n```python\n{self.src}\n```\n</details>\n\n"

return md

Expand Down
2 changes: 1 addition & 1 deletion test_mkdoc.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
chcp 65001
python -m litedoc tests/test_modules/mbcp -o docdist/api -l zh-Hans -fd def -md def -cd 类 -cs -bu https://github.com/snowykami/mbcp/tree/main/mbcp/
python -m litedoc tests/test_modules/mbcp -o docdist/en/api -l en -fd def -md def -cs -bu https://github.com/snowykami/mbcp/tree/main/mbcp/
python -m litedoc tests/test_modules/mbcp -o docdist/en/api -l en -fd def -md def -cs

0 comments on commit 4645b85

Please sign in to comment.