WikiExtractor / WikiExtractor/wikiextractor
Section header is printed even without --sections if list is first thing in section
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4k
- Forks
- 1k
- Avg merge
- 1m
- Merged PRs (30d)
- 10
Description
If you have an article that looks like this:
===Section header===
*List item 1
*List item 2
And you pass the --lists argument, the section header will be included in the output even if you do not include the --sections argument. The reason is that the code in compact() that outputs the headers before a list does not check whether keepSections is true. Here is the relevant code:
if line: # FIXME: n is '"'
if options.keepLists:
# emit open sections
items = sorted(headers.items())
for _, v in items:
page.append(v)
headers.clear()
I think it should be like this:
if line: # FIXME: n is '"'
if options.keepLists:
if options.keepSections:
# emit open sections
items = sorted(headers.items())
for _, v in items:
page.append(v)
headers.clear()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating compact() and inspect the keepLists handling described in the issue. Reproduce the example with --lists but without --sections, then verify that the section header is omitted while list items remain in the output. Check the existing command-line tests or add coverage for this option combination if no test covers it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100