You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2022/07/11 07:39:40 UTC

[lucene-jira-archive] branch escape-html-tags created (now 907119b3)

This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a change to branch escape-html-tags
in repository https://gitbox.apache.org/repos/asf/lucene-jira-archive.git


      at 907119b3 only escape HTML tags

This branch includes the following new commits:

     new 907119b3 only escape HTML tags

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-jira-archive] 01/01: only escape HTML tags

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a commit to branch escape-html-tags
in repository https://gitbox.apache.org/repos/asf/lucene-jira-archive.git

commit 907119b3260fbc8b114609710f5fce1fd1ef2703
Author: Tomoko Uchida <to...@gmail.com>
AuthorDate: Mon Jul 11 16:39:30 2022 +0900

    only escape HTML tags
---
 migration/src/jira_util.py           | 4 ++--
 migration/src/markup/text_effects.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/migration/src/jira_util.py b/migration/src/jira_util.py
index 3cc916d3..a3a34bf4 100644
--- a/migration/src/jira_util.py
+++ b/migration/src/jira_util.py
@@ -10,7 +10,7 @@ from jira2markdown.markup.text_effects import BlockQuote, Quote, Monospaced
 from jira2markdown.markup.text_breaks import Ruler
 
 from markup.lists import UnorderedTweakedList, OrderedTweakedList
-from markup.text_effects import EscapeHtml, TweakedBlockQuote, TweakedQuote, TweakedMonospaced
+from markup.text_effects import EscapeHtmlTag, TweakedBlockQuote, TweakedQuote, TweakedMonospaced
 from markup.text_breaks import LongRuler
 
 
@@ -212,7 +212,7 @@ def convert_text(text: str, att_replace_map: dict[str, str] = {}, account_map: d
     elements.replace(Quote, TweakedQuote)
     elements.replace(Monospaced, TweakedMonospaced)
     elements.insert_after(Ruler, LongRuler)
-    elements.append(EscapeHtml)
+    elements.append(EscapeHtmlTag)
     text = jira2markdown.convert(text, elements=elements)
 
     # markup @ mentions with ``
diff --git a/migration/src/markup/text_effects.py b/migration/src/markup/text_effects.py
index 3a4e87aa..a59636e4 100644
--- a/migration/src/markup/text_effects.py
+++ b/migration/src/markup/text_effects.py
@@ -59,11 +59,11 @@ class TweakedMonospaced(AbstractMarkup):
         return QuotedString("{{", endQuoteChar="}}").setParseAction(self.action)
 
 
-class EscapeHtml(AbstractMarkup):
+class EscapeHtmlTag(AbstractMarkup):
     """
     Escapes HTML characters that are not a part of any expression grammar
     """
 
     @property
     def expr(self) -> ParserElement:
-        return Literal("<").setParseAction(replaceWith("&lt;")) ^ Literal(">").setParseAction(replaceWith("&gt;")) ^ Literal("&").setParseAction(replaceWith("&amp;"))
+        return Literal("<").setParseAction(replaceWith("&lt;")) + SkipTo(Literal(">")) + Literal(">").setParseAction(replaceWith("&gt;"))