allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#6845] Preserve links in GC ticket import and fixed Index error on non-GC links
Date Wed, 13 Nov 2013 18:28:18 GMT
Updated Branches:
  refs/heads/cj/6845 b459bd370 -> f61a93ab3


[#6845] Preserve links in GC ticket import and fixed Index error on non-GC links

Signed-off-by: Cory Johns <cjohns@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/f61a93ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f61a93ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f61a93ab

Branch: refs/heads/cj/6845
Commit: f61a93ab326874bb331facac60b8360346497c69
Parents: b459bd3
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Nov 13 18:23:19 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Nov 13 18:23:19 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/f61a93ab/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)


Mime
View raw message