ThirdParty/Jasy/jasy/js/api/Text.py

branch
maintenance
changeset 6693
3629d88ae235
parent 6647
2a11e1b2dcbe
parent 6692
c104c120e043
child 6694
1cccd74fd355
diff -r 2a11e1b2dcbe -r 3629d88ae235 ThirdParty/Jasy/jasy/js/api/Text.py
--- a/ThirdParty/Jasy/jasy/js/api/Text.py	Thu Jan 10 14:23:49 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#
-# Jasy - Web Tooling Framework
-# Copyright 2010-2012 Zynga Inc.
-#
-
-from __future__ import unicode_literals
-
-import re
-import jasy.core.Console as Console
-
-__all__ = ["extractSummary"]
-
-# Used to filter first paragraph from HTML
-paragraphExtract = re.compile(r"^(.*?)(\. |\? |\! |$)")
-newlineMatcher = re.compile(r"\n")
-
-# Used to remove markup sequences after doc processing of comment text
-stripMarkup = re.compile(r"<.*?>")
-
-def extractSummary(text):
-    try:
-        text = stripMarkup.sub("", newlineMatcher.sub(" ", text))
-        matched = paragraphExtract.match(text)
-    except TypeError:
-        matched = None
-        
-    if matched:
-        summary = matched.group(1)
-        if summary is not None:
-            if not summary.endswith((".", "!", "?")):
-                summary = summary.strip() + "."
-            return summary
-            
-    else:
-        Console.warn("Unable to extract summary for: %s", text)
-    
-    return None
-    

eric ide

mercurial