@borkena · Post #5194 · 05.11.2025 г., 05:47
Ethiopian Defense Chief Of Staff Threatens Military Action Against TPLF. Read. https://borkena.com/2025/11/05/ethiopian-defense-chief-of-staff-threatens-military-action-against-tplf/#Ethiopia#TPLF#news
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #121 · 20 јул.
Регулярно требуется преобразовать какой-либо текст в максимально совместимый текст для URL, имени файла, имени объекта в каком-то софте и тд. Требования совместимости простые: в тексте должны быть только допустимые символы. Обычно это a-z, 0-9 и "_" или "-". То есть, только прописные буквы латинского алфавита и цифры (как пример). Допустим, нам нужно название статьи в блоге преобразовать в slug для добавления его в URL этой статьи. Как это лучше всего сделать? В Django по умолчанию есть готовая функция slugify для таких случаев. Но я её никогда не использую. Почему? Потому что её недостаточно! Приведём пример >>> from django.utils.text import slugify >>> slugify('This is a Title') 'this-is-a-title' Пока всё отлично >>> slugify('This is a "Title!"') 'this-is-a-title' Спец символы удалились, всё хорошо. >>> slugify('Это заголовок статьи') '' Вот и приехали 😢. Если текст не английский то буквы просто игнорируются. Можно это поправить >>> slugify('Это заголовок статьи', allow_unicode=True) 'это-заголовок-статьи' Но тогда мы не вписываемся в условие. У нас появилась кириллица в тексте. Так как я часто пишу сайты для русскоязычных пользователей эта проблема весьма актуальна. Я не использую стандартную функцию и всегда пишу свою. Оригинал я не беру в расчёт и пишу полностью свою функцию. И так, по порядку: 🔸1. Исходный текст: >>> text = 'Мой заголовок №10 😁!' Взял специально посложней со специальными символами. 🔸2. Транслит Необходимо сделать транслит всех символов в латиницу. Здесь очень выручает библиотека unidecode. Помимо простого транслита кириллицы в латиницу она умеет преобразовывать спец символы и иероглифы в текстовые аналоги. from unidecode import unidecode >>> unidecode("Ñ Σ ® µ ¶ ¼ 月 山") 'N S (r) u P 1/4 Yue Shan' Очень крутая библиотека, советую👍 В нашем случае получаем такое преобразование: >>> text = unidecode(text) >>> print(text) 'Moi zagolovok No. 10 !' Отличный транслит. Смайл просто удалился, хотя я ждал что-то вроде :). Ну и ладно, всë равно невалидные символы. А еще наш код уже поддерживает любой язык, будь то хинди или корейский. 🔸4. Фильтр символов Unidecode не занимается фильтрацией по недопустимым символам. Это мы делаем в следующем шаге через regex. Просто заменим все символы на "_" если они вне указанного диапазона. >>> text = re.sub(r'[^a-zA-Z0-9]+', '_', text) >>> print(text) 'Moi_zagolovok_No_10_' Символ "+" в паттерне выручает когда несколько недопустимых символов идут рядом. Все они заменяются на один символ "_". 🔸5. Slugify Осталось удалить лишние символы по краям и сделать нижний регистр >>> text = text.strip('_').lower() >>> print(text) 'moi_zagolovok_no_10' Получаем отличный slug! 😎 🌎 Полный код в виде функции. ______________ PS. Проверку что в строке остался хоть один допустимый символ я бы вынес в отдельную функцию. #libs#tricks#django
Пребарај: #tplf
@borkena · Post #5194 · 05.11.2025 г., 05:47
Ethiopian Defense Chief Of Staff Threatens Military Action Against TPLF. Read. https://borkena.com/2025/11/05/ethiopian-defense-chief-of-staff-threatens-military-action-against-tplf/#Ethiopia#TPLF#news
@addisstandardeng · Post #21267 · 31.01.2026 г., 18:15
#TPLF welcomes #AU call for restraint, reaffirms commitment to dialogue The Tigray People’s Liberation Front (TPLF) has welcomed a call by the Chairperson of the African Union Commission, Mahmoud Ali Youssouf, urging restraint amid renewed tensions in Ethiopia’s Tigray region, reaffirming that dialogue remains the only viable path to resolving outstanding issues with the federal government. In a letter sent late on Saturday and addressed to the AU Commission Chairperson, the TPLF said it appreciates the African Union’s engagement in support of peace and stability in Ethiopia, noting that it takes “positive note” of the AU’s concern over recent developments in Tigray. The party further expressed its readiness to engage constructively in any dialogue initiative facilitated by the African Union, including through the AU High-Level Panel on Ethiopia, aimed at advancing “peace, confidence-building, and reconciliation.” https://addisstandard.com/tplf-welcomes-au-call-for-restraint-reaffirms-commitment-to-dialogue/
@borkena · Post #6200 · 22.04.2026 г., 05:10
Interim Administration Responds To TPLF Move To Take Power by Force. Read more. https://borkena.com/2026/04/21/tigray-interim-administration-responds-to-tplf-move-to-take-power-by-force/#Ethiopia#news#Tigray#TPLF
@borkena · Post #6176 · 17.04.2026 г., 23:04
ህወሓት ደብረጽዮን ገብረሚካኤል ክልሉን እንዲያስተዳድሩ ወሰነ https://shorturl.at/417qY#Ethiopia#News#TPLF#Tigray
@borkena · Post #5807 · 19.02.2026 г., 14:11
Three senior TPLF Military Commanders Reportedly arrive in Addis Ababa. Read more. https://borkena.com/2026/02/19/ethiopia-three-senior-tplf-military-commanders-reportedly-arrive-in-addis-ababa/#Ethiopia#news#TPLF#Tigray
@borkena · Post #5596 · 21.12.2025 г., 16:41
Tigray Interim Administration President To Meet Federal Authorities in Addis Ababa. Read. https://borkena.com/2025/12/21/tigray-interim-administration-president-to-meet-federal-authorities-in-addis-ababa/#Ethiopia#News#TPLF#Tigray
@borkena · Post #5822 · 21.02.2026 г., 13:24
To Prime Minister Abiy Ahmed: A Peaceful Path Forward in Tigray. Read more. ard in Tigray https://borkena.com/2026/02/21/ethiopia-to-prime-minister-abiy-ahmed-a-peaceful-path-forward-in-tigray/#Ethiopia#TPLF#AbiyAhmed
Hashtags
@addisstandardeng · Post #21623 · 05.03.2026 г., 15:34
News: #Tigray rebels say #Ethiopian troops preparing for war Ethiopian federal authorities are preparing "to wage a war against Tigray," a senior official from this northern regional state told AFP on Wednesday, raising fears of a new conflict. Tigray emerged in 2022 from a two-year war that saw federal forces, backed by militias and the Eritrean army, clash with rebels from the Tigray People's Liberation Front (#TPLF). The TPLF dominated Ethiopian politics for some 30 years before current Prime Minister Abiy Ahmed, a non-Tigrayan, took power in 2018. At least 600,000 people were killed in the conflict, according to estimates from the African Union. A ceasefire held for more than two years, but clashes between federal and Tigrayan forces broke out again in November 2025 and January 2026. Large numbers of federal troops have for several weeks been massed at the Tigray border, where.... https://web.facebook.com/AddisstandardEng/posts/pfbid023a9Gk4wS4Zc9q1exiF73ypsGSrQ1ubLT6Pg7Hv5gRNoJDmMEsv8KpNyvcM73Nq8il
Hashtags
@borkena · Post #6238 · 30.04.2026 г., 16:43
The rump TPLF’s Beating of War Drums. Read. https://borkena.com/2026/04/30/ethiopia-the-rump-tplfs-beating-of-war-drums/#Ethiopia#Politics#TPLF#Tigray@reda_getachew
@borkena · Post #5214 · 08.11.2025 г., 03:01
TPLF Alleges Federal Gov’t “Carried Out Drone Strike on Tigray Forces” Read more. https://borkena.com/2025/11/07/tplf-alleges-federal-govt-carried-out-drone-strike-on-tigray-forces/#Ethiopia#TPLF#Afar
@addisstandardeng · Post #21794 · 21.03.2026 г., 10:17
#Op_ed: Ghosts of Governance: Opposition paralysis, failure of political imagination in post-war #Tigray The most dangerous moment for a post-war society is when paralysis becomes normal, “a condition that has gripped Tigray for too long,” writes Getachew Gebrekiros Temare. He argues, “War destroyed infrastructure, displaced millions, and shattered institutions,” yet the deeper crisis remains political. Factionalism within the #TPLF and fragmentation among opposition parties have left society without coherent leadership. Opposition rhetoric often functions as controlled dissent rather than driving meaningful change. He notes, “The cumulative consequences of fragmentation, pseudo-analysis, and political hesitation are now impossible to ignore.” Getachew emphasizes that the solution requires “the emergence of a political movement grounded in public interest rather than personal ambition.” https://addisstandard.com/?p=55998
@borkena · Post #6230 · 29.04.2026 г., 12:20
TPLF Demands Tadesse Worede To Hand Over Power. Read more. https://borkena.com/2026/04/29/ethiopia-tplf-demands-tadesse-worede-to-hand-over-power/#Ethiopia#news#TPLF#EthiopianNews#Tigray
Hashtags