Loading opds_catalog/utils.py +2 −8 Original line number Diff line number Diff line Loading @@ -9,13 +9,7 @@ def translit(s): table1 = str.maketrans("абвгдеёзийклмнопрстуфхъыьэАБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЬЭ", "abvgdeezijklmnoprstufh'y'eABVGDEEZIJKLMNOPRSTUFH'Y'E") table2 = {'ж':'zh','ц':'ts','ч':'ch','ш':'sh','щ':'sch','ю':'ju','я':'ja', 'Ж':'Zh','Ц':'Ts','Ч':'Ch','Ш':'Sh','Щ':'Sch','Ю':'Ju','Я':'Ja', '«':'', '»':'','"':'','\n':'_',' ':'_',"'":"",':':'_','№':'N'} s = s.translate(table1) for k in table2.keys(): s = s.replace(k,table2[k]) return s.translate(table1) def badsym(s): """Replace special web-symbols""" result = s table = {' ':'_', "'":"", '"':'', '№':'N'} for k in table.keys(): result = result.replace(k,table[k]) return result; No newline at end of file return s No newline at end of file Loading
opds_catalog/utils.py +2 −8 Original line number Diff line number Diff line Loading @@ -9,13 +9,7 @@ def translit(s): table1 = str.maketrans("абвгдеёзийклмнопрстуфхъыьэАБВГДЕЁЗИЙКЛМНОПРСТУФХЪЫЬЭ", "abvgdeezijklmnoprstufh'y'eABVGDEEZIJKLMNOPRSTUFH'Y'E") table2 = {'ж':'zh','ц':'ts','ч':'ch','ш':'sh','щ':'sch','ю':'ju','я':'ja', 'Ж':'Zh','Ц':'Ts','Ч':'Ch','Ш':'Sh','Щ':'Sch','Ю':'Ju','Я':'Ja', '«':'', '»':'','"':'','\n':'_',' ':'_',"'":"",':':'_','№':'N'} s = s.translate(table1) for k in table2.keys(): s = s.replace(k,table2[k]) return s.translate(table1) def badsym(s): """Replace special web-symbols""" result = s table = {' ':'_', "'":"", '"':'', '№':'N'} for k in table.keys(): result = result.replace(k,table[k]) return result; No newline at end of file return s No newline at end of file