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


Python Command.parseParams方法代码示例

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


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

示例1: testParamsParsing1

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:30,代码来源:wikicommands.py

示例2: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:9,代码来源:childlist.py

示例3: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:30,代码来源:commandsource.py

示例4: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:27,代码来源:commandcounter.py

示例5: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def execute (self, params, content):
        """
        Запустить команду на выполнение.
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        params_dict = Command.parseParams (params)

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

示例6: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:14,代码来源:nameharvester.py

示例7: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:15,代码来源:attachlist.py

示例8: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    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,代码行数:16,代码来源:commandexec.py

示例9: testParamsParsing10

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def testParamsParsing10 (self):
        params_text = u"""Параметр1.Подпараметр
            Пар_аме_тр2 = 111
            Параметр3.Еще.Подпар_аметр
            Пар.ам.етр4 = " проверка 'бла бла бла' проверка"
            Пар.аме.тр5 = ' проверка "bla-bla-bla" тест ' """

        params = Command.parseParams (params_text)

        self.assertEqual (len (params), 5)
        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' проверка "bla-bla-bla" тест ')
开发者ID:LihMeh,项目名称:outwiker,代码行数:17,代码来源:wikicommands.py

示例10: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def execute (self, params, content):
        """
        Запустить команду на выполнение. 
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        params_dict = Command.parseParams (params)
        template = self.__getTemplate (params_dict)

        parsedcontent = self.parser.parseWikiMarkup (content.strip())
        result = template.replace (u"{expandtext}", self.__getExpandText (params_dict) )
        result = result.replace (u"{collapsetext}", self.__getCollapseText (params_dict) )
        result = result.replace (u"{content}", parsedcontent)

        self.__appendStyles()

        return result
开发者ID:qyqx,项目名称:outwiker,代码行数:18,代码来源:commandspoiler.py

示例11: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def execute (self, params, content):
        """
        Запустить команду на выполнение.
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        paramsDict = Command.parseParams (params)
        thumbsize = self._getThumbSize(paramsDict)
        columnsCount = self._getColumnsCount(paramsDict)

        lineItems = self._parseContent (content)

        if columnsCount == 0:
            generator = ThumbStreamGenerator (lineItems, thumbsize, self.parser)
        else:
            generator = ThumbTableGenerator (lineItems, thumbsize, self.parser, columnsCount)

        return generator.generate()
开发者ID:LihMeh,项目名称:outwiker,代码行数:19,代码来源:thumblistcommand.py

示例12: execute

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def execute (self, params, content):
        """
        Запустить команду на выполнение.
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        (path, params_tail) = self._getAttach (params)
        if path is None:
            return u""

        params_dict = Command.parseParams (params_tail)
        encoding = self._getEncoding (params_dict)

        try:
            with open (path) as fp:
                # Почему-то в конце всегда оказывается перевод строки
                text = unicode (fp.read (), encoding).rstrip()
        except IOError:
            return _(u"<b>Can't open file %s</b>" % path)
        except Exception:
            return _(u"<b>Encoding error in file %s</b>" % os.path.basename (path))

        return self._postprocessText (text, params_dict)
开发者ID:LihMeh,项目名称:outwiker,代码行数:24,代码来源:include.py

示例13: testParamsParsing2

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
    def testParamsParsing2 (self):
        params_text = u""
        params = Command.parseParams (params_text)

        self.assertEqual (len (params), 0)
开发者ID:qyqx,项目名称:outwiker,代码行数:7,代码来源:wikicommands.py

示例14: testParamsParsing3

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
 def testParamsParsing3(self):
     params_text = """Параметр=-1"""
     params = Command.parseParams(params_text)
     self.assertEqual(params["Параметр"], "-1")
开发者ID:Jenyay,项目名称:outwiker,代码行数:6,代码来源:test_wikicommands.py

示例15: testParamsParsing4

# 需要导入模块: from outwiker.pages.wiki.parser.command import Command [as 别名]
# 或者: from outwiker.pages.wiki.parser.command.Command import parseParams [as 别名]
 def testParamsParsing4(self):
     params_text = 'Параметр="-1"'
     params = Command.parseParams(params_text)
     self.assertEqual(params["Параметр"], "-1")
开发者ID:Jenyay,项目名称:outwiker,代码行数:6,代码来源:test_wikicommands.py


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