jp (blog/set): fixed missing current_syntax
This commit is contained in:
parent
987d808896
commit
9a50da7f07
1 changed files with 11 additions and 8 deletions
|
|
@ -43,6 +43,8 @@ __commands__ = ["Blog"]
|
|||
SYNTAX_XHTML = u"xhtml"
|
||||
# extensions to use with known syntaxes
|
||||
SYNTAX_EXT = {
|
||||
# FIXME: default syntax doesn't sounds needed, there should always be a syntax set
|
||||
# by the plugin.
|
||||
"": "txt", # used when the syntax is not found
|
||||
SYNTAX_XHTML: "xhtml",
|
||||
"markdown": "md",
|
||||
|
|
@ -105,6 +107,14 @@ def guessSyntaxFromPath(host, sat_conf, path):
|
|||
class BlogPublishCommon(object):
|
||||
"""handle common option for publising commands (Set and Edit)"""
|
||||
|
||||
@property
|
||||
def current_syntax(self):
|
||||
if self._current_syntax is None:
|
||||
self._current_syntax = self.host.bridge.getParamA(
|
||||
"Syntax", "Composition", "value", self.profile
|
||||
)
|
||||
return self._current_syntax
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument(
|
||||
"-T", "--title", type=base.unicode_decoder, help=_(u"title of the item")
|
||||
|
|
@ -180,6 +190,7 @@ class Set(base.CommandBase, BlogPublishCommon):
|
|||
self.host.quit(C.EXIT_OK)
|
||||
|
||||
def start(self):
|
||||
self._current_syntax = self.args.syntax
|
||||
self.pubsub_item = self.args.item
|
||||
mb_data = {}
|
||||
self.setMbDataFromArgs(mb_data)
|
||||
|
|
@ -432,14 +443,6 @@ class Edit(base.CommandBase, BlogPublishCommon, common.BaseEdit):
|
|||
BlogPublishCommon.__init__(self)
|
||||
common.BaseEdit.__init__(self, self.host, BLOG_TMP_DIR, use_metadata=True)
|
||||
|
||||
@property
|
||||
def current_syntax(self):
|
||||
if self._current_syntax is None:
|
||||
self._current_syntax = self.host.bridge.getParamA(
|
||||
"Syntax", "Composition", "value", self.profile
|
||||
)
|
||||
return self._current_syntax
|
||||
|
||||
def add_parser_options(self):
|
||||
BlogPublishCommon.add_parser_options(self)
|
||||
self.parser.add_argument(
|
||||
|
|
|
|||
Loading…
Reference in a new issue