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


Python parserfactory.ParserFactory类代码示例

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


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

示例1: setUp

    def setUp(self):
        self.encoding = "utf8"
        self.filesPath = u"../test/samplefiles/"

        self.__createWiki()
        factory = ParserFactory()
        self.parser = factory.make (self.testPage, Application.config)
开发者ID:qyqx,项目名称:outwiker,代码行数:7,代码来源:parserquote.py

示例2: testCommandTest7

    def testCommandTest7 (self):
        factory = ParserFactory ()
        factory.appendCommand (TestCommand)

        parser = factory.make (self.testPage, Application.config)

        
        text = u"""(: test Параметр1 Параметр2=2 Параметр3=3 :)
Текст внутри
команды
(:testend:)

(: test Параметры :)
Контент
(:testend:)"""

        result_right = u"""Command name: test
params: Параметр1 Параметр2=2 Параметр3=3
content: Текст внутри
команды

Command name: test
params: Параметры
content: Контент"""

        result = parser.toHtml (text)
        self.assertEqual (result_right, result, result)
开发者ID:qyqx,项目名称:outwiker,代码行数:27,代码来源:wikicommands.py

示例3: setUp

    def setUp(self):
        self.initApplication()

        self.filesPath = "../test/samplefiles/"
        self.__createWiki()

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self.application.config)
开发者ID:Jenyay,项目名称:outwiker,代码行数:8,代码来源:test_wikicommands.py

示例4: _getCountersList

    def _getCountersList(self, page):
        parser = ParserFactory().make(page, self._config)
        parser.addCommand(NameHarvester(parser))
        parser.toHtml(page.content)

        result = [u""] + sorted(list(NameHarvester.counters))

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

示例5: setUp

    def setUp(self):
        self.encoding = "utf8"

        self.__createWiki()
        
        factory = ParserFactory()
        self.testPage = self.rootwiki[u"Страница 2"]
        self.parser = factory.make (self.testPage, Application.config)
开发者ID:s200999900,项目名称:outwiker,代码行数:8,代码来源:parsertex.py

示例6: setUp

    def setUp(self):
        self.__createWiki()

        dirlist = [u"../plugins/testwikicommand"]

        loader = PluginsLoader(Application)
        loader.load (dirlist)
        
        factory = ParserFactory()
        self.parser = factory.make (self.testPage, Application.config)
开发者ID:qyqx,项目名称:outwiker,代码行数:10,代码来源:testwikicommand.py

示例7: setUp

    def setUp(self):
        # Здесь будет создаваться вики
        self.path = mkdtemp(prefix='Абырвалг абыр')

        self.filesPath = "../test/samplefiles/"

        self.__createWiki()

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, Application.config)
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_parserformat.py

示例8: testExceptionCommand

    def testExceptionCommand (self):
        factory = ParserFactory ()
        factory.appendCommand (ExceptionCommand)

        parser = factory.make (self.testPage, Application.config)

        text = u"""(:exception:)"""

        result = parser.toHtml(text)
        # Исключение не должно бросаться, а должно быть выведено в результирующий текст
        self.assertTrue ("Exception" in result, result)
开发者ID:qyqx,项目名称:outwiker,代码行数:11,代码来源:wikicommands.py

示例9: setUp

    def setUp(self):
        self.encoding = "utf8"

        self.__createWiki()
        self.testPage = self.wikiroot[u"Страница 1"]

        factory = ParserFactory()
        self.parser = factory.make (self.testPage, Application.config)

        filesPath = u"../test/samplefiles/"
        self.files = [u"image.jpg", u"add.png", u"anchor.png", u"файл с пробелами.tmp", u"dir", u"for_sort"]
        self.fullFilesPath = [os.path.join (filesPath, fname) for fname in self.files]
开发者ID:LihMeh,项目名称:outwiker,代码行数:12,代码来源:wikicommandattachlist.py

示例10: setUp

    def setUp(self):
        self.encoding = "utf8"

        self.filesPath = u"../test/samplefiles/"

        self.pagelinks = [u"Страница 1", u"/Страница 1", u"/Страница 2/Страница 3"]
        self.pageComments = [u"Страницо 1", u"Страницо 1", u"Страницо 3"]

        self.__createWiki()

        factory = ParserFactory()
        self.__wikiconfig = WikiConfig (Application.config)
        self.__wikiconfig.thumbSizeOptions.value = WikiConfig.THUMB_SIZE_DEFAULT

        self.parser = factory.make (self.testPage, Application.config)
开发者ID:LihMeh,项目名称:outwiker,代码行数:15,代码来源:parserthumb.py

