You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/08/03 15:14:01 UTC

[GitHub] [lucene-jira-archive] mocobeta opened a new pull request, #108: Reorder text processing, tweak mention format, escape tilde

mocobeta opened a new pull request, #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108

   #89 
   
   I think this should be safe.
   
   1. Convert Jira's `[~username]` mention to GitHub mention.
   2. Escape all `~` in Jira data
   3. Convert Jira syntax to Markdown


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mocobeta commented on a diff in pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mocobeta commented on code in PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108#discussion_r936795884


##########
migration/src/jira_util.py:
##########
@@ -287,9 +276,23 @@ def escape_gh_issue_link(m: re.Match):
             disp_name = jira_users.get(jira_id)
             gh_m = account_map.get(jira_id)
             # replace Jira name with GitHub account or Jira display name if it is available, othewise show Jira name with ``
-            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`~{jira_id}`"
+            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`@{jira_id}`"
             text = text.replace(m, mention())
     
+    # escape tilde to avoid unintentional strike-throughs in Markdown
+    text = text.replace("~", "\~")

Review Comment:
   Escape `~` **before** Markdown conversion and **after** mention conversion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mocobeta commented on a diff in pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mocobeta commented on code in PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108#discussion_r936796559


##########
migration/src/jira_util.py:
##########
@@ -287,9 +276,23 @@ def escape_gh_issue_link(m: re.Match):
             disp_name = jira_users.get(jira_id)
             gh_m = account_map.get(jira_id)
             # replace Jira name with GitHub account or Jira display name if it is available, othewise show Jira name with ``
-            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`~{jira_id}`"
+            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`@{jira_id}`"
             text = text.replace(m, mention())
     
+    # escape tilde to avoid unintentional strike-throughs in Markdown
+    text = text.replace("~", "\~")
+
+    # convert Jira markup into Markdown with customization
+    elements = MarkupElements()
+    elements.replace(UnorderedList, UnorderedTweakedList)
+    elements.replace(OrderedList, OrderedTweakedList)
+    elements.replace(BlockQuote, TweakedBlockQuote)
+    elements.replace(Quote, TweakedQuote)
+    elements.replace(Monospaced, TweakedMonospaced)
+    elements.insert_after(Ruler, LongRuler)
+    elements.append(EscapeHtmlTag)
+    text = jira2markdown.convert(text, elements=elements)

Review Comment:
   Do syntax conversion after escaping `~`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mocobeta commented on a diff in pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mocobeta commented on code in PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108#discussion_r936795269


##########
migration/src/jira_util.py:
##########
@@ -287,9 +276,23 @@ def escape_gh_issue_link(m: re.Match):
             disp_name = jira_users.get(jira_id)
             gh_m = account_map.get(jira_id)
             # replace Jira name with GitHub account or Jira display name if it is available, othewise show Jira name with ``
-            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`~{jira_id}`"
+            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`@{jira_id}`"

Review Comment:
   Use `@` instead of `~` for mentions.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mocobeta commented on pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mocobeta commented on PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108#issuecomment-1204091313

   The result seems fine: 
   https://github.com/mocobeta/migration-test-3/issues/522
   
   ![Screenshot from 2022-08-04 00-17-21](https://user-images.githubusercontent.com/1825333/182645095-a27a92d9-71a0-42a1-8b82-b21c842c7e39.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mocobeta commented on a diff in pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mocobeta commented on code in PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108#discussion_r936795884


##########
migration/src/jira_util.py:
##########
@@ -287,9 +276,23 @@ def escape_gh_issue_link(m: re.Match):
             disp_name = jira_users.get(jira_id)
             gh_m = account_map.get(jira_id)
             # replace Jira name with GitHub account or Jira display name if it is available, othewise show Jira name with ``
-            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`~{jira_id}`"
+            mention = lambda: f"@{gh_m}" if gh_m else disp_name if disp_name else f"`@{jira_id}`"
             text = text.replace(m, mention())
     
+    # escape tilde to avoid unintentional strike-throughs in Markdown
+    text = text.replace("~", "\~")

Review Comment:
   Escape `~` before Markdown conversion and after mention conversion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-jira-archive] mikemccand merged pull request #108: Reorder text processing, tweak mention format, escape tilde

Posted by GitBox <gi...@apache.org>.
mikemccand merged PR #108:
URL: https://github.com/apache/lucene-jira-archive/pull/108


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org