• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python escape.xhtml_unescape函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tornado.escape.xhtml_unescape函数的典型用法代码示例。如果您正苦于以下问题:Python xhtml_unescape函数的具体用法?Python xhtml_unescape怎么用?Python xhtml_unescape使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xhtml_unescape函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: replace_post

def replace_post(post_data):
    d = {
        "id": 5,
        "title":        "my blog post title",
        "slug":         "my-blog-post-title",
        "markdown":     "the *markdown* formatted post body",
        #"html":         "the <i>html</i> formatted post body",
        "image":        None,
        "featured":     0,
        "page":         0,
        "status":       "published",
        "language":     "zh_CN",
        "meta_title":   None,
        "meta_description": None,
        "author_id":    1,
        "created_at":   cur_timestamp(),
        "created_by":   1,
        "updated_at":   cur_timestamp(),
        "updated_by":   1,
        "published_at": cur_timestamp(),
        "published_by": 1
    }
    d['id'] = int(post_data['source_url'].rsplit('/', 1)[1].split('.')[0])
    d['title'] = post_data['title'].strip()
    d['slug'] = post_data['title'].strip().replace(' ', '-').lower()
    d['markdown'] = xhtml_unescape(post_data['content'].strip())    # unescape
    return d
开发者ID:PegasusWang,项目名称:articles,代码行数:27,代码来源:sharejs_to_ghost.py


示例2: normalize

def normalize(sentence):
    """
    コメントを正規化する
    :param str sentence: 正規化するコメント
    :return: 正規化されたコメント
    :rtype: str
    """

    dst = escape.xhtml_unescape(sentence)

    if _re_escape.findall(dst):
        return ""

    # か゛(u'\u304b\u309b')" -> が(u'\u304b \u3099')
    #  -> が(u'\u304b\u3099') -> が(u'\u304c')
    # dst = unicodedata.normalize("NFKC", "".join(unicodedata.normalize("NFKC", dst).split()))
    dst = dst.lower()
    dst = "".join(dst.split())
    try:
        dst = _convert_marks(dst)
    except:
        print "convertError"
    dst = _re_remove.sub("", dst)
    dst = _delete_cyclic_word(dst)

    return dst
开发者ID:ItoTomoki,项目名称:ruiternews,代码行数:26,代码来源:normalizer.py


示例3: parse_cases

def parse_cases(filename):
  """Parses the fogbugz data in the file.

  Returns a list of (subject, assigned_to, body) tuples.
  """
  results = []

  tree = ElementTree.parse(filename)

  for case in tree.find('cases').findall('case'):
    subject = 'FB%s: %s' % (case.get('ixBug'), case.findtext('sTitle'))
    body = []
    assigned_to = case.findtext('sPersonAssignedTo')
    body.append('Assigned to: %s' % assigned_to)
    body.append('Project: %s' % case.findtext('sProject'))
    body.append('Area: %s' % case.findtext('sArea'))
    body.append('Priority: %s (%s)' % (case.findtext('ixPriority'), case.findtext('sPriority')))
    body.append('Category: %s' % case.findtext('sCategory'))
    body.append('')
    for event in case.find('events').findall('event'):
      body.append( '%s at %s' % (event.findtext('evtDescription'), event.findtext('dt')))
      if event.findtext('s'):
        body.append('')
        body.append(event.findtext('s'))
        body.append('')
      if event.find('rgAttachments') is not None:
        for attachment in event.find('rgAttachments').findall('attachment'):
          body.append('Attachment: %s' % escape.xhtml_unescape(attachment.findtext('sURL')))
    results.append((subject, USER_MAP[assigned_to], '\n'.join(body)))
  return results
开发者ID:00zhengfu00,项目名称:viewfinder,代码行数:30,代码来源:parse_cases.py


示例4: edit_card

    def edit_card(self, message):
        id = message['data']['id']
        text = xhtml_unescape(message['data']['value'].strip())
        clean_data = {'value': text, 'id': id}

        message_out = self.generate_message('editCard', clean_data)
        self.broadcast(message_out)
        room_id = self.rooms.get_room_id(self)
        self.cards.update_text(room_id, card_id=id, text=xhtml_escape(text))
开发者ID:Hironsan,项目名称:Brain_Hacker,代码行数:9,代码来源:room_handler.py


