I.3. Сборка документации

Завершив все подготовительные действия, перейдите в каталог doc/src/sgml и запустите одну из команд сборки, описанных в следующих подразделах. (Помните, что для сборки нужно использовать GNU make.)

I.3.1. HTML

Чтобы собрать HTML-версию документации:

doc/src/sgml$ make html

Эта цель сборки также выбирается по умолчанию. Результат помещается в подкаталог html.

Чтобы был сформирован алфавитный указатель, во время сборки требуется выполнить несколько проходов. Если этот указатель вам не нужен, вы просто хотите проверить результат, используйте режим draft:

doc/src/sgml$ make draft

Чтобы получить документацию в виде одной HTML-страницы, выполните:

doc/src/sgml$ make postgres.html

I.3.2. Страницы man

Для преобразования страниц DocBook refentry в формат *roff, подходящий для страниц man, мы используем стили DocBook XSL. Страницы man распространяются в архиве tar, подобно HTML-версии. Чтобы создать страницы man, выполните:

cd doc/src/sgml
make man

I.3.3. Получение печатной версии с использованием JadeTeX

Если вы хотите получить печатную версию документации, используя JadeTex, вы можете воспользоваться одной из следующих команд:

  • Чтобы получить PostScript через DVI для формата A4, выполните:

    doc/src/sgml$ make postgres-A4.ps

    Для формата «U.S. Letter» выполните:

    doc/src/sgml$ make postgres-US.ps

  • Чтобы получить PDF:

    doc/src/sgml$ make postgres-A4.pdf

    или:

    doc/src/sgml$ make postgres-US.pdf

    (Разумеется, вы можете получить PDF и из PostScript, но если сгенерировать PDF напрямую, полученный файл будет содержать гиперссылки и другие расширенные особенности.)

Если вы намерены использовать JadeTeX для сборки документации PostgreSQL, вам, вероятно, потребуется увеличить некоторые внутренние параметры TeX. Их можно задать в файле texmf.cnf. На момент написания этого описания работали следующие параметры:

hash_extra.jadetex  = 200000
hash_extra.pdfjadetex  = 200000
pool_size.jadetex = 2000000
pool_size.pdfjadetex = 2000000
string_vacancies.jadetex = 150000
string_vacancies.pdfjadetex = 150000
max_strings.jadetex = 300000
max_strings.pdfjadetex = 300000
save_size.jadetex = 15000
save_size.pdfjadetex = 15000

I.3.4. Переполнение текста

