Skip to content

Commit

Permalink
Release bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Apr 13, 2021
1 parent e65a9b2 commit a215ffd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Versions and bullets are arranged chronologically from latest to oldest.

## v1.0.2

- Do not replace slash(`/`) in lua modules.

## v1.0.1

- Fix "TypeError: upgrade_dependencies() got an unexpected keyword argument"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="legunto",
version="1.0.1",
version="1.0.2",
description="Fetch MediaWiki Scribunto modules from wikis",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
7 changes: 0 additions & 7 deletions src/scribunto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ def search_dependencies(text: str, prefix=None) -> List[str]:


def rewrite_requires(text: str, prefix: str) -> str:
# Module:foo/bar -> Module:foo-bar
regex = r'''(?:require|mw\.loadData)\s*\(\s*['"](?:[Mm]odule|모듈):[^'"]+['"]''' # noqa: E501

module_names = re.findall(regex, text)
for name in module_names:
text = text.replace(name, name.replace("/", "-"))

# Module:foo -> Module:@en/foo
regex = r"""((?:require|mw\.loadData)\s*\(\s*['"](?:[Mm]odule|모듈):)([^'"]+)(['"])""" # noqa: E501

Expand Down
2 changes: 1 addition & 1 deletion test/scribunto_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_rewrite_requires() -> None:
assert actual == expected

text = "require('Module:Foo/bar')"
expected = "require('Module:@en/Foo-bar')"
expected = "require('Module:@en/Foo/bar')"
actual = scribunto.rewrite_requires(text, 'en')

assert actual == expected

0 comments on commit a215ffd

Please sign in to comment.