summaryrefslogtreecommitdiffstats
path: root/Tools/faqwiz/faqwiz.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-09 16:04:46 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-09 16:04:46 (GMT)
commitb1823ad83f4dad74eb13b470f2878d23b9fa7f3b (patch)
tree41599b9bedb6a4c261447df9ffecaa18ae64ea18 /Tools/faqwiz/faqwiz.py
parentfc5d8b198aa6e406102e06067fa0e86b2d600a49 (diff)
downloadcpython-b1823ad83f4dad74eb13b470f2878d23b9fa7f3b.zip
cpython-b1823ad83f4dad74eb13b470f2878d23b9fa7f3b.tar.gz
cpython-b1823ad83f4dad74eb13b470f2878d23b9fa7f3b.tar.bz2
v 0.8.3 -- add an option to suppress URL processing inside <PRE>,
by Scott <scott@chronis.icgroup.com>
Diffstat (limited to 'Tools/faqwiz/faqwiz.py')
-rw-r--r--Tools/faqwiz/faqwiz.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py
index 5ceb2f9..9282b36 100644
--- a/Tools/faqwiz/faqwiz.py
+++ b/Tools/faqwiz/faqwiz.py
@@ -70,7 +70,7 @@ def emit(format, *args, **kw):
translate_prog = None
-def translate(text):
+def translate(text, pre=0):
global translate_prog
if not translate_prog:
url = '\(http\|ftp\|https\)://[^ \t\r\n]*'
@@ -90,10 +90,13 @@ def translate(text):
while url[-1] in ');:,.?\'"':
url = url[:-1]
url = escape(url)
- if ':' in url:
- repl = '<A HREF="%s">%s</A>' % (url, url)
+ if not pre or (pre and PROCESS_PREFORMAT):
+ if ':' in url:
+ repl = '<A HREF="%s">%s</A>' % (url, url)
+ else:
+ repl = '<A HREF="mailto:%s">&lt;%s&gt;</A>' % (url, url)
else:
- repl = '<A HREF="mailto:%s">&lt;%s&gt;</A>' % (url, url)
+ repl = url
list.append(repl)
i = i + len(url)
j = len(text)
@@ -292,7 +295,7 @@ class FaqEntry:
print '<PRE>'
pre = 1
if '/' in line or '@' in line:
- line = translate(line)
+ line = translate(line, pre)
elif '<' in line or '&' in line:
line = escape(line)
if not pre and '*' in line: