Skip to content

Commit

Permalink
handle lower subsections better (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Dec 29, 2018
1 parent 837a696 commit df52864
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# MediaWiki Changelog

## Version 0.5.1

* Added Table of Contents parsing based on sections: result is an OrderedDict
* Fix issue where some sections are not pulled correctly

## Version 0.5.0

* Add support for logging into the MediaWiki site [issue #59](https://github.com/barrust/mediawiki/issues/48)
Expand Down
2 changes: 1 addition & 1 deletion mediawiki/mediawiki.py
Expand Up @@ -16,7 +16,7 @@
from .utilities import (memoize)

URL = 'https://github.com/barrust/mediawiki'
VERSION = '0.5.0'
VERSION = '0.5.1'


class MediaWiki(object):
Expand Down
9 changes: 9 additions & 0 deletions mediawiki/mediawikipage.py
Expand Up @@ -446,8 +446,17 @@ def section(self, section_title):
try:
content = self.content
index = content.index(section) + len(section)

# ensure we have the full section header...
while True:
if content[index + 1] == '=':
index += 1
else:
break
except ValueError:
return None
except IndexError:
pass

try:
next_index = self.content.index('==', index)
Expand Down

0 comments on commit df52864

Please sign in to comment.