Emacs для начинающих

Структурирование текста


В главе "Настройка переменных редактора Emacs" говорилось о том, что переменная sgml-indent-step позволяет осуществлять автоматическое структурирование тэгов PSGML, путем смещения вложенных элементов на требуемое количество символов вправо. В Emacs существует команда, которая в режиме PSGML выравнивает тэги. Это команда indent-region, соответствующая комбинация клавиш - M-C-\.

Рассмотрим пример. Ниже приводится текст, в котором структурирование выполнено случайным образом.

<sect2> <title>A Bosom Friend</title> <para>We then turned over the book together, and I endeavored to explain to him the purpose of the printing, and the meaning of the few pictures that were in it.</para> <figure> <title>A Sample Figure</title> <graphic fileref="giftest.gif" format="gif"></graphic> </figure> <para>Thus I soon engaged his interest; and from that we went to jabbering the best we could about the various outer sights to be seen in this famous town.</para>

Выделите данный текст как блок и нажмите M-C-\. PSGML обработает выделенный фрагмент, сделав структуру элементов более понятной:

<sect2> <title>A Bosom Friend</title> <para>We then turned over the book together, and I endeavored to explain to him the purpose of the printing, and the meaning of the few pictures that were in it.</para> <figure> <title>A Sample Figure</title> <graphic fileref="giftest.gif" format="gif"></graphic> </figure> <para>Thus I soon engaged his interest; and from that we went to jabbering the best we could about the various outer sights to be seen in this famous town.</para>



Содержание раздела