You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/14 18:36:45 UTC
[24/43] git commit: [#6845] Preserve links in GC ticket import and
fixed Index error on non-GC links
[#6845] Preserve links in GC ticket import and fixed Index error on non-GC links
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d1aa716b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d1aa716b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d1aa716b
Branch: refs/heads/cj/6836
Commit: d1aa716b2df39fc137081fae6bcb893d95b61706
Parents: a069ca4
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Wed Nov 13 18:23:19 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Nov 13 19:15:29 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/google/__init__.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d1aa716b/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 7a75eaf..60f96c3 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -59,7 +59,8 @@ def _as_markdown(tag, project_name):
href = urlparse(fragment['href'])
qs = parse_qs(href.query)
gc_link = not href.netloc or href.netloc == 'code.google.com'
- target_project = href.path.split('/')[2]
+ path_parts = href.path.split('/')
+ target_project = path_parts[2] if gc_link and len(path_parts) >= 3 else ''
internal_link = target_project == project_name
if gc_link and internal_link and 'id' in qs:
# rewrite issue 123 project-internal issue links
@@ -74,8 +75,8 @@ def _as_markdown(tag, project_name):
urljoin('https://code.google.com/p/%s/issues/' % project_name, fragment['href']),
)
else:
- # un-link all others
- fragment = h.plain2markdown(fragment.text, preserve_multiple_spaces=True, has_html_entities=True)
+ # convert all other links to Markdown syntax
+ fragment = '[%s](%s)' % (fragment.text, fragment['href'])
elif getattr(fragment, 'name', None) == 'i':
# preserve styling of "(No comment was entered for this change.)" messages
fragment = '*%s*' % h.plain2markdown(fragment.text, preserve_multiple_spaces=True, has_html_entities=True)