| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Ramesses II 11.11.2002 21:43
Я все о ТИПОГРАФе...@text_refine[text]
$text[^text.match[ *][g]{ }]
$text[^text.match[\s\n][g]{
}]
$text[^text.match[&][g]{&^;amp^;}]
$text[^text.match[ ][g]{&^;nbsp^;}]
$text[^text.match[ —][g]{&^;nbsp^;&^;#151^;}]
$text[^text.match[--][g]{&^;#151^;}]
$text[^text.match[ ][g]{&^;nbsp^;}]
$text[^text.match[<][g]{&^;lt^;}]
$text[^text.match[>][g]{&^;gt^;}]
$text[^text.match[«][g]{&^;#0171^;}]
$text[^text.match[»][g]{&^;#0187^;}]
$text[^text.match[\“][g]{&^;#0147^;}]
$text[^text.match[\”][g]{&^;#0148^;}]
# расстановка параграфов
$text[^text.match[\A][g]{<^;P>^;${match.1}}]
$text[^text.match[\n][g]{<^;/P>^;
${match.1}<^;P>^;}]
$text[^text.match[\z][g]{${match.1}<^;/P>^;}]
$text[^text.match[ '][g]{ &^;#145^;}]
$text[^text.match['][g]{&^;#146^;}]
$text[^text.match[([ёЁа-яА-Яa-zA-Z_]+-[ёЁа-яА-Яa-zA-Z_]+)][g]{<^;NOBR>^;${match.1}<^;/NOBR>^;}]
# NBSP в сочетаниях т. д., т. п., ж. д., и. о., ...
$text[^text.match[((\s|\A)[Тт|Ии|Жж]\.) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
# союзы и частицы, инициалы, сокращение "тов."
$text[^text.match[((\s|\A)[Оо](|б|т)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Вв]) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Тт]ов\.) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[А-Я]\.) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
# инициалы Дж. и Ph.
$text[^text.match[((\s|\A)[A-ZА-Я]+[a-zа-я]\.) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Сс](|о)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Ии]) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Ии]ли) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Ии]з) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Нн](а|ад)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Пп](од|еред)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Нн](и|е)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Зз]а) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
$text[^text.match[((\s|\A)[Кк](|о)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]
# сокращение г. (год)
$text[^text.match[ ([г]\.)][g]{&^;nbsp^;${match.1}}]
# выдача текста обратно
$tttexttt[$text]Но все это слишком громоздко получается...$text[^text.match[((\s|\A)[Нн](и|е|а|ад)) ][g]{${match.1}&^;nbsp^;${match.postmatch}}]Но вся загвоздка в том, что в результате выдает: ни на фиг ты мне не нужен, ни&nsp;куда еще...потому как первый результат формата убирает пробел и распознавать надо не только начало всего текста (\A) или слова (\s), но и точку с запятой (как конец )...