示例5: test_xhtml_escape

    def test_xhtml_escape(self):
        tests = [
            ("<foo>", "&lt;foo&gt;"),
            ("<foo>", "&lt;foo&gt;"),
            (b("<foo>"), b("&lt;foo&gt;")),

            ("<>&\"", "&lt;&gt;&amp;&quot;"),
            ("&amp;", "&amp;amp;"),
            ]
        for unescaped, escaped in tests:
            self.assertEqual(utf8(xhtml_escape(unescaped)), utf8(escaped))
            self.assertEqual(utf8(unescaped), utf8(xhtml_unescape(escaped)))
开发者ID:e1ven,项目名称:Waymoot,代码行数:12,代码来源:escape_test.py


示例6: test_xhtml_unescape_numeric

 def test_xhtml_unescape_numeric(self):
     tests = [
         ('foo&#32;bar', 'foo bar'),
         ('foo&#x20;bar', 'foo bar'),
         ('foo&#X20;bar', 'foo bar'),
         ('foo&#xabc;bar', u'foo\u0abcbar'),
         ('foo&#xyz;bar', 'foo&#xyz;bar'),  # invalid encoding
         ('foo&#;bar', 'foo&#;bar'),        # invalid encoding
         ('foo&#x;bar', 'foo&#x;bar'),      # invalid encoding
     ]
     for escaped, unescaped in tests:
         self.assertEqual(unescaped, xhtml_unescape(escaped))
开发者ID:leeclemens,项目名称:tornado,代码行数:12,代码来源:escape_test.py


示例7: test_xhtml_escape

 def test_xhtml_escape(self):
     tests = [
         ("<foo>", "&lt;foo&gt;"),
         (u"<foo>", u"&lt;foo&gt;"),
         (b"<foo>", b"&lt;foo&gt;"),
         ("<>&\"'", "&lt;&gt;&amp;&quot;&#39;"),
         ("&amp;", "&amp;amp;"),
         (u"<\u00e9>", u"&lt;\u00e9&gt;"),
         (b"<\xc3\xa9>", b"&lt;\xc3\xa9&gt;"),
     ]  # type: List[Tuple[Union[str, bytes], Union[str, bytes]]]
     for unescaped, escaped in tests:
         self.assertEqual(utf8(xhtml_escape(unescaped)), utf8(escaped))
         self.assertEqual(utf8(unescaped), utf8(xhtml_unescape(escaped)))
开发者ID:bdarnell,项目名称:tornado,代码行数:13,代码来源:escape_test.py


示例8: post

 def post(self):
     user = self.current_user
     for x in ('location','twitter','github','css','words'):
         user[x] = xhtml_unescape(self.get_argument(x,''))
         for x in set(html_killer.findall(user[x])):
             user[x] = user[x].replace(x,'')
     website = self.get_argument('website','')
     w = urlparse(website)
     if w[0] and w[1]:
         user['website'] = website
     else:
         user['website'] = ''
     self.db.users.save(user)
     self.redirect('/user/%s' % user['username'] )
开发者ID:henter,项目名称:PBB,代码行数:14,代码来源:auth.py


示例9: _get_articel_info

 def _get_articel_info(self, article_info, nick_name, ori_create_time):
     for k, v in article_info.items():
         if isinstance(v, str):
             article_info[k] = xhtml_unescape(v)
     article_dict = {
         'cdn_url': article_info['cover'].replace('\\', ''),
         'title': article_info['title'],
         'nick_name': nick_name,
         'link': ('http://mp.weixin.qq.com' +
                  article_info['content_url'].replace('\\', '')),
         'ori_create_time': ori_create_time,
         'desc': article_info['digest'],
     }
     return article_dict
开发者ID:PegasusWang,项目名称:wechannel,代码行数:14,代码来源:sg.py


示例10: on_message

 def on_message(self, message_json):
   message = json.loads(message_json)
   if message['type'] == 'start':
     self.game.start_game()
   elif message['type'] == 'update':
     self.game.request_update(self)
   elif message['type'] == 'chat':
     self.game.add_chat(xhtml_unescape(message['name']), message['message'], "chat")
   elif message['type'] == 'pause':
     self.game.pause(message['pause'])
   elif message['type'] == 'submit':
     self.game.submit_tau(self, message['cards'])
   elif message['type'] == 'training_option':
     self.game.set_training_option(message['option'], message['value'])
开发者ID:malcolmsharpe,项目名称:websockettau,代码行数:14,代码来源:tau.py


