From b1823ad83f4dad74eb13b470f2878d23b9fa7f3b Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 9 Dec 1997 16:04:46 +0000 Subject: [PATCH] v 0.8.3 -- add an option to suppress URL processing inside
, by Scott 

---
 Tools/faqwiz/README     |  6 +++---
 Tools/faqwiz/faqconf.py |  5 ++++-
 Tools/faqwiz/faqwiz.py  | 13 ++++++++-----
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Tools/faqwiz/README b/Tools/faqwiz/README
index 0f494aaf4b..4266e08ee2 100644
--- a/Tools/faqwiz/README
+++ b/Tools/faqwiz/README
@@ -2,8 +2,8 @@ FAQ Wizard
 ----------
 
 Author: Guido van Rossum 
-Version: 0.8
-Date: 27 August 1997
+Version: 0.8.3
+Date:  8 December 1997
 
 
 This is a CGI program that maintains a user-editable FAQ.  It uses RCS
@@ -18,7 +18,7 @@ importable module.  The actual script in cgi-bin is minimal.
 Files:
 
 faqw.py		executable script to be edited and installed in cgi-bin
-faqwin.py	main module, lives in same directory as FAQ entry files
+faqwiz.py	main module, lives in same directory as FAQ entry files
 faqconf.py	main configuration module
 faqcust.py	additional local customization module (optional)
 
diff --git a/Tools/faqwiz/faqconf.py b/Tools/faqwiz/faqconf.py
index d282589b48..7845c0ecac 100644
--- a/Tools/faqwiz/faqconf.py
+++ b/Tools/faqwiz/faqconf.py
@@ -29,6 +29,9 @@ RCSBINDIR = "/depot/gnu/plat/bin/"	# Directory containing RCS commands
 MAXHITS = 10				# Max #hits to be shown directly
 COOKIE_LIFETIME = 28*24*3600		# Cookie expiration in seconds
 					# (28*24*3600 = 28 days = 4 weeks)
+PROCESS_PREFORMAT = 1                   # toggle whether preformatted text
+                                        # will replace urls and emails with 
+                                        # HTML links
 
 # Markers appended to title to indicate recently change
 # (may contain HTML, e.g. ); and corresponding 
@@ -46,7 +49,7 @@ entries marked with * were changed within the last 7 days.)
 
 # Version -- don't change unless you edit faqwiz.py
 
-WIZVERSION = "0.8.2"			# FAQ Wizard version
+WIZVERSION = "0.8.3"			# FAQ Wizard version
 
 # This parameter is normally overwritten with a dynamic value
 
diff --git a/Tools/faqwiz/faqwiz.py b/Tools/faqwiz/faqwiz.py
index 5ceb2f9308..9282b3614f 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 = '%s' % (url, url)
+	if not pre or (pre and PROCESS_PREFORMAT):
+	    if ':' in url:
+		repl = '%s' % (url, url)
+	    else:
+		repl = '<%s>' % (url, url)
 	else:
-	    repl = '<%s>' % (url, url)
+	    repl = url
 	list.append(repl)
 	i = i + len(url)
     j = len(text)
@@ -292,7 +295,7 @@ class FaqEntry:
 			print '
'
 			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:
-- 
2.50.1