В некоторых местах текст документации оказывается слишком широким для предопределённых границ, и, в особых случаях, не умещается на странице. В частности, это наблюдается с широкими таблицами или текстом, не допускающим переносы. Сталкиваясь с такой ситуацией, TeX выводит сообщения "Overfull hbox" (Переполнение горизонтальной рамки) в файл журнала, например, postgres-US.log или postgres-A4.log. С учётом того, что дюйм составляют 72 точки, всё, что выходит за границу больше чем на 72 точки, скорее всего не поместится на печатаемой странице (при размере поля один дюйм). Чтобы найти в SGML текст, выходящий за границы, определите номер страницы, указанный над сообщением о переполнении, например: [50 ###] (стр. 50), и посмотрите на следующую страницу (в данном случае, стр. 51) в PDF. Увидев, какой текст на ней выходит за границы, внесите требуемые коррективы в SGML.

I.3.5. Получение печатной версии из RTF

Вы также можете получить печатную версию документации PostgreSQL, преобразовав её в формат RTF, который позволяет откорректировать форматирование в офисном пакете. В зависимости от возможностей конкретного текстового редактора, затем документацию можно будет преобразовать в PostScript или PDF. Ниже описывается, как это можно проделать с применением Applixware.

Замечание: Судя по всему, текущие версии документации PostgreSQL провоцируют ошибку или превышают ограничения размера, существующие в OpenJade. Если у вас процесс сборки RTF «зависает» на долгое время, а размер выводимого файла остаётся нулевым, возможно, вы столкнулись именно с этой проблемой. (Но учтите, что обычная сборка занимает от 5 до 10 минут, так что не прерывайте процесс слишком быстро.)

Очистка RTF в Applixware

OpenJade опускает указание стиля по умолчанию для основного текста. В прошлом, пока это не было обнаружено, генерация оглавления документации выполнялась очень долго. Однако, благодаря помощи разработчиков Applixware, мы смогли диагностировать эту проблему и найти обходное решение.

  1. Получите RTF-версию документации, введя:

    doc/src/sgml$ make postgres.rtf

  2. Исправьте файл RTF, чтобы в нём корректно указывались все стили, в частности, стиль по умолчанию. Если документ содержит разделы refentry, нужно также заменить указания форматирования, связывающие предыдущий абзац с текущим, на указания, связывающие текущий абзац со следующим. Для внесения этих корректив предоставляется утилита fixrtf (она находится в doc/src/sgml):

    doc/src/sgml$ ./fixrtf --refentry postgres.rtf

    Этот скрипт добавляет в документ {\s0 Normal;} в качестве нулевого стиля. По утверждению разработчиков Applixware, стандарт RTF не должен допускать добавления неявного нулевого стиля, хотя Microsoft Word обрабатывает это указание. Для исправления разделов refentry этот скрипт заменяет теги \keepn на \keep.

  3. Создайте новый документ в Applixware Words, а затем импортируйте в него файл RTF.

  4. Создайте оглавление с помощью Applixware.

    1. Выделите строки существующего оглавления, от первого символа первой строки до последнего символа последней строки.

    2. Постройте новое оглавление, выбрав в меню Tools->Book Building->Create Table of Contents (Сервис->Сборка книги->Создать оглавление). Выберите первые три уровня заголовков для включения в оглавление. В результате строки оглавления, импортированные из RTF, будут заменены оглавлением, созданным в Applixware.

    3. Поправьте форматирование оглавления, выбрав пункт меню Format->Style (Формат->Стиль), и определив следующие значения отступов (First (Первый) и Left (Слева)) для каждого из трёх стилей оглавления:

      СтильПервый отступ (в дюймах)Отступ слева (в дюймах)
      TOC-Heading 10.40.4
      TOC-Heading 20.80.8
      TOC-Heading 31.21.2

  5. Проработайте форматирование документа:

    • Расставьте разрывы страниц.

    • Поправьте ширину колонок таблиц.

  6. Замените выравненные по правому краю номера страниц в части оглавления Примеры и Рисунки правильными значениями. Это должно занять всего несколько минут.

  7. Удалите из документа раздел алфавитного указателя, если он пуст.

  8. Сгенерируйте заново и скорректируйте оглавление.

    1. Выделите поле оглавления.

    2. Выберите в меню Tools->Book Building->Create Table of Contents (Сервис->Сборка книги->Создать оглавление).

    3. Отделите оглавление, выбрав в меню Tools->Field Editing->Unprotect (Сервис->Изменение полей->Снять защиту).

    4. Удалите первую строку в оглавлении, которая указывает на само оглавление.

  9. Сохраните документ в специальном формате Applixware Words, чтобы в него можно было легко внести последние правки.

  10. "Напечатайте" документ в файл формата PostScript.

I.3.6. Простые текстовые файлы

Инструкции по установке также распространяются в виде обычного текста, на случай, если они понадобятся в ситуации, когда под рукой не окажется средств просмотра более удобного формата. Файл INSTALL соответствует Главе 15, с небольшими изменениями, внесёнными с учётом другого контекста. Чтобы пересоздать этот файл, перейдите в каталог doc/src/sgml и введите make INSTALL.

В прошлом примечания к выпуску и инструкции по регрессионному тестированию также распространялись в виде простых текстовых файлов, но эта практика была прекращена.

I.3.7. Проверка синтаксиса

Сборка всей документации может занять много времени. Но если нужно проверить только синтаксис файлов документации, это можно сделать всего за несколько секунд:

doc/src/sgml$ make check

J.3. Building The Documentation

Once you have everything set up, change to the directory doc/src/sgml and run one of the commands described in the following subsections to build the documentation. (Remember to use GNU make.)

J.3.1. HTML

To build the HTML version of the documentation:

doc/src/sgml$ make html

This is also the default target. The output appears in the subdirectory html.

To create a proper index, the build might process several identical stages. If you do not care about the index, and just want to proof-read the output, use draft:

doc/src/sgml$ make draft

To build the documentation as a single HTML page, use:

doc/src/sgml$ make postgres.html

J.3.2. Manpages

We use the DocBook XSL stylesheets to convert DocBook refentry pages to *roff output suitable for man pages. The man pages are also distributed as a tar archive, similar to the HTML version. To create the man pages, use the commands:

cd doc/src/sgml
make man

J.3.3. Print Output via JadeTeX

If you want to use JadeTex to produce a printable rendition of the documentation, you can use one of the following commands:

  • To generate PostScript via DVI in A4 format:

    doc/src/sgml$ make postgres-A4.ps

    In U.S. letter format:

    doc/src/sgml$ make postgres-US.ps

  • To make a PDF:

    doc/src/sgml$ make postgres-A4.pdf

    or:

    doc/src/sgml$ make postgres-US.pdf

    (Of course you can also make a PDF version from the PostScript, but if you generate PDF directly, it will have hyperlinks and other enhanced features.)

When using JadeTeX to build the PostgreSQL documentation, you will probably need to increase some of TeX's internal parameters. These can be set in the file texmf.cnf. The following settings worked at the time of this writing:

hash_extra.jadetex  = 200000
hash_extra.pdfjadetex  = 200000
pool_size.jadetex = 2000000
pool_size.pdfjadetex = 2000000
string_vacancies.jadetex = 150000
string_vacancies.pdfjadetex = 150000
max_strings.jadetex = 300000
max_strings.pdfjadetex = 300000
save_size.jadetex = 15000
save_size.pdfjadetex = 15000

J.3.4. Overflow Text

Occasionally text is too wide for the printed margins, and in extreme cases, too wide for the printed page, e.g. non-wrapped text, wide tables. Overly wide text generates "Overfull hbox" messages in the TeX log output file, e.g. postgres-US.log or postgres-A4.log. There are 72 points in an inch so anything reported as over 72 points too wide will probably not fit on the printed page (assuming one inch margins). To find the SGML text causing the overflow, find the first page number mentioned above the overflow message, e.g. [50 ###] (page 50), and look at the page after that (e.g. page 51) in the PDF file to see the overflow text and adjust the SGML accordingly.

J.3.5. Print Output via RTF

You can also create a printable version of the PostgreSQL documentation by converting it to RTF and applying minor formatting corrections using an office suite. Depending on the capabilities of the particular office suite, you can then convert the documentation to PostScript of PDF. The procedure below illustrates this process using Applixware.

Note: It appears that current versions of the PostgreSQL documentation trigger some bug in or exceed the size limit of OpenJade. If the build process of the RTF version hangs for a long time and the output file still has size 0, then you might have hit that problem. (But keep in mind that a normal build takes 5 to 10 minutes, so don't abort too soon.)

Applixware RTF Cleanup

OpenJade omits specifying a default style for body text. In the past, this undiagnosed problem led to a long process of table of contents generation. However, with great help from the Applixware folks the symptom was diagnosed and a workaround is available.

  1. Generate the RTF version by typing:

    doc/src/sgml$ make postgres.rtf

  2. Repair the RTF file to correctly specify all styles, in particular the default style. If the document contains refentry sections, one must also replace formatting hints which tie a preceding paragraph to the current paragraph, and instead tie the current paragraph to the following one. A utility, fixrtf, is available in doc/src/sgml to accomplish these repairs:

    doc/src/sgml$ ./fixrtf --refentry postgres.rtf

    The script adds {\s0 Normal;} as the zeroth style in the document. According to Applixware, the RTF standard would prohibit adding an implicit zeroth style, though Microsoft Word happens to handle this case. For repairing refentry sections, the script replaces \keepn tags with \keep.

  3. Open a new document in Applixware Words and then import the RTF file.

  4. Generate a new table of contents (ToC) using Applixware.

    1. Select the existing ToC lines, from the beginning of the first character on the first line to the last character of the last line.

    2. Build a new ToC using Tools->Book Building->Create Table of Contents. Select the first three levels of headers for inclusion in the ToC. This will replace the existing lines imported in the RTF with a native Applixware ToC.

    3. Adjust the ToC formatting by using Format->Style, selecting each of the three ToC styles, and adjusting the indents for First and Left. Use the following values:

      StyleFirst Indent (inches)Left Indent (inches)
      TOC-Heading 10.40.4
      TOC-Heading 20.80.8
      TOC-Heading 31.21.2

  5. Work through the document to:

    • Adjust page breaks.

    • Adjust table column widths.

  6. Replace the right-justified page numbers in the Examples and Figures portions of the ToC with correct values. This only takes a few minutes.

  7. Delete the index section from the document if it is empty.

  8. Regenerate and adjust the table of contents.

    1. Select the ToC field.

    2. Select Tools->Book Building->Create Table of Contents.

    3. Unbind the ToC by selecting Tools->Field Editing->Unprotect.

    4. Delete the first line in the ToC, which is an entry for the ToC itself.

  9. Save the document as native Applixware Words format to allow easier last minute editing later.

  10. "Print" the document to a file in PostScript format.

J.3.6. Plain Text Files

The installation instructions are also distributed as plain text, in case they are needed in a situation where better reading tools are not available. The INSTALL file corresponds to Chapter 15, with some minor changes to account for the different context. To recreate the file, change to the directory doc/src/sgml and enter make INSTALL.

In the past, the release notes and regression testing instructions were also distributed as plain text, but this practice has been discontinued.

J.3.7. Syntax Check

Building the documentation can take very long. But there is a method to just check the correct syntax of the documentation files, which only takes a few seconds:

doc/src/sgml$ make check

FAQ