Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
5527db5b
Kaydet (Commit)
5527db5b
authored
May 23, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added code to recognize http/ftp URLs and email addresses, and add <A>
tags for them.
üst
821a558f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
faqmain.py
Tools/faqwiz/faqmain.py
+34
-4
No files found.
Tools/faqwiz/faqmain.py
Dosyayı görüntüle @
5527db5b
...
...
@@ -9,8 +9,6 @@ XXX TO DO
- next/prev/index links in do_show?
- should have files containing section headers
- customize rcs command pathnames
- recognize urls and email addresses and turn them into <A> tags
- use cookies to keep Name/email the same
- explanation of editing somewhere
- various embellishments, GIFs, crosslinks, hints, etc.
- create new sections
...
...
@@ -582,7 +580,7 @@ class FAQServer:
else
:
print
'<P>'
else
:
if
line
==
string
.
lstrip
(
line
):
# I.e., no leading whitespace
if
line
[
0
]
not
in
string
.
whitespace
:
if
pre
:
print
'</PRE>'
pre
=
0
...
...
@@ -590,7 +588,7 @@ class FAQServer:
if
not
pre
:
print
'<PRE>'
pre
=
1
print
cgi
.
escap
e
(
line
)
print
self
.
translat
e
(
line
)
if
pre
:
print
'</PRE>'
pre
=
0
...
...
@@ -658,6 +656,38 @@ class FAQServer:
</HTML>
'''
translate_prog
=
None
def
translate
(
self
,
text
):
if
not
self
.
translate_prog
:
import
regex
url
=
'
\
(http
\
|ftp
\
)://[^
\t\r\n
]*'
email
=
'
\
<[-a-zA-Z0-9._]+@[-a-zA-Z0-9._]+'
self
.
translate_prog
=
prog
=
regex
.
compile
(
url
+
"
\
|"
+
email
)
else
:
prog
=
self
.
translate_prog
i
=
0
list
=
[]
while
1
:
j
=
prog
.
search
(
text
,
i
)
if
j
<
0
:
break
list
.
append
(
cgi
.
escape
(
text
[
i
:
j
]))
i
=
j
url
=
prog
.
group
(
0
)
while
url
[
-
1
]
in
");:,.?"
:
url
=
url
[:
-
1
]
url
=
cgi
.
escape
(
url
)
if
':'
in
url
:
repl
=
'<A HREF="
%
s">
%
s</A>'
%
(
url
,
url
)
else
:
repl
=
'<A HREF="mailto:
%
s"><
%
s></A>'
%
(
url
,
url
)
list
.
append
(
repl
)
i
=
i
+
len
(
url
)
j
=
len
(
text
)
list
.
append
(
cgi
.
escape
(
text
[
i
:
j
]))
return
string
.
join
(
list
,
''
)
print
"Content-type: text/html"
dt
=
0
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment