コード例 #1
0
ファイル: test_xmlmodel.py プロジェクト: hongry18/pyhwp
    def test_issue144_fields_crossing_lineseg_boundary(self):
        from hwp5 import xmlmodel
        from hwp5 import treeop
        from fixtures import get_fixture_path
        from pprint import pprint
        pprint

        name = 'issue144-fields-crossing-lineseg-boundary.hwp'
        path = get_fixture_path(name)
        hwp5file = xmlmodel.Hwp5File(path)
        xmlevents = hwp5file.bodytext.xmlevents()
        #pprint(list(enumerate(xmlevents)))

        stack_fields = []
        for ev, model in xmlevents:

            if ev is treeop.STARTEVENT:
                tag = model[0]
            else:
                tag = model

            if tag.startswith('Field'):
                if ev is treeop.STARTEVENT:
                    stack_fields.append(model)
                else:
                    stack_fields.pop()
            elif tag == 'LineSeg':
                # NO CROSSING
                if ev is treeop.STARTEVENT:
                    assert len(stack_fields) == 0
                else:
                    assert len(stack_fields) == 0
コード例 #2
0
    def test_issue144_fields_crossing_lineseg_boundary(self):
        from hwp5 import xmlmodel
        from hwp5 import treeop
        from fixtures import get_fixture_path
        from pprint import pprint
        pprint

        name = 'issue144-fields-crossing-lineseg-boundary.hwp'
        path = get_fixture_path(name)
        hwp5file = xmlmodel.Hwp5File(path)
        xmlevents = hwp5file.bodytext.xmlevents()
        #pprint(list(enumerate(xmlevents)))

        stack_fields = []
        for ev, model in xmlevents:

            if ev is treeop.STARTEVENT:
                tag = model[0]
            else:
                tag = model

            if tag.startswith('Field'):
                if ev is treeop.STARTEVENT:
                    stack_fields.append(model)
                else:
                    stack_fields.pop()
            elif tag == 'LineSeg':
                # NO CROSSING
                if ev is treeop.STARTEVENT:
                    assert len(stack_fields) == 0
                else:
                    assert len(stack_fields) == 0
コード例 #3
0
ファイル: test_binmodel.py プロジェクト: hongry18/pyhwp
    def test_footnote_shape(self):
        from fixtures import get_fixture_path
        from hwp5.binmodel import Hwp5File
        path = get_fixture_path('footnote-endnote.hwp')
        hwp5file = Hwp5File(path)

        models = hwp5file.bodytext.section(0).models()
        models = list(models)
        fnshape = models[6]
        self.assertEquals(850, fnshape['content']['splitter_margin_top'])
        self.assertEquals(567, fnshape['content']['splitter_margin_bottom'])
コード例 #4
0
    def test_footnote_shape(self):
        from fixtures import get_fixture_path
        from hwp5.binmodel import Hwp5File
        path = get_fixture_path('footnote-endnote.hwp')
        hwp5file = Hwp5File(path)

        models = hwp5file.bodytext.section(0).models()
        models = list(models)
        fnshape = models[6]
        self.assertEquals(850, fnshape['content']['splitter_margin_top'])
        self.assertEquals(567, fnshape['content']['splitter_margin_bottom'])
コード例 #5
0
ファイル: test_xmlmodel.py プロジェクト: hanul93/pyhwp
    def test_match_field_start_end(self):
        from hwp5 import binmodel, xmlmodel
        from fixtures import get_fixture_path

        path = get_fixture_path('match-field-start-end.dat')
        import pickle
        f = open(path, 'r')
        try:
            records = pickle.load(f)
        finally:
            f.close()

        models = binmodel.parse_models(dict(), records)
        events = xmlmodel.prefix_binmodels_with_event(dict(), models)
        events = xmlmodel.make_texts_linesegmented_and_charshaped(events)
        events = xmlmodel.make_extended_controls_inline(events)
        events = xmlmodel.match_field_start_end(events)
        events = list(events)
コード例 #6
0
    def test_match_field_start_end(self):
        from hwp5 import binmodel, xmlmodel
        from fixtures import get_fixture_path

        path = get_fixture_path('match-field-start-end.dat')
        import pickle
        f = open(path, 'r')
        try:
            records = pickle.load(f)
        finally:
            f.close()

        models = binmodel.parse_models(dict(), records)
        events = xmlmodel.prefix_binmodels_with_event(dict(), models)
        events = xmlmodel.make_texts_linesegmented_and_charshaped(events)
        events = xmlmodel.make_extended_controls_inline(events)
        events = xmlmodel.match_field_start_end(events)
        events = list(events)
コード例 #7
0
ファイル: test_odtxsl.py プロジェクト: idkwim/pyhwp
def example(filename):
    from fixtures import get_fixture_path
    from hwp5.xmlmodel import Hwp5File
    path = get_fixture_path(filename)
    return Hwp5File(path)
コード例 #8
0
ファイル: mixin_olestg.py プロジェクト: hongry18/pyhwp
 def get_fixture_file(self, filename):
     from fixtures import get_fixture_path
     return get_fixture_path(filename)
コード例 #9
0
ファイル: test_odtxsl.py プロジェクト: sececter/pyhwp
def example(filename):
    from fixtures import get_fixture_path
    from hwp5.xmlmodel import Hwp5File
    path = get_fixture_path(filename)
    return Hwp5File(path)
コード例 #10
0
def example_path(filename):
    from fixtures import get_fixture_path
    return get_fixture_path(filename)
コード例 #11
0
ファイル: test_ole.py プロジェクト: yarang/pyhwp
 def get_fixture_file(self, filename):
     from fixtures import get_fixture_path
     return get_fixture_path(filename)
コード例 #12
0
ファイル: test_odtxsl.py プロジェクト: hongry18/pyhwp
def example_path(filename):
    from fixtures import get_fixture_path
    return get_fixture_path(filename)