mirror of
https://github.com/vale981/ablog
synced 2025-03-04 16:51:39 -05:00
Upstream Pr #93
This commit is contained in:
commit
2b11b3fc40
3 changed files with 8 additions and 22 deletions
|
@ -1,7 +1,6 @@
|
|||
language: python
|
||||
sudo: false
|
||||
python:
|
||||
- 2.6
|
||||
- 2.7
|
||||
- 3.4
|
||||
- 3.5
|
||||
|
|
|
@ -15,10 +15,10 @@ from unicodedata import normalize
|
|||
|
||||
from docutils import nodes
|
||||
from docutils.io import StringOutput
|
||||
from docutils.utils import new_document
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx.util.osutil import relative_uri
|
||||
from sphinx.environment import dummy_reporter
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
text_type = str
|
||||
|
@ -380,15 +380,14 @@ class Post(BlogPageMixin):
|
|||
from the output. More than one can be dropped by setting *drop_h1*
|
||||
to the desired number of tags to be dropped."""
|
||||
|
||||
doctree = new_document('')
|
||||
if fulltext:
|
||||
doctree = nodes.document({}, dummy_reporter)
|
||||
deepcopy = self.doctree.deepcopy()
|
||||
if isinstance(deepcopy, nodes.document):
|
||||
doctree.extend(deepcopy.children)
|
||||
else:
|
||||
doctree.append(deepcopy)
|
||||
else:
|
||||
doctree = nodes.document({}, dummy_reporter)
|
||||
for node in self.excerpt:
|
||||
doctree.append(node.deepcopy())
|
||||
app = self._blog.app
|
||||
|
|
|
@ -13,13 +13,8 @@ except ImportError:
|
|||
from docutils import nodes
|
||||
from sphinx.locale import _
|
||||
from sphinx.util.nodes import set_source_info
|
||||
from sphinx.util.compat import Directive
|
||||
# DeprecationWarning: make_admonition is deprecated, use docutils.parsers.rst.directives.admonitions.BaseAdmonition instead
|
||||
try:
|
||||
from sphinx.util.compat import make_admonition
|
||||
except ImportError:
|
||||
from docutils.parsers.rst.directives.admonitions import BaseAdmonition as make_admonition
|
||||
from docutils.parsers.rst import directives
|
||||
from docutils.parsers.rst import directives, Directive
|
||||
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
|
||||
from docutils.utils import relative_path
|
||||
|
||||
import ablog
|
||||
|
@ -43,7 +38,7 @@ class PostList(nodes.General, nodes.Element):
|
|||
pass
|
||||
|
||||
|
||||
class UpdateNode(nodes.Admonition, nodes.Element):
|
||||
class UpdateNode(nodes.admonition):
|
||||
"""Represent ``update`` directive."""
|
||||
|
||||
pass
|
||||
|
@ -95,22 +90,15 @@ class PostDirective(Directive):
|
|||
return [node]
|
||||
|
||||
|
||||
class UpdateDirective(Directive):
|
||||
class UpdateDirective(BaseAdmonition):
|
||||
|
||||
has_content = True
|
||||
required_arguments = 1
|
||||
optional_arguments = 0
|
||||
final_argument_whitespace = True
|
||||
option_spec = {}
|
||||
node_class = UpdateNode
|
||||
|
||||
def run(self):
|
||||
|
||||
ad = make_admonition(UpdateNode, self.name, [_('Updated on')],
|
||||
self.options,
|
||||
self.content, self.lineno, self.content_offset,
|
||||
self.block_text, self.state, self.state_machine)
|
||||
ad = super(UpdateDirective, self).run(self)
|
||||
ad[0]['date'] = self.arguments[0] if self.arguments else ''
|
||||
set_source_info(self, ad[0])
|
||||
return ad
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue