瀏覽代碼

python3 supports unicode from __str__

the wikicode can be converted to unicode via "__unicode__" but
python3 support unicode through "__str__". This commimt allows
python3 code to convert a wikicode into a unicode via str([wikicode])
pull/259/head
digi-ark 4 年之前
父節點
當前提交
78e7e5230b
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 3FF1A33F0DE02DE2
共有 1 個檔案被更改,包括 3 行新增0 行删除
  1. +3
    -0
      mwparserfromhell/wikicode.py

+ 3
- 0
mwparserfromhell/wikicode.py 查看文件

@@ -51,6 +51,9 @@ class Wikicode(StringMixIn):
def __unicode__(self):
return "".join([str(node) for node in self.nodes])

def __str__(self):
return self.__unicode__()

@staticmethod
def _get_children(node, contexts=False, restrict=None, parent=None):
"""Iterate over all child :class:`.Node`\\ s of a given *node*."""


Loading…
取消
儲存