@@ -87,11 +87,13 @@ def check(self):
8787 '''
8888 return answer (False , result_str )
8989
90- def search_references_in_table (self , index_table : int , prev_ref , array_of_references , ref_sequence ) -> int :
91- """Функция поиска ссылок в таблицах (ищет в каждой клетке)"""
92- for cell in self .file .file .tables [index_table ]._cells :
93- prev_ref = self .search_references_in_text (cell .text , prev_ref , array_of_references , ref_sequence )
94- return prev_ref
90+ def get_text_in_table (self , index_table : int ) -> str :
91+ """Функция получения всего текста из таблицы"""
92+ text = ''
93+ for cell in self .file .tables [index_table ]._cells :
94+ if cell .text .strip ():
95+ text += cell .text .strip ()
96+ return text
9597
9698 def search_references_in_text (self , text : str , prev_ref , array_of_references , ref_sequence ) -> int :
9799 """Функция поиска ссылок в переданном тексте"""
@@ -114,16 +116,19 @@ def search_references(self, start_par):
114116 prev_ref = 0
115117 ref_sequence = []
116118 array_of_references = set ()
119+ text = ''
117120 for i in range (0 , start_par ):
118- text = self .file .paragraphs [i ] if isinstance (self .file .paragraphs [i ], str ) else self .file .paragraphs [i ].paragraph_text
119- match = re .search (r'Таблица ([.\d]+)' , text )
121+ paragraph_text = self .file .paragraphs [i ] if isinstance (self .file .paragraphs [i ], str ) else self .file .paragraphs [i ].paragraph_text
122+ match = re .search (r'Таблица ([.\d]+)' , paragraph_text )
123+ table_text = ''
120124 if match :
121125 index_table = int (match .group (1 )) - 1
122- prev_ref = self .search_references_in_table (index_table , prev_ref , array_of_references , ref_sequence )
123- text = None
126+ table_text = self .get_text_in_table (index_table )
127+
128+ paragraph_text += table_text
129+ text += paragraph_text
124130
125- if text is not None :
126- prev_ref = self .search_references_in_text (text , prev_ref , array_of_references , ref_sequence )
131+ prev_ref = self .search_references_in_text (text , prev_ref , array_of_references , ref_sequence )
127132
128133 if ref_sequence :
129134 if ref_sequence [0 ][1 ] == '0' :
0 commit comments