', text)
text = parser.parser(text, docroot = basehref, allowHtml=True)
# Remove Reference (no good way to parse)
text = re.sub(r'(?is)]*>.*?|]*/>', '[ref]', text)
print text.encode('utf-8')
def wikiLink(text):
for m in re.finditer(r'\[\[(?:([^][|]*)\||)(.*?)\]\]', text):
link = (m.group(1) or m.group(2)).replace(' ', '_').strip('_')
text = text.replace(m.group(), r'%s' % (hostname, link, m.group(2)))
return text
import time
def profile(text):
print '' % (time.clock(), text)
#########################################
##
#########################################
def grade2age(grade):
return int(grade+5.3)
def rowPrint(*cells):
print '
%s' % (page.hostname(), page.site().language(), page._redirarg, page._redirarg)
return
if not wikiText.strip():
print 'Page does not exist'
return
elif '{{disambig}}' in wikiText:
printWiki(wikiText, basehref='?page=', linkClass = '')
return
elif raw:
wikiText = raw
if True: # indent hack
profile('contents loaded')
printu('%s' % (page.hostname(), page.urlname(), page.title()))
print '| ' print '' print 'Wikitext: %#.3g KB' % (len(wikiText)/1024.) print '' % (len(wikiText)/350) print 'Text: %#.3g KB' % (len(text)/1024.) print '' % (len(text)/350) print 'Readable prose: %#.3g KB' % (len(prose)/1024.) print '' % (len(prose)/350) print ' |
| Plain text | Prose |
|---|
| Plain text | Prose |
|---|
| Test | U.S. grade level | Reader age | Scale |
|---|
| '
print ' '
print ' '
print ''
print '' % (fry_left-4, fry_top-4, )
# print ' '
print '• |
| ' print 'words, McAlpine EFLAW miniwords, 6+ characters, 3+ sllables words, Spache unfamiliar words, DC unfamiliar words, Monosyllablic words' print ' |
'
print 'Wikitext' printWiki(wikiText, basehref="?page=", linkClass="") profile('Printed wikitext') print ' | '
print 'Text' printWiki(text, linkClass="") profile('Printed text') print ' | '
print 'Proses (Marked up)' printWiki(prosestats.markedup, linkClass="") profile('Printed prose') print ' |