当前位置: 首页>>代码示例>>Python>>正文


Python command.Command类代码示例

本文整理汇总了Python中outwiker.pages.wiki.parser.command.Command的典型用法代码示例。如果您正苦于以下问题:Python Command类的具体用法?Python Command怎么用?Python Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Command类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__ (self, parser):
        """
        parser - экземпляр парсера
        """
        Command.__init__ (self, parser)

        NameHarvester.counters = set()
开发者ID:Jenyay,项目名称:outwiker,代码行数:7,代码来源:nameharvester.py

示例2: __init__

 def __init__(self, parser, application):
     """
     parser - экземпляр парсера
     """
     Command.__init__(self, parser)
     self._application = application
     self._enabled = True
开发者ID:Jenyay,项目名称:outwiker,代码行数:7,代码来源:commands.py

示例3: __init__

    def __init__ (self, parser):
        """
        parser - экземпляр парсера
        """
        Command.__init__ (self, parser)

        # Счетчики на странице.
        # Ключ - имя счетчика, значение - экземпляр класса _Counter
        self._counters = {}
开发者ID:LihMeh,项目名称:outwiker,代码行数:9,代码来源:commandcounter.py

示例4: __init__

    def __init__ (self, parser):
        """
        parser - экземпляр парсера
        """
        Command.__init__ (self, parser)
        self._fileNameFormat = u"__diagram_{}.png"

        global _
        _ = get_()
开发者ID:Jenyay,项目名称:outwiker,代码行数:9,代码来源:commanddiagram.py

示例5: __init__

    def __init__ (self, parser, config):
        """
        parser - экземпляр парсера
        """
        Command.__init__ (self, parser)
        self.__config = SourceConfig (config)

        # Стили CSS, добавленные в заголовок
        self.__appendCssClasses = []

        global _
        _ = get_()
开发者ID:LihMeh,项目名称:outwiker,代码行数:12,代码来源:commandsource.py

示例6: testParamsParsing1

    def testParamsParsing1 (self):
        params_text = u"""Параметр1
Параметр2 = 111
Параметр3 = " бла бла бла"
Параметр4
Параметр5="111"
Параметр6=' 222 '
Параметр7 = " проверка 'бла бла бла' проверка"
Параметр8 = ' проверка "bla-bla-bla" тест '
Параметр9 = -1
Параметр10 = -10.5
Параметр11 = 12.5
"""

        params = Command.parseParams (params_text)

        self.assertEqual (len (params), 11, params)
        self.assertEqual (params[u"Параметр1"], u"")
        self.assertEqual (params[u"Параметр2"], u"111")
        self.assertEqual (params[u"Параметр3"], u" бла бла бла")
        self.assertEqual (params[u"Параметр4"], u"")
        self.assertEqual (params[u"Параметр5"], u"111")
        self.assertEqual (params[u"Параметр6"], u" 222 ")
        self.assertEqual (params[u"Параметр7"], u" проверка 'бла бла бла' проверка")
        self.assertEqual (params[u"Параметр8"], u' проверка "bla-bla-bla" тест ')
        self.assertEqual (params[u"Параметр9"], u"-1")
        self.assertEqual (params[u"Параметр10"], u"-10.5")
        self.assertEqual (params[u"Параметр11"], u"12.5")
开发者ID:LihMeh,项目名称:outwiker,代码行数:28,代码来源:wikicommands.py