示例11: test_xhtml_escape

    def test_xhtml_escape(self):
        tests = [
            ("<foo>", "&lt;foo&gt;"),
            (u("<foo>"), u("&lt;foo&gt;")),
            (b"<foo>", b"&lt;foo&gt;"),

            ("<>&\"'", "&lt;&gt;&amp;&quot;&#39;"),
            ("&amp;", "&amp;amp;"),

            (u("<\u00e9>"), u("&lt;\u00e9&gt;")),
            (b"<\xc3\xa9>", b"&lt;\xc3\xa9&gt;"),
        ]
        for unescaped, escaped in tests:
            self.assertEqual(utf8(xhtml_escape(unescaped)), utf8(escaped))
            self.assertEqual(utf8(unescaped), utf8(xhtml_unescape(escaped)))
开发者ID:YoungLeeNENU,项目名称:tornado,代码行数:15,代码来源:escape_test.py


示例12: fun_article_new_src

def fun_article_new_src(user, article_id='-1', article_type='blog', src_type='code',
            title='', body='', source='', code_type='python', math_type='inline', father_id='-1', group_id='-1'):
    if article_type not in Article_Type:
        return [1, '不支持当前文章类型!']
    if src_type not in Agree_Src:
        return [1, '不支持当前类型的资源!']
        
    if title is None:
        return [1, '名称不能为空!']
        
    if body is None:
        if src_type != 'reference':
            return [1, '内容不能为空!']
        else:
            if re.search(r'^(http|https|ftp):\/\/.+$', source) is None:
                return [1, '请填写链接地址或者引用真实内容!']
            body = ''
    else:
        if src_type == 'math':    
            body = math_encode(escape.xhtml_unescape(body))
        elif src_type == 'code':
            if code_type not in Agree_Code:
                return [1, '请选择代码种类!']
    
    if article_type == "about":
        AF_Object = user.about
        article_id = str(user.about._id)
        isnew = False
    elif article_type == "book-about":
        isnew = False
        try:
            book = Catalog(_id=group_id)
            AF_Object = book.about
            limit = book.authority_verify(user)
            if test_auth(limit, A_WRITE) is False:
                return [1, '您无权修改摘要!']
        except Exception, err:
            logging.error(traceback.format_exc())
            logging.error('Catalog not exist, id %s' % group_id)
            return [1, '未找到知识谱!']
开发者ID:deju,项目名称:afw_old,代码行数:40,代码来源:AF_EditTool.py


示例13: clean_url

def clean_url(url):
    """
    Returns an cleaned url starting with a scheme and folder with trailing /
    or an empty string
    """

    if url and url.strip():
        url = xhtml_unescape(url.strip())

        if '://' not in url:
            url = '//' + url

        scheme, netloc, path, query, fragment = parse.urlsplit(url, 'http')
        if not path:
            path += '/'

        cleaned_url = parse.urlunsplit((scheme, netloc, path, query, fragment))

    else:
        cleaned_url = ''

    return cleaned_url
开发者ID:ArthurGarnier,项目名称:SickRage,代码行数:22,代码来源:config.py


示例14: convert_text_html

def convert_text_html(message):
    """Linkify URLs and turn newlines into <br/> for HTML"""
    html = xhtml_unescape(tornado_linkify(message))
    return html.replace('\n', '<br/>')
开发者ID:anupriyatripathi,项目名称:qiita,代码行数:4,代码来源:util.py


示例15: make_mobi

    def make_mobi(user, feeds, data_dir, kindle_format='book',
                  mobi_templates=None, **other_services):
        """docstring for make_mobi"""
        is_updated = False
        for feed in feeds:
            if len(feed.items) > 0:
                is_updated = True
        if not is_updated:
            logging.info("no feed update.")
            return None

        if kindle_format not in ['book', 'periodical']:
            kindle_format = 'book'
        logging.info("generate .mobi file start... ")

        if not mobi_templates:
            from kindletemplate import TEMPLATES
            mobi_templates = TEMPLATES
        for tpl in mobi_templates:
            if tpl is 'book.html':
                continue

            t = template.Template(mobi_templates[tpl])
            content = t.generate(
                user=user,
                feeds=feeds,
                uuid=uuid.uuid1(),
                format=kindle_format,
                **other_services
            )

            fp = open(os.path.join(data_dir, tpl), 'wb')
            content = content.decode('utf-8', 'ignore').encode('utf-8')
            fp.write(escape.xhtml_unescape(content))
            # fp.write(content)
            fp.close()

        pre_mobi_file = "TheOldReader_%s" % time.strftime('%m-%dT%Hh%Mm')
        opf_file = os.path.join(data_dir, "content.opf")
        os.environ["PATH"] = os.environ["PATH"] + ":./"
        subprocess.call('%s %s -o "%s" > log.txt' %
                        (Kindle.kindle_gen_prog, opf_file, pre_mobi_file),
                        shell=True)
        pre_mobi_file = os.path.join(data_dir, pre_mobi_file)
        mobi_file = pre_mobi_file+".mobi"
        status = subprocess.call(
            'kindlestrip.py "%s" "%s" >> log.txt' %
            (pre_mobi_file, mobi_file), shell=True)

        if 0 != status:
            import shutil
            shutil.move(pre_mobi_file, mobi_file)

        if os.path.isfile(mobi_file) is False:
            logging.error("failed!")
            return None
        else:
            fsize = os.path.getsize(mobi_file)
            logging.info(".mobi save as: %s(%.2fMB)" %
                         (mobi_file, float(fsize)/(1024*1024)))
            return mobi_file
