Skip to content

Commit

Permalink
Merge pull request #20 from shimizukawa/t13-wrong-url-link
Browse files Browse the repository at this point in the history
refs #13: page link with link text will have unnecessary prefix "http…
  • Loading branch information
shimizukawa authored Sep 25, 2019
2 parents 219514d + 3cc04c5 commit e43c8cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/13.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
page link with link text will have unnecessary prefix "http://scrapbox.io/proj/" on conversion.
6 changes: 2 additions & 4 deletions scrap2rst/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,16 @@ def parse_inline_and_render(self, line: str, ln: int, indent: int) -> str:
_pre, _target, _post = m.groups()
if M['link_external'](_target):
_link, _title = M['link_external'](_target).groups()
_internal = False
else:
_link = _target.replace(' ', '_')
_link = self.user_url + '/' + _target.replace(' ', '_')
_title = _target
_internal = True

if _pre:
_pre = _pre + ' '
if _post:
_post = ' ' + _post
result = '{0}`{1}`_{2}'.format(_pre, _title, _post)
self.link_targets[_title] = self.user_url + '/' + _link
self.link_targets[_title] = _link
else:
name = 'NOTHING'
result = line
Expand Down

0 comments on commit e43c8cb

Please sign in to comment.