mod: minor .

This commit is contained in:
2025-05-13 00:46:36 +03:00
parent 8b0efa26eb
commit f48dd5bb53
5 changed files with 47 additions and 31 deletions

14
main.py
View File

@@ -4,6 +4,9 @@ import etpgrf
if __name__ == '__main__':
# --- Пример использования ---
print("\n--- Пример использования класса---\n")
etpgrf.config.DEFAULT_HYP_MAX_LEN = 6
# Определяем пользовательские правила переносов
hyphen_settings = etpgrf.Hyphenator(langs='ru', max_unhyphenated_len=8)
# Определяем пользовательские правила типографа
@@ -14,13 +17,14 @@ if __name__ == '__main__':
print(result, "\n\n")
hyphen_settings2 = etpgrf.Hyphenator(langs='en', max_unhyphenated_len=8)
result = hyphen_settings2.hyp_in_text("frozenseter")
result = hyphen_settings2.hyp_in_text("floccinaucinihilipilification")
print(result, "\n\n")
typo = etpgrf.Typographer(langs='ru', mode='mnemonic', hyphenation_rule=hyphen_settings)
result = typo.process(text="Какой-то длинный текст для проверки переносов. Перпердикюляция!")
typo_ru = etpgrf.Typographer(langs='ru', mode='mixed', hyphenation=hyphen_settings)
result = typo_ru.process(text="Какой-то длинный текст для проверки переносов. Перпердикюляция!")
print(result, "\n\n")
result = typo.process(text="Привет, frozenseter! Это <i>тестовый текст для проверки расстановки</i> переносов"
typo_ru_en = etpgrf.Typographer(langs='ru-en', mode='mixed', hyphenation=True)
result = typo_ru_en.process(text="Расприветище, floccinaucinihilipilification. Это <i>тестовый текст для проверки расстановки</i> переносов"
" в словах. Миллион 100-метровошеих жирножирафов.")
print(result, "\n\n")
@@ -29,5 +33,5 @@ if __name__ == '__main__':
" чувствовать себя собой. <b>Мы&nbsp;не&nbsp;шьём одина&shy;ковые пальто. Мы шьём ваше. </b> Ниже&nbsp;—"
" как устроен процесс заказа.</p>")
result = typo.process(text=txt)
result = typo_ru.process(text=txt)
print(result, "\n\n")