开发者ID:fireinice,项目名称:kindlereader2,代码行数:61,代码来源:Reader.py


示例16: getBasicInfo


#.........这里部分代码省略.........
         self.info['brand'] = re.findall(REGX_B['brand'], self.content)
         for (k, v) in self.info.items():
             if v:
                 if len(v) > 0:
                     self.info[k] = v[0]
                     self.info[k] = self.info[k].decode(self.res.encoding,
                                                        'ignore').encode('utf-8')
                     if k == 'attrList':
                         for t in re.findall(r'\<\!\-\-.+?\-\-\>',
                                             self.info[k]) + re.findall(r'\s+',
                                                                        self.info[k]):
                             self.info[k] = self.info[k].replace(t, ' ')
                 else:
                     self.info[k] = None
             else:
                 self.info[k] = None
         if not self.info['itemTitle']:
             itemTitle = re.findall(r'title"\s*:\s*"(.+?)"', self.content)
             if itemTitle:
                 self.info['itemTitle'] = itemTitle[0].decode(
                     self.res.encoding, 'ignore').encode('utf-8')
         if not self.info['initPrice'] or self.info['initPrice'] == '0':
             price = re.findall(r'"price"\s*:\s*"(\d+)"', self.content)
             if price:
                 self.info['initPrice'] = '%s.%s' % (
                     price[0][:-2], price[0][-2:])
         if not self.info['initPrice'] or self.info['initPrice'] == '0':
             price = re.search(
                 r'defaultItemPrice\'\s*\:\s*\'(\d+\.*\d*).+?\'', self.content, re.S)
             if price:
                 self.info['initPrice'] = price.group(1)
         if not self.info['itemImg']:
             img = re.search(r'url\((\S+?item_pic\.jpg\S+?)\)', self.content, re.S) or re.search(
                 r'J_UlThumb.+?url\((.+?)\)', self.content, re.S)
             if img:
                 self.info['itemImg'] = img.group(1)
         if not self.info['cid']:
             cid = re.search(
                 r'\'categoryId\'\s*\:\s*\'(\d+)\'', self.content, re.S)
             if cid:
                 self.info['cid'] = cid.group(1)
         if not self.info['spuId']:
             spuId = re.search(
                 r'\'spuId\'\s*\:\s*\'(\d+)\'', self.content, re.S)
             self.info['spuId'] = spuId.group(1) if spuId else None
     else:
         self.info['charset'] = re.findall(REGX_B['charset'], self.content)
         self.info['keywords'] = re.findall(
             REGX_B['keywords'], self.content)
         self.info['desc'] = re.findall(REGX_B['desc'], self.content)
         self.info['itemId'] = re.findall(REGX_B['itemId'], self.content)
         self.info['pageId'] = re.findall(REGX_B['pageId'], self.content)
         self.info['shopId'] = re.findall(REGX_B['shopId'], self.content)
         self.info['userId'] = re.findall(REGX_B['userId'], self.content)
         self.info['shopName'] = re.findall(REGX_C['shopName'],
                                            self.content, re.S)
         self.info['shopUrl'] = re.findall(REGX_C['shopUrl'], self.content,
                                           re.S)
         self.info['itemImg'] = re.findall(REGX_B['itemImg'], self.content,
                                           re.S)
         self.info['itemTitle'] = re.findall(REGX_C['itemTitle'],
                                             self.content, re.S)
         self.info['initPrice'] = re.findall(REGX_C['initPrice'],
                                             self.content, re.S)
         self.info[r'totalSoldOut'] = re.findall(REGX_C[r'totalSoldOut'],
                                                 self.content)
         self.info['attrList'] = re.findall(REGX_C['attrList'],
                                            self.content, re.S)
         self.info['starts'] = re.findall(REGX_B['starts'], self.content,
                                          re.S)
         self.info['ends'] = re.findall(REGX_B['ends'], self.content, re.S)
         self.info['userTag'] = re.findall(REGX_B['userTag'], self.content,
                                           re.S)
         self.info[r'cid'] = re.findall(REGX_C[r'cid'], self.content, re.S)
         self.info['location'] = re.findall(
             REGX_C['location'], self.content)
         for (k, v) in self.info.items():
             if v:
                 if len(v) > 0:
                     self.info[k] = v[0]
                     self.info[k] = self.info[k].decode(self.res.encoding,
                                                        'ignore').encode('utf-8')
                     if k == 'attrList':
                         for t in re.findall(
                             r'\<\!\-\-.+?\-\-\>',
                             self.info[k]) + re.findall(
                                 r'\s+', self.info[k]):
                             self.info[k] = self.info[k].replace(t, ' ')
                 else:
                     self.info[k] = None
             else:
                 self.info[k] = None
         if self.info['location']:
             self.info['location'] = unquote(
                 self.info['location']
             ).decode(self.res.encoding, 'ignore').encode('utf-8')
     self.info['attrList'] = (xhtml_unescape(
         self.info['attrList']).encode('utf-8')
         if self.info['attrList'] else None)
     return self.info