示例11: setUp

    def setUp(self):
        self.initApplication()

        self.filesPath = "../test/samplefiles/"
        self.__createWiki()

        self._config = GeneralGuiConfig(self.application.config)
        self._srcDateFormat = self._config.dateTimeFormat.value

        self.testPage = self.wikiroot["Страница 1"]
        self.testPage.creationdatetime = datetime(2014, 8, 20, 11, 59, 1)
        self.testPage.datetime = datetime(2015, 9, 21, 12, 10, 20)

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self.application.config)
开发者ID:Jenyay,项目名称:outwiker,代码行数:15,代码来源:test_wikicommanddates.py

示例12: setUp

    def setUp(self):
        self.__pluginname = u"Source"

        self.__createWiki()

        dirlist = [u"../plugins/source"]

        # Путь, где лежат примеры исходников в разных кодировках
        self.samplefilesPath = u"../test/samplefiles/sources"

        # Пример программы
        self.pythonSource = u'''import os

# Комментарий
def hello (count):
	"""
	Hello world
	"""
	for i in range (10):
		print "Hello world!!!"
'''

        self.loader = PluginsLoader(Application)
        self.loader.load (dirlist)

        self.config = self.loader[self.__pluginname].config
        self.config.tabWidth.value = 4
        self.config.defaultLanguage.remove_option()
        Application.config.remove_section (self.config.section)

        self.factory = ParserFactory()
        self.parser = self.factory.make (self.testPage, Application.config)
开发者ID:LihMeh,项目名称:outwiker,代码行数:32,代码来源:sourcestyle.py

示例13: WikiCounterCommandTest

class WikiCounterCommandTest (unittest.TestCase):
    def setUp(self):
        self.encoding = "utf8"

        self.filesPath = u"../test/samplefiles/"
        self.__createWiki()

        dirlist = [u"../plugins/testcounter"]

        self.loader = PluginsLoader(Application)
        self.loader.load (dirlist)
        
        self.factory = ParserFactory()
        self.parser = self.factory.make (self.testPage, Application.config)
    

    def __createWiki (self):
        # Здесь будет создаваться вики
        self.path = u"../test/testwiki"
        removeWiki (self.path)

        self.rootwiki = WikiDocument.create (self.path)

        WikiPageFactory.create (self.rootwiki, u"Страница 1", [])
        self.testPage = self.rootwiki[u"Страница 1"]
        

    def tearDown(self):
        removeWiki (self.path)


    def testPluginLoad (self):
        self.assertEqual ( len (self.loader), 1)


    def testCounter (self):
        text = u"(:counter:) (:counter:)"
        validResult = u"1 2"

        result = self.parser.toHtml (text)
        self.assertEqual (result, validResult)

        # Проверим, что для нового парсера счетчик сбрасывается
        parser2 = self.factory.make (self.testPage, Application.config)

        result2 = parser2.toHtml (text)
        self.assertEqual (result2, validResult)
开发者ID:qyqx,项目名称:outwiker,代码行数:47,代码来源:wikicommandcounter.py

示例14: __createWiki

    def __createWiki (self):
        # Здесь будет создаваться вики
        self.filesPath = u"../test/samplefiles/"

        self.wikiroot = WikiDocument.create (self.path)
        WikiPageFactory().create (self.wikiroot, u"Страница 2", [])
        self.testPage = self.wikiroot[u"Страница 2"]

        files = [u"accept.png", u"add.png", u"anchor.png", u"filename.tmp",
                 u"файл с пробелами.tmp", u"картинка с пробелами.png",
                 u"image.jpg", u"image.jpeg", u"image.png", u"image.tif", u"image.tiff", u"image.gif",
                 u"image_01.JPG", u"dir", u"dir.xxx", u"dir.png"]

        fullFilesPath = [os.path.join (self.filesPath, fname) for fname in files]

        # Прикрепим к двум страницам файлы
        Attachment (self.testPage).attach (fullFilesPath)

        factory = ParserFactory()
        self.parser = factory.make (self.testPage, Application.config)
开发者ID:theoden-dd,项目名称:outwiker,代码行数:20,代码来源:tokennames.py

示例15: setUp

    def setUp (self):
        self.filesPath = u"../test/samplefiles/"
        self.__createWiki()

        dirlist = [u"../plugins/texequation"]

        self.loader = PluginsLoader(Application)
        self.loader.load (dirlist)

        self.testPage = self.wikiroot[u"Страница 1"]
        self.parser = ParserFactory().make (self.testPage, Application.config)
开发者ID:LihMeh,项目名称:outwiker,代码行数:11,代码来源:texequation_test.py


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