Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
70d800e6
Commit
70d800e6
authored
May 26, 1997
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add optional section titles to format_all.
Allow for missing section titles in format_all and format_index.
parent
0ab24d1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
Tools/faqwiz/faqwiz.py
Tools/faqwiz/faqwiz.py
+21
-4
No files found.
Tools/faqwiz/faqwiz.py
View file @
70d800e6
...
...
@@ -410,7 +410,7 @@ class FaqWizard:
emit
(
ONE_HIT
,
count
=
1
)
else
:
emit
(
FEW_HITS
,
count
=
len
(
hits
))
self
.
format_all
(
hits
)
self
.
format_all
(
hits
,
headers
=
0
)
else
:
emit
(
MANY_HITS
,
count
=
len
(
hits
))
self
.
format_index
(
hits
)
...
...
@@ -441,9 +441,22 @@ class FaqWizard:
print
time
.
strftime
(
LAST_CHANGED
,
time
.
localtime
(
time
.
time
()))
def
format_all
(
self
,
files
,
edit
=
1
):
def
format_all
(
self
,
files
,
edit
=
1
,
headers
=
1
):
sec
=
0
for
file
in
files
:
self
.
dir
.
show
(
file
,
edit
=
edit
)
try
:
entry
=
self
.
dir
.
open
(
file
)
except
NoSuchFile
:
continue
if
headers
and
entry
.
sec
!=
sec
:
sec
=
entry
.
sec
try
:
title
=
SECTION_TITLES
[
sec
]
except
KeyError
:
title
=
"Untitled"
emit
(
"
\
n
<HR>
\
n
<H1>%(sec)s. %(title)s</H1>
\
n
"
,
sec
=
sec
,
title
=
title
)
entry
.
show
(
edit
=
edit
)
def
do_index
(
self
):
self
.
prologue
(
T_INDEX
)
...
...
@@ -462,7 +475,11 @@ class FaqWizard:
emit
(
INDEX_ADDSECTION
,
sec
=
sec
)
emit
(
INDEX_ENDSECTION
,
sec
=
sec
)
sec
=
entry
.
sec
emit
(
INDEX_SECTION
,
sec
=
sec
,
title
=
SECTION_TITLES
[
sec
])
try
:
title
=
SECTION_TITLES
[
sec
]
except
KeyError
:
title
=
"Untitled"
emit
(
INDEX_SECTION
,
sec
=
sec
,
title
=
title
)
emit
(
INDEX_ENTRY
,
entry
)
if
sec
:
if
add
:
...
...
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