txt2html charming_python_7.txt > charming_python_7.html
lynx -dump http://gnosis.cx/publish/. lynx -dump http://ibm.com/developerworks/. > ibm_developer.txt lynx -dump http://gnosis.cx/publish | wc | sed "s/( *[0-9]* *\)\([0-9]*\)\(.*\)/\2/g"
import sys
from urllib import urlopen, urlencode
if len(sys.argv) == 2:
cgi = 'http://gnosis.cx/cgi/txt2html.cgi'
opts = urlencode({'source':sys.argv[1], 'proxy':'NONE'})
print urlopen(cgi, opts).read()
else:
print "Please specify URL for Txt2Html conversion"
python fetch_txt2html.py http://gnosis.cx/publish/programming/charming_python_7.txt
"""Hot-pluggable replacement functions for Txt2Html"""
#-- Functions to massage blocks by type
#def
Titleify(block):
#def Authorify(block):
# ... [more block massaging functions] ...
#-- Utility functions for text transformation
#def AdjustCaps(txt):
#def capwords(txt):
#def URLify(txt):
def Typographify
(txt):
# [module] names
r = re.compile(r
""'([\(\s'/">]|^)\[(.*?)\]([<\s\.\),:;'"?!/-])""" , re.M | re.S)
txt = r.sub(
'\\1<em><code>\\2</code></em>\\3' ,txt)
# *strongly emphasize* words
r = re.compile(r
""'([\(\s'/"]|^)\*(.*?)\*([\s\.\),:;'"?!/-])""" , re.M | re.S)
txt = r.sub(
'\\1<strong>\\2</strong>\\3' , txt)
# ... [more text massaging] ...
return
txt
# ... [more text transformation functions] .....
from
dmTxt2Html
import
*
# Import the body of 'Txt2Html' code
from
urllib
import
urlopen
import
sys
# Check for updated functions (fail gracefully if not fetchable)
try
:
updates = urlopen(
'http://gnosis.cx/download/t2h_textfuncs.py' ).read()
fh = open(
't2h_textfuncs.py' ,
'w' )
fh.write(updates)
fh.close()
except
:
sys.stderr.write(
'Cannot currently download Txt2Html updates' )
# Import the updated functions (if available)
try
:
from
t2h_textfuncs
import
*
except
:
sys.stderr.write(
'Cannot import the updated Txt2Html functions' )
# Set options based on runmode (shell vs. CGI)
if
len(sys.argv) >= 2:
cfg_dict = ParseArgs(sys.argv[1:])
main(cfg_dict)
else
:
print"Please specify URL (and options) for Txt2Html conversion"
G:\txt2html> python dyn_txt2html.py test.txt > test.html Cannot currently download Txt2Html updates
def update_txt2html
():
# Check for updated functions (fail gracefully if not fetchable)
s = curses.newwin(6, 60, 4, 5)
s.box()
s.addstr(1, 2,
"* PRESS ANY KEY TO CONTINUE *" , curses.A_BOLD)
s.addstr(3,2,
"...downloading..." )
s.refresh()
try
:
from
urllib
import
urlopen
updates = urlopen(
'http://gnosis.cx/download/dmTxt2Html.py' ).read()
fh = open(
'dmTxt2Html.py' ,
'w' )
fh.write(updates)
fh.close()
s.addstr(3,2,
"Module [dmTxt2Html] downloaded to current directory" )
except
:
s.addstr(3,2,
"Download of updated [dmTxt2Html] module failed!" )
reload(dmTxt2Html)
s.addstr(4, 2,
"Module [dmTxt2Html] reloaded from current directory " )
s.refresh()
c = s.getch()
s.erase()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有