开发者ID:ruige123456,项目名称:dataMining,代码行数:101,代码来源:topitem.py


示例17: output_message

 def output_message(self, message, message_hash):
     self.set_header("Content-Type", "text/plain")
     self.write(xhtml_unescape(message).replace("<br/>", "\n"))
开发者ID:Ociidii-Works,项目名称:commitment,代码行数:3,代码来源:commit.py


示例18: getBasicInfo


#.........这里部分代码省略.........
             spuId = re.search(
                 r'\'spuId\'\s*\:\s*\'(\d+)\'', self.content, re.S)
             self.info['spuId'] = spuId.group(1) if spuId else None
         shopGoodRate = [float(t.text)
                         for t in pq_obj.find('em.count') if t]
         if shopGoodRate:
             self.info['shopGoodRate'] = '%.1f' % (
                 sum(shopGoodRate) / len(shopGoodRate))
     else:
         self.info['charset'] = re.findall(REGX_B['charset'], self.content)
         self.info['keywords'] = re.findall(
             REGX_B['keywords'], self.content)
         self.info['desc'] = re.findall(REGX_B['desc'], self.content)
         self.info['itemId'] = re.findall(REGX_B['itemId'], self.content)
         self.info['pageId'] = re.findall(REGX_B['pageId'], self.content)
         self.info['shopId'] = re.findall(REGX_B['shopId'], self.content)
         self.info['userId'] = re.findall(REGX_B['userId'], self.content)
         self.info['shopName'] = re.findall(REGX_C['shopName'],
                                            self.content, re.S)
         self.info['shopUrl'] = re.findall(REGX_C['shopUrl'], self.content,
                                           re.S)
         self.info['itemImg'] = re.findall(REGX_B['itemImg'], self.content,
                                           re.S)
         self.info['itemTitle'] = re.findall(REGX_C['itemTitle'],
                                             self.content, re.S)
         self.info['initPrice'] = re.findall(REGX_C['initPrice'],
                                             self.content, re.S)
         self.info[r'totalSoldOut'] = re.findall(REGX_C[r'totalSoldOut'],
                                                 self.content)
         self.info['attrList'] = re.findall(REGX_C['attrList'],
                                            self.content, re.S)
         self.info['starts'] = re.findall(REGX_B['starts'], self.content,
                                          re.S)
         self.info['ends'] = re.findall(REGX_B['ends'], self.content, re.S)
         self.info['userTag'] = re.findall(REGX_B['userTag'], self.content,
                                           re.S)
         self.info[r'cid'] = re.findall(REGX_C[r'cid'], self.content, re.S)
         self.info['location'] = re.findall(
             REGX_C['location'], self.content)
         self.info['gradeAvg'] = [
             float(row)
             for row in re.findall(
                 r'\<em\sclass="count".+?\>(\d+\.*\d*)\<\/em\>', self.content, re.S)
         ]
         self.info['gradeAvg'] = [sum(
             self.info['gradeAvg']) / len(self.info['gradeAvg'])] if self.info['gradeAvg'] else None
         shopRank = pq_obj.find('a#shop-rank img')
         self.info['shopRank'] = re.sub(
             r'.+?(s\_\w+\_\d)\.gif', r'\1', shopRank.attr['src']) if shopRank else None
         self.info['shopGoodRate'] = pq_obj.find(
             'em#J_PositiveRating').text()
         for (k, v) in self.info.items():
             if v:
                 if isinstance(v, list) and len(v) > 0:
                     self.info[k] = v[0]
                     self.info[k] = self.info[k].decode(
                         self.res.encoding, 'ignore'
                     ).encode('utf-8') \
                         if isinstance(self.info[k], (str, unicode))\
                         else self.info[k]
                     if k == 'attrList':
                         for t in re.findall(
                             r'\<\!\-\-.+?\-\-\>',
                             self.info[k]) + re.findall(
                                 r'\s+', self.info[k]):
                             self.info[k] = self.info[k].replace(t, ' ')
                 elif isinstance(v, list) and len(v) == 0:
                     self.info[k] = None
             else:
                 self.info[k] = None
         if self.info['location']:
             self.info['location'] = unquote(
                 self.info['location']
             ).decode(self.res.encoding, 'ignore').encode('utf-8')
         if not self.info['itemImg']:
             img = re.search(
                 r'id="J_ImgBooth" data-src="(.+?)"', self.content, re.S)
             if img:
                 self.info['itemImg'] = img.group(1)
         self.info['shopName'] = eval(
             "'%s'" % (self.info['shopName'] or '').replace('%', '\\x'))
         created = re.search(r'dbst\s*:\s*(\d+)', self.content, re.S)
         self.info['created'] = created.group(1) if created else None
     self.info['attrList'] = (xhtml_unescape(
         self.info['attrList']).encode('utf-8')
         if self.info['attrList'] else None)
     self.info['attrList'] = re.sub(
         r'\s+', r' ', self.info['attrList'] or '')
     self.info['attrs'] = re.findall(
         r'<li.+?>(.+?)[::]\s*(.*?)</li>'.decode('utf-8'),
         (self.info['attrList'] or '').decode('utf-8'),
         re.S)
     self.info['attrs'] = [[t[0].strip().encode('utf-8'), t[1].strip('\t\r ').encode('utf-8')]
                           for t in self.info['attrs']]
     self.info['offSale'] = True \
         if self.content.decode(self.res.encoding).encode('utf-8').find('已下架') > -1 \
         else False
     self.info['location'] = self.info['location'] or None
     self.deal_taobao_meal_basic()
     return self.info
