Merge pull request #6 from nabobalis/master

Code changes from PR and Issue Comments
This commit is contained in:
Nabil Freij 2018-02-17 19:15:24 +01:00 committed by GitHub
commit 82ed8b7a77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -92,6 +92,7 @@ CONFIG = [
TOMORROW = datetime.today() + dtmod.timedelta(1)
TOMORROW = TOMORROW.replace(hour=0, minute=0, second=0, microsecond=0)
FUTURE = datetime(9999, 12, 31)

View file

@ -95,14 +95,17 @@ class PostDirective(Directive):
class UpdateDirective(BaseAdmonition):
required_arguments = 1
node_class = UpdateNode
def run(self):
ad = super(UpdateDirective, self).run()
ad[0]['date'] = self.arguments[0] if self.arguments else ''
date_arg = self.arguments[0] if self.arguments else ''
self.arguments = [_('Updated on ' + date_arg), ]
# The following line is needed to trick the BaseAdmonition class into thinking we have a title.
# There almost certainly has to be a better way, but I don't see it naturally from the docutils source
self.node_class = nodes.admonition
ad = super(UpdateDirective, self).run() # For Python3, it is run(), not run(self)
del self.node_class # Undo our tricksy hack from a few lines ago
return ad