예제 #1
0
    def test_one_child(self):
        from nose.exc import SkipTest
        raise SkipTest("""TODO no hierarchy yet""")
        g = explicit_navi.get_navigation("""\
==========
Navigation
==========

Title1
======
First text

Subtitle1
---------
More text
""")

        got = g.next()
        eq(
            got,
            dict(
                link='/title1',
                title='Title1',
                description='First text',
                children=[
                    dict(
                        link='/title1/subtitle1',
                        title='Subtitle1',
                        description='More text',
                        ),
                    ],
                ),
            )
        assert_raises(StopIteration, g.next)
예제 #2
0
    def test_one(self):
        g = explicit_navi.get_navigation("""\
==========
Navigation
==========

Title1
======
First text
""")

        got = g.next()
        eq(
            got,
            dict(
                link='/title1',
                title='Title1',
                description='First text',
                ),
            )
        assert_raises(StopIteration, g.next)
예제 #3
0
    def test_link_multiple(self):
        g = explicit_navi.get_navigation("""\
==========
Navigation
==========

Title1
======
:link: foo

First text

Title2
======
:link: bar

Second text
""")

        got = g.next()
        eq(
            got,
            dict(
                link='/foo',
                title='Title1',
                description='First text',
                ),
            )
        got = g.next()
        eq(
            got,
            dict(
                link='/bar',
                title='Title2',
                description='Second text',
                ),
            )
        assert_raises(StopIteration, g.next)
예제 #4
0
파일: tree.py 프로젝트: mchubby/roast
        self.config = cfg

    def _read_navigation(self):
        try:
            f = file(os.path.join(self.root, '_navigation.rst'))
        except IOError, e:
            if e.errno == errno.ENOENT:
                return []
            else:
                raise
        else:
            try:
                text = f.read()
            finally:
                f.close()
            return explicit_navi.get_navigation(text=text)

    def export(self, destination):
        def safe_names(names):
            return (
                name
                for name in names
                if not (name.startswith('.')
                        or name.startswith('_')
                        or name.startswith('#')
                        )
                and not name.endswith('~')
                )

        def list_input_files(path):
            for dirpath, dirnames, filenames in os.walk(self.path):