示例7: execute

    def execute (self, params, content):
        """
        Запустить команду на выполнение. 
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        params_dict = Command.parseParams (params)

        name = self._getNameParam (params_dict)
        start = self._getStartParam (params_dict)
        step = self._getStepParam (params_dict)
        parent = self._getParentParam (params_dict)
        hide = self._getHideParam (params_dict)
        separator = self._getSeparatorParam (params_dict)

        if name not in self._counters:
            self._counters[name] = _Counter()

        counter = self._counters[name]

        if start != None:
            counter.reset (start, parent, separator)
        else:
            counter.next(step, parent, separator)

        return u"" if hide else counter.toString() 
开发者ID:LihMeh,项目名称:outwiker,代码行数:25,代码来源:commandcounter.py

示例8: execute

    def execute (self, params, content):
        """
        Запустить команду на выполнение.
        Оформление исходных текстов
        """
        params_dict = Command.parseParams (params)

        try:
            sourceText = self.__getContentFromFile (params_dict)

        except KeyError:
            sourceText = content

        except IOError:
            return _(u"<B>Source plugin: File '{0}' not found</B>").format (getFileName (params_dict[FILE_PARAM_NAME]))

        except UnicodeDecodeError:
            return _(u"<B>Source plugin: Encoding error</B>")

        except LookupError:
            return _(u"<B>Source plugin: Unknown encoding</B>")

        tabwidth = self.__getTabWidth (params_dict)

        newcontent = sourceText.replace ("\t", " " * tabwidth)
        colortext = self.__colorize (params_dict, newcontent)

        return colortext
开发者ID:LihMeh,项目名称:outwiker,代码行数:28,代码来源:commandsource.py

示例9: execute

    def execute (self, params, content):
        params_dict = Command.parseParams (params)

        children = self.parser.page.children
        self._sortChildren (children, params_dict)

        return SimpleView.make (children, self.parser, params)
开发者ID:Jenyay,项目名称:outwiker,代码行数:7,代码来源:childlist.py

示例10: parseGraphParams

    def parseGraphParams(params):
        """
        Parse params string into parts: key - value. Key may contain a dot.
        Sample params:
            param1
            Параметр2.subparam = 111
            Параметр3 = " bla bla bla"
            param4.sub.param2 = "111"
            param5 =' 222 '
            param7 = " sample 'bla bla bla' example"
            param8 = ' test "bla-bla-bla" test '
        """
        pattern = r"""((?P<name>[\w.]+)
   (\s*=\s*(?P<param>([-_\w.]+)|((?P<quote>["']).*?(?P=quote)) ) )?\s*)"""

        result = {}

        regex = re.compile(
            pattern,
            re.IGNORECASE | re.MULTILINE | re.DOTALL | re.VERBOSE
        )
        matches = regex.finditer(params)

        for match in matches:
            name = match.group("name")
            param = match.group("param")
            if param is None:
                param = u""

            result[name] = Command.removeQuotes(param)

        return result
开发者ID:Jenyay,项目名称:outwiker,代码行数:32,代码来源:commands.py

示例11: execute

    def execute (self, params, content):
        """
        Запустить команду на выполнение.
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        params_dict = Command.parseParams (params)

        return u"Plugin Command Result"
开发者ID:LihMeh,项目名称:outwiker,代码行数:8,代码来源:commands.py

示例12: execute

    def execute (self, params, content):
        """
        Запустить команду на выполнение. 
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        params_dict = Command.parseParams (params)

        name = self._getNameParam (params_dict)
        if len (name) != 0:
            NameHarvester.counters.add (name)

        return u""
开发者ID:Jenyay,项目名称:outwiker,代码行数:12,代码来源:nameharvester.py

示例13: execute

    def execute (self, params, content):
        params_dict = Command.parseParams (params)
        attach = Attachment (self.parser.page)

        attachlist = attach.getAttachRelative ()
        attachpath = attach.getAttachPath()

        (dirs, files) = self.separateDirFiles (attachlist, attachpath)

        self._sortFiles (dirs, params_dict)
        self._sortFiles (files, params_dict)

        return SimpleView.make (dirs + files, attachpath)
开发者ID:Jenyay,项目名称:outwiker,代码行数:13,代码来源:attachlist.py

示例14: __init__

    def __init__ (self, parser, name, lang):
        """
        parser - экземпляр парсера
        """
        Command.__init__ (self, parser)
        global _
        _ = lang

        self.__name = name

        self.__style1 = u"""<STYLE>div.spoiler_style1 {
    padding: 3px; 
    border: 1px solid #d8d8d8; 
    }</STYLE>"""

        self.__style2 = u"""<STYLE>div.spoiler_style2 {
    text-transform: uppercase; 
    border-bottom: 1px solid #CCCCCC; 
    margin-bottom: 3px; 
    font-size: 0.8em; 
    font-weight: bold; 
    display: block;
    }</STYLE>"""

        self.__blockTemplate = ur"""
        <div class="spoiler_style1"><div class="spoiler_style2"><span onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') {  this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b></b><a href=\'#\' onClick=\'return false;\'>{collapsetext}</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b></b><a href=\'#\' onClick=\'return false;\'>{expandtext}</a>'; }" /><b></b><a href="#" onClick="return false;">{expandtext}</a></span></div><div class="spoiler_quotecontent"><div style="display: none;">{content}</div></div></div>"""

        self.__inlineTemplate = ur"""<span><span onClick="this.parentNode.getElementsByTagName('span')[1].style.display = ''; this.style.display = 'none';"><a href="#">{expandtext}</a></span><span style="display: none;" onClick="this.parentNode.getElementsByTagName('span')[0].style.display = ''; this.style.display = 'none';">{content}</span></span>"""
    
        self.__expandParam = u"expandtext"
        self.__collapseParam = u"collapsetext"
        self.__inlineParam = u"inline"

        # Надписи по умолчанию
        self.__expandTextDefault = _(u"Expand")
        self.__collapseTextDefault = _(u"Collapse")

        # Добавлены ли стили в заголовок
        self.__styleAppend = False
开发者ID:qyqx,项目名称:outwiker,代码行数:39,代码来源:commandspoiler.py

示例15: execute

    def execute(self, params, content):
        """
        Run command.
        The method returns link which will replace the command notation
        """
        paramsDict = Command.parseParams(params)

        commandParser = CommandExecParser(self.parser.page)
        commandsList = commandParser.parse(content)

        htmlMaker = self._createHtmlMaker(paramsDict)
        html = htmlMaker.createHtml(commandsList, paramsDict)

        return html
开发者ID:Jenyay,项目名称:outwiker,代码行数:14,代码来源:commandexec.py


注:本文中的outwiker.pages.wiki.parser.command.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。