|
| 1 | +diff --git a/ocrd_models/ocrd_models/ocrd_page_generateds.py b/ocrd_models/ocrd_models/ocrd_page_generateds.py |
| 2 | +index 98111b0c..2ad8e9e4 100644 |
| 3 | +--- a/ocrd_models/ocrd_models/ocrd_page_generateds.py |
| 4 | ++++ b/ocrd_models/ocrd_models/ocrd_page_generateds.py |
| 5 | +@@ -27,6 +27,7 @@ |
| 6 | + from six.moves import zip_longest |
| 7 | + import os |
| 8 | + import sys |
| 9 | ++import copy |
| 10 | + import re as re_ |
| 11 | + import base64 |
| 12 | + import datetime as datetime_ |
| 13 | +@@ -3944,27 +3945,27 @@ class TextLineType(GeneratedsSuper): |
| 14 | + if value is not None and 'id' not in already_processed: |
| 15 | + already_processed.add('id') |
| 16 | + self.id = value |
| 17 | +- value = find_attr_value_('primaryLanguage', node) |
| 18 | ++ value = find_attr_value_('primaryLanguage', node) or self.parent_object_.primaryLanguage |
| 19 | + if value is not None and 'primaryLanguage' not in already_processed: |
| 20 | + already_processed.add('primaryLanguage') |
| 21 | + self.primaryLanguage = value |
| 22 | + self.validate_LanguageSimpleType(self.primaryLanguage) # validate type LanguageSimpleType |
| 23 | +- value = find_attr_value_('primaryScript', node) |
| 24 | ++ value = find_attr_value_('primaryScript', node) or self.parent_object_.primaryScript |
| 25 | + if value is not None and 'primaryScript' not in already_processed: |
| 26 | + already_processed.add('primaryScript') |
| 27 | + self.primaryScript = value |
| 28 | + self.validate_ScriptSimpleType(self.primaryScript) # validate type ScriptSimpleType |
| 29 | +- value = find_attr_value_('secondaryScript', node) |
| 30 | ++ value = find_attr_value_('secondaryScript', node) or self.parent_object_.secondaryScript |
| 31 | + if value is not None and 'secondaryScript' not in already_processed: |
| 32 | + already_processed.add('secondaryScript') |
| 33 | + self.secondaryScript = value |
| 34 | + self.validate_ScriptSimpleType(self.secondaryScript) # validate type ScriptSimpleType |
| 35 | +- value = find_attr_value_('readingDirection', node) |
| 36 | ++ value = find_attr_value_('readingDirection', node) or self.parent_object_.readingDirection |
| 37 | + if value is not None and 'readingDirection' not in already_processed: |
| 38 | + already_processed.add('readingDirection') |
| 39 | + self.readingDirection = value |
| 40 | + self.validate_ReadingDirectionSimpleType(self.readingDirection) # validate type ReadingDirectionSimpleType |
| 41 | +- value = find_attr_value_('production', node) |
| 42 | ++ value = find_attr_value_('production', node) or self.parent_object_.production |
| 43 | + if value is not None and 'production' not in already_processed: |
| 44 | + already_processed.add('production') |
| 45 | + self.production = value |
| 46 | +@@ -4453,27 +4454,27 @@ class WordType(GeneratedsSuper): |
| 47 | + if value is not None and 'id' not in already_processed: |
| 48 | + already_processed.add('id') |
| 49 | + self.id = value |
| 50 | +- value = find_attr_value_('language', node) |
| 51 | ++ value = find_attr_value_('language', node) or self.parent_object_.primaryLanguage |
| 52 | + if value is not None and 'language' not in already_processed: |
| 53 | + already_processed.add('language') |
| 54 | + self.language = value |
| 55 | + self.validate_LanguageSimpleType(self.language) # validate type LanguageSimpleType |
| 56 | +- value = find_attr_value_('primaryScript', node) |
| 57 | ++ value = find_attr_value_('primaryScript', node) or self.parent_object_.primaryScript |
| 58 | + if value is not None and 'primaryScript' not in already_processed: |
| 59 | + already_processed.add('primaryScript') |
| 60 | + self.primaryScript = value |
| 61 | + self.validate_ScriptSimpleType(self.primaryScript) # validate type ScriptSimpleType |
| 62 | +- value = find_attr_value_('secondaryScript', node) |
| 63 | ++ value = find_attr_value_('secondaryScript', node) or self.parent_object_.secondaryScript |
| 64 | + if value is not None and 'secondaryScript' not in already_processed: |
| 65 | + already_processed.add('secondaryScript') |
| 66 | + self.secondaryScript = value |
| 67 | + self.validate_ScriptSimpleType(self.secondaryScript) # validate type ScriptSimpleType |
| 68 | +- value = find_attr_value_('readingDirection', node) |
| 69 | ++ value = find_attr_value_('readingDirection', node) or self.parent_object_.readingDirection |
| 70 | + if value is not None and 'readingDirection' not in already_processed: |
| 71 | + already_processed.add('readingDirection') |
| 72 | + self.readingDirection = value |
| 73 | + self.validate_ReadingDirectionSimpleType(self.readingDirection) # validate type ReadingDirectionSimpleType |
| 74 | +- value = find_attr_value_('production', node) |
| 75 | ++ value = find_attr_value_('production', node) or self.parent_object_.production |
| 76 | + if value is not None and 'production' not in already_processed: |
| 77 | + already_processed.add('production') |
| 78 | + self.production = value |
| 79 | +@@ -4920,12 +4921,12 @@ class GlyphType(GeneratedsSuper): |
| 80 | + self.symbol = False |
| 81 | + else: |
| 82 | + raise_parse_error(node, 'Bad boolean attribute') |
| 83 | +- value = find_attr_value_('script', node) |
| 84 | ++ value = find_attr_value_('script', node) or self.parent_object_.primaryScript |
| 85 | + if value is not None and 'script' not in already_processed: |
| 86 | + already_processed.add('script') |
| 87 | + self.script = value |
| 88 | + self.validate_ScriptSimpleType(self.script) # validate type ScriptSimpleType |
| 89 | +- value = find_attr_value_('production', node) |
| 90 | ++ value = find_attr_value_('production', node) or self.parent_object_.production |
| 91 | + if value is not None and 'production' not in already_processed: |
| 92 | + already_processed.add('production') |
| 93 | + self.production = value |
| 94 | +@@ -14332,6 +14333,22 @@ class TextRegionType(RegionType): |
| 95 | + for child in node: |
| 96 | + nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] |
| 97 | + self.buildChildren(child, node, nodeName_, gds_collector_=gds_collector_) |
| 98 | ++ if not self.TextStyle and self.parent_object_.TextStyle: |
| 99 | ++ self.TextStyle = copy.copy(self.parent_object_.TextStyle) |
| 100 | ++ self.TextStyle.parent_object_ = self |
| 101 | ++ if self.TextStyle: |
| 102 | ++ for line in self.TextLine: |
| 103 | ++ if not line.TextStyle: |
| 104 | ++ line.TextStyle = copy.copy(self.TextStyle) |
| 105 | ++ line.TextStyle.parent_object_ = line |
| 106 | ++ for word in line.Word: |
| 107 | ++ if not word.TextStyle: |
| 108 | ++ word.TextStyle = copy.copy(self.TextStyle) |
| 109 | ++ word.TextStyle.parent_object_ = word |
| 110 | ++ for glyph in word.Glyph: |
| 111 | ++ if not glyph.TextStyle: |
| 112 | ++ glyph.TextStyle = copy.copy(self.TextStyle) |
| 113 | ++ glyph.TextStyle.parent_object_ = glyph |
| 114 | + return self |
| 115 | + def buildAttributes(self, node, attrs, already_processed): |
| 116 | + value = find_attr_value_('orientation', node) |
| 117 | +@@ -14348,12 +14365,12 @@ class TextRegionType(RegionType): |
| 118 | + if value is not None and 'leading' not in already_processed: |
| 119 | + already_processed.add('leading') |
| 120 | + self.leading = self.gds_parse_integer(value, node, 'leading') |
| 121 | +- value = find_attr_value_('readingDirection', node) |
| 122 | ++ value = find_attr_value_('readingDirection', node) or self.parent_object_.readingDirection |
| 123 | + if value is not None and 'readingDirection' not in already_processed: |
| 124 | + already_processed.add('readingDirection') |
| 125 | + self.readingDirection = value |
| 126 | + self.validate_ReadingDirectionSimpleType(self.readingDirection) # validate type ReadingDirectionSimpleType |
| 127 | +- value = find_attr_value_('textLineOrder', node) |
| 128 | ++ value = find_attr_value_('textLineOrder', node) or self.parent_object_.textLineOrder |
| 129 | + if value is not None and 'textLineOrder' not in already_processed: |
| 130 | + already_processed.add('textLineOrder') |
| 131 | + self.textLineOrder = value |
| 132 | +@@ -14377,22 +14394,22 @@ class TextRegionType(RegionType): |
| 133 | + already_processed.add('align') |
| 134 | + self.align = value |
| 135 | + self.validate_AlignSimpleType(self.align) # validate type AlignSimpleType |
| 136 | +- value = find_attr_value_('primaryLanguage', node) |
| 137 | ++ value = find_attr_value_('primaryLanguage', node) or self.parent_object_.primaryLanguage |
| 138 | + if value is not None and 'primaryLanguage' not in already_processed: |
| 139 | + already_processed.add('primaryLanguage') |
| 140 | + self.primaryLanguage = value |
| 141 | + self.validate_LanguageSimpleType(self.primaryLanguage) # validate type LanguageSimpleType |
| 142 | +- value = find_attr_value_('secondaryLanguage', node) |
| 143 | ++ value = find_attr_value_('secondaryLanguage', node) or self.parent_object_.secondaryLanguage |
| 144 | + if value is not None and 'secondaryLanguage' not in already_processed: |
| 145 | + already_processed.add('secondaryLanguage') |
| 146 | + self.secondaryLanguage = value |
| 147 | + self.validate_LanguageSimpleType(self.secondaryLanguage) # validate type LanguageSimpleType |
| 148 | +- value = find_attr_value_('primaryScript', node) |
| 149 | ++ value = find_attr_value_('primaryScript', node) or self.parent_object_.primaryScript |
| 150 | + if value is not None and 'primaryScript' not in already_processed: |
| 151 | + already_processed.add('primaryScript') |
| 152 | + self.primaryScript = value |
| 153 | + self.validate_ScriptSimpleType(self.primaryScript) # validate type ScriptSimpleType |
| 154 | +- value = find_attr_value_('secondaryScript', node) |
| 155 | ++ value = find_attr_value_('secondaryScript', node) or self.parent_object_.secondaryScript |
| 156 | + if value is not None and 'secondaryScript' not in already_processed: |
| 157 | + already_processed.add('secondaryScript') |
| 158 | + self.secondaryScript = value |
0 commit comments