开发者ID:ruige123456,项目名称:dataMining,代码行数:101,代码来源:topitem.py


示例19: render

 def render(self, text, hl, **kwargs):
     for wd in hl:
         text = re.sub(r'\b({})\b'.format(wd),
                       '<span style="color:red">{}</span>'.format(wd), text)
     return escape.xhtml_unescape(escape.linkify(text, **kwargs))
开发者ID:hendrydong,项目名称:StackOverFlow_Analysis_PySpark,代码行数:5,代码来源:ui.py


示例20: xhtml_unescape

from article.blog import Blog
from article.about import About
from article.comment import Comment
from article.reference import Reference
from article.tableform import Tableform
from article.langcode import Langcode

from tornado.escape import xhtml_unescape

blogs_all = [Blog(each) for each in Blog.datatype.find()]
comments_all = [Comment(each) for each in Comment.datatype.find()]
about_all = About.find()
ref_all = Reference.find()
table_all = Tableform.find()
code_all = Langcode.find()


for each in blogs_all + comments_all + about_all:
    each.abstract = xhtml_unescape(each.abstract)
    each.body = xhtml_unescape(each.body)

for each in ref_all:
    each.body = xhtml_unescape(each.body)

for each in code_all:
    each.code = xhtml_unescape(each.code)

for each in table_all:
    each.tableform = xhtml_unescape(each.tableform)
开发者ID:Earthson,项目名称:afewords_base,代码行数:29,代码来源:unescape_body.py



注:本文中的tornado.escape.xhtml_unescape函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gen.convert_yielded函数代码示例发布时间:2022-05-27
下一篇:
Python escape.xhtml_escape函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap