本文整理汇总了Python中pywikibot.replaceExcept函数的典型用法代码示例。如果您正苦于以下问题:Python replaceExcept函数的具体用法?Python replaceExcept怎么用?Python replaceExcept使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replaceExcept函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: fixSyntaxSave
def fixSyntaxSave(self, text):
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
'startspace']
# link to the wiki working on
## TODO: disable this for difflinks and titled links
## http://de.wikipedia.org/w/index.php?title=Wikipedia%3aVandalismusmeldung&diff=103109563&oldid=103109271
## text = pywikibot.replaceExcept(text,
## r'\[https?://%s\.%s\.org/wiki/(?P<link>\S+)\s+(?P<title>.+?)\s?\]'
## % (self.site.lang, self.site.family.name),
## r'[[\g<link>|\g<title>]]', exceptions)
# external link in double brackets
text = pywikibot.replaceExcept(text,
r'\[\[(?P<url>https?://[^\]]+?)\]\]',
r'[\g<url>]', exceptions)
# external link starting with double bracket
text = pywikibot.replaceExcept(text,
r'\[\[(?P<url>https?://.+?)\]',
r'[\g<url>]', exceptions)
# external link and description separated by a dash, with
# whitespace in front of the dash, so that it is clear that
# the dash is not a legitimate part of the URL.
text = pywikibot.replaceExcept(text,
r'\[(?P<url>https?://[^\|\] \r\n]+?) +\| *(?P<label>[^\|\]]+?)\]',
r'[\g<url> \g<label>]', exceptions)
# dash in external link, where the correct end of the URL can
# be detected from the file extension. It is very unlikely that
# this will cause mistakes.
text = pywikibot.replaceExcept(text,
r'\[(?P<url>https?://[^\|\] ]+?(\.pdf|\.html|\.htm|\.php|\.asp|\.aspx|\.jsp)) *\| *(?P<label>[^\|\]]+?)\]',
r'[\g<url> \g<label>]', exceptions)
return text
开发者ID:edgarskos,项目名称:pywikipedia-rewrite,代码行数:31,代码来源:cosmetic_changes.py
示例2: removeUselessSpaces
def removeUselessSpaces(self, text):
multipleSpacesR = re.compile(' +')
spaceAtLineEndR = re.compile(' $')
exceptions = ['comment', 'math', 'nowiki', 'pre', 'startspace', 'table',
'template']
text = pywikibot.replaceExcept(text, multipleSpacesR, ' ', exceptions)
text = pywikibot.replaceExcept(text, spaceAtLineEndR, '', exceptions)
return text
开发者ID:octobertech,项目名称:pywikibot-core,代码行数:8,代码来源:cosmetic_changes.py
示例3: commonsfiledesc
def commonsfiledesc(self, text):
# section headers to {{int:}} versions
exceptions = ["comment", "includeonly", "math", "noinclude", "nowiki", "pre", "source", "ref", "timeline"]
text = pywikibot.replaceExcept(
text, r"([\r\n]|^)\=\= *Summary *\=\=", r"\1== {{int:filedesc}} ==", exceptions, True
)
text = pywikibot.replaceExcept(
text,
r"([\r\n])\=\= *\[\[Commons:Copyright tags\|Licensing\]\]: *\=\=",
r"\1== {{int:license}} ==",
exceptions,
True,
)
text = pywikibot.replaceExcept(
text,
r"([\r\n])\=\= *(Licensing|License information|{{int:license-header}}) *\=\=",
r"\1== {{int:license}} ==",
exceptions,
True,
)
# frequent field values to {{int:}} versions
text = pywikibot.replaceExcept(
text,
r"([\r\n]\|[Ss]ource *\= *)(?:[Oo]wn work by uploader|[Oo]wn work|[Ee]igene [Aa]rbeit) *([\r\n])",
r"\1{{own}}\2",
exceptions,
True,
)
text = pywikibot.replaceExcept(
text, r"(\| *Permission *\=) *(?:[Ss]ee below|[Ss]iehe unten) *([\r\n])", r"\1\2", exceptions, True
)
# added to transwikied pages
text = pywikibot.replaceExcept(text, r"__NOTOC__", "", exceptions, True)
# tracker element for js upload form
text = pywikibot.replaceExcept(text, r"<!-- *{{ImageUpload\|(?:full|basic)}} *-->", "", exceptions[1:], True)
text = pywikibot.replaceExcept(text, r"{{ImageUpload\|(?:basic|full)}}", "", exceptions, True)
# duplicated section headers
text = pywikibot.replaceExcept(
text,
r"([\r\n]|^)\=\= *{{int:filedesc}} *\=\=(?:[\r\n ]*)\=\= *{{int:filedesc}} *\=\=",
r"\1== {{int:filedesc}} ==",
exceptions,
True,
)
text = pywikibot.replaceExcept(
text,
r"([\r\n]|^)\=\= *{{int:license}} *\=\=(?:[\r\n ]*)\=\= *{{int:license}} *\=\=",
r"\1== {{int:license}} ==",
exceptions,
True,
)
return text
开发者ID:reza1615,项目名称:pywikipedia-rewrite,代码行数:56,代码来源:cosmetic_changes.py
示例4: fixArabicLetters
def fixArabicLetters(self, text):
if self.site.lang=='ckb' or self.site.lang=='fa':
exceptions = [
'gallery',
'hyperlink',
'interwiki',
# but changes letters inside wikilinks
#'link',
'math',
'pre',
'template',
'timeline',
'ref',
'source',
'startspace',
'inputbox',
]
# do not change inside file links
namespaces = list(self.site.namespace(6, all = True))
pattern = re.compile(u'\[\[(' + '|'.join(namespaces) + '):.+?\..+?\]\]',
re.UNICODE)
exceptions.append(pattern)
text = pywikibot.replaceExcept(text, u',', u'،', exceptions)
if self.site.lang=='ckb':
text = pywikibot.replaceExcept(text,
ur'ه([.،_<\]\s])',
ur'ە\1', exceptions)
text = pywikibot.replaceExcept(text, u'ه', u'ە', exceptions)
text = pywikibot.replaceExcept(text, u'ه', u'ھ', exceptions)
text = pywikibot.replaceExcept(text, u'ك', u'ک', exceptions)
text = pywikibot.replaceExcept(text, ur'[ىي]', u'ی', exceptions)
# replace persian digits
for i in range(0,10):
if self.site.lang=='ckb':
text = pywikibot.replaceExcept(text,
u'۰۱۲۳۴۵۶۷۸۹'[i],
u'٠١٢٣٤٥٦٧٨٩'[i], exceptions)
else:
text = pywikibot.replaceExcept(text,
u'٠١٢٣٤٥٦٧٨٩'[i],
u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions)
# do not change digits in class, style and table params
pattern = re.compile(u'=".*?"', re.UNICODE)
exceptions.append(pattern)
# do not change digits inside html-tags
pattern = re.compile(u'<[/]*?[^</]+?[/]*?>', re.UNICODE)
exceptions.append(pattern)
exceptions.append('table') #exclude tables for now
for i in range(0,10):
if self.site.lang=='ckb':
text = pywikibot.replaceExcept(text, str(i),
u'٠١٢٣٤٥٦٧٨٩'[i], exceptions)
else:
text = pywikibot.replaceExcept(text, str(i),
u'۰۱۲۳۴۵۶۷۸۹'[i], exceptions)
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:56,代码来源:cosmetic_changes.py
示例5: fixReferences
def fixReferences(self, text):
# http://en.wikipedia.org/wiki/User:AnomieBOT/source/tasks/OrphanReferenceFixer.pm
exceptions = ["nowiki", "comment", "math", "pre", "source", "startspace"]
# it should be name = " or name=" NOT name ="
text = re.sub(r'(?i)<ref +name(= *| *=)"', r'<ref name="', text)
# remove empty <ref/>-tag
text = pywikibot.replaceExcept(text, r"(?i)(<ref\s*/>|<ref *>\s*</ref>)", r"", exceptions)
text = pywikibot.replaceExcept(text, r"(?i)<ref\s+([^>]+?)\s*>\s*</ref>", r"<ref \1/>", exceptions)
return text
开发者ID:reza1615,项目名称:pywikipedia-rewrite,代码行数:10,代码来源:cosmetic_changes.py
示例6: removeUselessSpaces
def removeUselessSpaces(self, text):
result = []
multipleSpacesR = re.compile(" +")
spaceAtLineEndR = re.compile(" $")
exceptions = ["comment", "math", "nowiki", "pre", "startspace", "table", "template"]
text = pywikibot.replaceExcept(text, multipleSpacesR, " ", exceptions)
text = pywikibot.replaceExcept(text, spaceAtLineEndR, "", exceptions)
return text
开发者ID:reza1615,项目名称:pywikipedia-rewrite,代码行数:10,代码来源:cosmetic_changes.py
示例7: fixTypo
def fixTypo(self, text):
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source', 'startspace', 'gallery', 'hyperlink', 'interwiki', 'link']
# change <number> ccm -> <number> cm³
text = pywikibot.replaceExcept(text, ur'(\d)\s* ccm', ur'\1 cm³', exceptions)
text = pywikibot.replaceExcept(text, ur'(\d)\s*ccm', ur'\1 cm³', exceptions)
# Solve wrong Nº sign with °C or °F
# additional exception requested on fr-wiki for this stuff
pattern = re.compile(u'«.*?»', re.UNICODE)
exceptions.append(pattern)
text = pywikibot.replaceExcept(text, ur'(\d)\s* [º°]([CF])', ur'\1 °\2', exceptions)
text = pywikibot.replaceExcept(text, ur'(\d)\s*[º°]([CF])', ur'\1 °\2', exceptions)
text = pywikibot.replaceExcept(text, ur'º([CF])', ur'°\1', exceptions)
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:13,代码来源:cosmetic_changes.py
示例8: fixArabicLetters
def fixArabicLetters(self, text):
exceptions = [
'gallery',
'hyperlink',
'interwiki',
# but changes letters inside wikilinks
#'link',
'math',
'pre',
'template',
'timeline',
'ref',
'source',
'startspace',
'inputbox',
]
# valid digits
digits = {
'ckb': u'٠١٢٣٤٥٦٧٨٩',
'fa': u'۰۱۲۳۴۵۶۷۸۹',
}
faChrs = u'ءاآأإئؤبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیةيك' + digits['fa']
new = digits.pop(self.site.lang)
# This only works if there are only two items in digits dict
old = digits[digits.keys()[0]]
# do not change inside file links
namespaces = list(self.site.namespace(6, all=True))
pattern = re.compile(
u'\[\[(' + '|'.join(namespaces) +
'):.+?\.\w+? *(\|((\[\[.*?\]\])|.)*)?\]\]',
re.UNICODE)
#not to let bot edits in latin content
exceptions.append(re.compile(u"[^%(fa)s] *?\"*? *?, *?[^%(fa)s]"
% {'fa': faChrs}))
exceptions.append(pattern)
text = pywikibot.replaceExcept(text, u',', u'،', exceptions)
if self.site.lang == 'ckb':
text = pywikibot.replaceExcept(text,
u'\u0647([.\u060c_<\\]\\s])',
u'\u06d5\\1', exceptions)
text = pywikibot.replaceExcept(text, u'ه', u'ە', exceptions)
text = pywikibot.replaceExcept(text, u'ه', u'ھ', exceptions)
text = pywikibot.replaceExcept(text, u'ك', u'ک', exceptions)
text = pywikibot.replaceExcept(text, u'[ىي]', u'ی', exceptions)
return text
# replace persian/arabic digits
## deactivated due to bug #3539407
for i in range(0, 10):
text = pywikibot.replaceExcept(text, old[i], new[i], exceptions)
# do not change digits in class, style and table params
pattern = re.compile(u'\w+=(".+?"|\d+)', re.UNICODE)
exceptions.append(pattern)
# do not change digits inside html-tags
pattern = re.compile(u'<[/]*?[^</]+?[/]*?>', re.UNICODE)
exceptions.append(pattern)
exceptions.append('table') # exclude tables for now
# replace digits
for i in range(0, 10):
text = pywikibot.replaceExcept(text, str(i), new[i], exceptions)
return text
开发者ID:octobertech,项目名称:pywikibot-core,代码行数:60,代码来源:cosmetic_changes.py
示例9: fixReferences
def fixReferences(self, text):
#https://en.wikipedia.org/wiki/User:AnomieBOT/source/tasks/OrphanReferenceFixer.pm
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
'startspace']
# it should be name = " or name=" NOT name ="
text = re.sub(r'(?i)<ref +name(= *| *=)"', r'<ref name="', text)
#remove empty <ref/>-tag
text = pywikibot.replaceExcept(text,
r'(?i)(<ref\s*/>|<ref *>\s*</ref>)',
r'', exceptions)
text = pywikibot.replaceExcept(text,
r'(?i)<ref\s+([^>]+?)\s*>\s*</ref>',
r'<ref \1/>', exceptions)
return text
开发者ID:APerson241,项目名称:pywikibot-core,代码行数:15,代码来源:cosmetic_changes.py
示例10: fixSyntaxSave
def fixSyntaxSave(self, text):
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source', 'startspace']
# external link in double brackets
text = pywikibot.replaceExcept(text, r'\[\[(?P<url>https?://[^\]]+?)\]\]', r'[\g<url>]', exceptions)
# external link starting with double bracket
text = pywikibot.replaceExcept(text, r'\[\[(?P<url>https?://.+?)\]', r'[\g<url>]', exceptions)
# external link and description separated by a dash, with
# whitespace in front of the dash, so that it is clear that
# the dash is not a legitimate part of the URL.
text = pywikibot.replaceExcept(text, r'\[(?P<url>https?://[^\|\] \r\n]+?) +\| *(?P<label>[^\|\]]+?)\]', r'[\g<url> \g<label>]', exceptions)
# dash in external link, where the correct end of the URL can
# be detected from the file extension. It is very unlikely that
# this will cause mistakes.
text = pywikibot.replaceExcept(text, r'\[(?P<url>https?://[^\|\] ]+?(\.pdf|\.html|\.htm|\.php|\.asp|\.aspx|\.jsp)) *\| *(?P<label>[^\|\]]+?)\]', r'[\g<url> \g<label>]', exceptions)
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:15,代码来源:cosmetic_changes.py
示例11: commonsfiledesc
def commonsfiledesc(self, text):
# section headers to {{int:}} versions
exceptions = ['comment', 'includeonly', 'math', 'noinclude', 'nowiki',
'pre', 'source', 'ref', 'timeline']
text = pywikibot.replaceExcept(text,
r"([\r\n]|^)\=\= *Summary *\=\=",
r"\1== {{int:filedesc}} ==",
exceptions, True)
text = pywikibot.replaceExcept(
text,
r"([\r\n])\=\= *\[\[Commons:Copyright tags\|Licensing\]\]: *\=\=",
r"\1== {{int:license}} ==", exceptions, True)
text = pywikibot.replaceExcept(
text,
r"([\r\n])\=\= *(Licensing|License information|{{int:license-header}}) *\=\=",
r"\1== {{int:license}} ==", exceptions, True)
# frequent field values to {{int:}} versions
text = pywikibot.replaceExcept(
text,
r'([\r\n]\|[Ss]ource *\= *)(?:[Oo]wn work by uploader|[Oo]wn work|[Ee]igene [Aa]rbeit) *([\r\n])',
r'\1{{own}}\2', exceptions, True)
text = pywikibot.replaceExcept(
text,
r'(\| *Permission *\=) *(?:[Ss]ee below|[Ss]iehe unten) *([\r\n])',
r'\1\2', exceptions, True)
# added to transwikied pages
text = pywikibot.replaceExcept(text, r'__NOTOC__', '', exceptions, True)
# tracker element for js upload form
text = pywikibot.replaceExcept(
text,
r'<!-- *{{ImageUpload\|(?:full|basic)}} *-->',
'', exceptions[1:], True)
text = pywikibot.replaceExcept(text, r'{{ImageUpload\|(?:basic|full)}}',
'', exceptions, True)
# duplicated section headers
text = pywikibot.replaceExcept(
text,
r'([\r\n]|^)\=\= *{{int:filedesc}} *\=\=(?:[\r\n ]*)\=\= *{{int:filedesc}} *\=\=',
r'\1== {{int:filedesc}} ==', exceptions, True)
text = pywikibot.replaceExcept(
text,
r'([\r\n]|^)\=\= *{{int:license}} *\=\=(?:[\r\n ]*)\=\= *{{int:license}} *\=\=',
r'\1== {{int:license}} ==', exceptions, True)
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:48,代码来源:cosmetic_changes.py
示例12: translateMagicWords
def translateMagicWords(self, text):
"""
Makes sure that localized namespace names are used.
"""
# not wanted at ru
# arz uses english stylish codes
if self.site.lang not in ["arz", "ru"]:
exceptions = ["nowiki", "comment", "math", "pre"]
for magicWord in [
"img_thumbnail",
"img_left",
"img_center",
"img_right",
"img_none",
"img_framed",
"img_frameless",
"img_border",
"img_upright",
]:
aliases = self.site.getmagicwords(magicWord)
if not aliases:
continue
text = pywikibot.replaceExcept(
text,
r"\[\[(?P<left>.+?:.+?\..+?\|) *(" + "|".join(aliases) + ") *(?P<right>(\|.*?)?\]\])",
r"[[\g<left>" + aliases[0] + "\g<right>",
exceptions,
)
return text
开发者ID:reza1615,项目名称:pywikipedia-rewrite,代码行数:29,代码来源:cosmetic_changes.py
示例13: majUneSeuleListe
def majUneSeuleListe(self, listePages, titrePageRandomArticles):
pageAsLinkBoolean = True
if titrePageRandomArticles in blackList:
pageAsLinkBoolean = False
exceptions = []
texteARajouter = u""
x = 0
# Création d'un texte contenant la liste des pages
for page in listePages:
x = x + 1
texteARajouter = texteARajouter + u"\n|" + str(x) + u"=" + page.title(asLink=pageAsLinkBoolean)
nbPages = x
pageRandomArticles = pywikibot.Page(self.site, titrePageRandomArticles)
text = pageRandomArticles.get()
pywikibot.output(u"\n> \03{lightblue}Traitement de %s\03{default} <" % pageRandomArticles.title())
text = self.suppressionAncienneListe(text)
old = re.compile(u"\{\{#switch:\{\{rand\|(1\||2=)[0-9]*\}\}")
new = (u"{{#switch:{{rand|1|%i}}%s" % (nbPages, texteARajouter))
text = pywikibot.replaceExcept(text, old, new, exceptions)
if not self.save(text, pageRandomArticles, self.summary):
pywikibot.output(u'Aucun changement nécessaire')
开发者ID:Toto-Azero,项目名称:Wikipedia,代码行数:30,代码来源:random_pages_portails.py
示例14: markActiveTables
def markActiveTables(self, text):
"""
Mark all table start and end tags that are not disabled by nowiki tags, comments etc.
We will then later only work on these marked tags.
"""
tableStartTagR = re.compile("<table", re.IGNORECASE)
tableEndTagR = re.compile("</table>", re.IGNORECASE)
text = pywikibot.replaceExcept(text, tableStartTagR, "<##table##",
exceptions=['comment', 'math',
'nowiki', 'pre', 'source'])
text = pywikibot.replaceExcept(text, tableEndTagR, "</##table##>",
exceptions=['comment', 'math',
'nowiki', 'pre', 'source'])
return text
开发者ID:hasteur,项目名称:g13bot_tools_new,代码行数:16,代码来源:table2wiki.py
示例15: suppressionAncienneListe
def suppressionAncienneListe(self, text, nombreCrochets=2):
exceptions = []
#old = re.compile(u"(\n\|[0-9]{1,} *= *[\[\{]{2}.*[\]\}]{2}|\n[0-9]{1,} *= *[\[\{]{2}.*[\]\}]{2}\|)")
old = re.compile(u"(\n\|[0-9]{1,} *= *[\[\{]{0,2}.*[\]\}]{0,2}|\n[0-9]{1,} *= *[\[\{]{0,2}.*[\]\}]{0,2}\|)")
new = u""
text = pywikibot.replaceExcept(text, old, new, exceptions)
return text
开发者ID:Toto-Azero,项目名称:Wikipedia,代码行数:7,代码来源:random_pages_portails.py
示例16: translateAndCapitalizeNamespaces
def translateAndCapitalizeNamespaces(self, text):
"""
Makes sure that localized namespace names are used.
"""
# arz uses english stylish codes
if self.site.sitename() == 'wikipedia:arz':
return text
family = self.site.family
# wiki links aren't parsed here.
exceptions = ['nowiki', 'comment', 'math', 'pre']
for nsNumber in family.namespaces:
if not family.isDefinedNSLanguage(nsNumber, self.site.lang):
# Skip undefined namespaces
continue
namespaces = list(family.namespace(self.site.lang, nsNumber, all=True))
thisNs = namespaces.pop(0)
if nsNumber == 6 and family.name == 'wikipedia' and \
self.site.lang in ('en', 'fr'):
# do not change "Image" on en-wiki and fr-wiki
for image in [u'Image', u'image']:
if image in namespaces:
namespaces.remove(image)
# skip main (article) namespace
if thisNs and namespaces:
text = pywikibot.replaceExcept(text, r'\[\[\s*(' + '|'.join(namespaces) + ') *:(?P<nameAndLabel>.*?)\]\]', r'[[' + thisNs + ':\g<nameAndLabel>]]', exceptions)
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:27,代码来源:cosmetic_changes.py
示例17: removeNonBreakingSpaceBeforePercent
def removeNonBreakingSpaceBeforePercent(self, text):
'''
Newer MediaWiki versions automatically place a non-breaking space in
front of a percent sign, so it is no longer required to place it
manually.
'''
text = pywikibot.replaceExcept(text, r'(\d) %', r'\1 %', ['timeline'])
return text
开发者ID:azatoth,项目名称:pywikipedia,代码行数:8,代码来源:cosmetic_changes.py
示例18: removeNonBreakingSpaceBeforePercent
def removeNonBreakingSpaceBeforePercent(self, text):
"""
Newer MediaWiki versions automatically place a non-breaking space in
front of a percent sign, so it is no longer required to place it
manually.
"""
text = pywikibot.replaceExcept(text, r"(\d) %", r"\1 %", ["timeline"])
return text
开发者ID:reza1615,项目名称:pywikipedia-rewrite,代码行数:8,代码来源:cosmetic_changes.py
示例19: fixHtml
def fixHtml(self, text):
# Everything case-insensitive (?i)
# Keep in mind that MediaWiki automatically converts <br> to <br />
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
'startspace']
text = pywikibot.replaceExcept(text, r'(?i)<b>(.*?)</b>', r"'''\1'''",
exceptions)
text = pywikibot.replaceExcept(text, r'(?i)<strong>(.*?)</strong>',
r"'''\1'''", exceptions)
text = pywikibot.replaceExcept(text, r'(?i)<i>(.*?)</i>', r"''\1''",
exceptions)
text = pywikibot.replaceExcept(text, r'(?i)<em>(.*?)</em>', r"''\1''",
exceptions)
# horizontal line without attributes in a single line
text = pywikibot.replaceExcept(text, r'(?i)([\r\n])<hr[ /]*>([\r\n])',
r'\1----\2', exceptions)
# horizontal line with attributes; can't be done with wiki syntax
# so we only make it XHTML compliant
text = pywikibot.replaceExcept(text, r'(?i)<hr ([^>/]+?)>',
r'<hr \1 />',
exceptions)
# a header where only spaces are in the same line
for level in range(1, 7):
equals = '\\1%s \\2 %s\\3' % ("=" * level, "=" * level)
text = pywikibot.replaceExcept(
text,
r'(?i)([\r\n]) *<h%d> *([^<]+?) *</h%d> *([\r\n])'
% (level, level),
r'%s' % equals,
exceptions)
# TODO: maybe we can make the bot replace <p> tags with \r\n's.
return text
开发者ID:edgarskos,项目名称:pywikipedia-rewrite,代码行数:32,代码来源:cosmetic_changes.py
示例20: fixStyle
def fixStyle(self, text):
exceptions = ['nowiki', 'comment', 'math', 'pre', 'source',
'startspace']
# convert prettytable to wikitable class
if self.site.language in ('de', 'en'):
text = pywikibot.replaceExcept(text,
ur'(class="[^"]*)prettytable([^"]*")',
ur'\1wikitable\2', exceptions)
return text
开发者ID:edgarskos,项目名称:pywikipedia-rewrite,代码行数:9,代码来源:cosmetic_changes.py
注:本文中的pywikibot.replaceExcept函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论