1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Improve <xref> vs. <command> formatting in the documentation

SQL commands are generally marked up as <command>, except when a link
to a reference page is used using <xref>.  But the latter doesn't
create monospace markup, so this looks strange especially when a
paragraph contains a mix of links and non-links.

We considered putting <command> in the <refentrytitle> on the target
side, but that creates some formatting side effects elsewhere.
Generally, it seems safer to solve this on the link source side.

We can't put the <xref> inside the <command>; the DTD doesn't allow
this.  DocBook 5 would allow the <command> to have the linkend
attribute itself, but we are not there yet.

So to solve this for now, convert the <xref>s to <link> plus
<command>.  This gives the correct look and also gives some more
flexibility what we can put into the link text (e.g., subcommands or
other clauses).  In the future, these could then be converted to
DocBook 5 style.

I haven't converted absolutely all xrefs to SQL command reference
pages, only those where we care about the appearance of the link text
or where it was otherwise appropriate to make the appearance match a
bit better.  Also in some cases, the links where repetitive, so in
those cases the links where just removed and replaced by a plain
<command>.  In cases where we just want the link and don't
specifically care about the generated link text (typically phrased
"for further information see <xref ...>") the xref is kept.

Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/flat/87o8pco34z.fsf@wibble.ilmari.org
This commit is contained in:
Peter Eisentraut
2020-10-03 16:16:51 +02:00
parent 1a9388bd0f
commit 9081bddbd7
92 changed files with 348 additions and 346 deletions

View File

@@ -39,7 +39,7 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
can be used to retrieve
a small number of rows at a time out of a larger query.
After the cursor is created, rows are fetched from it using
<xref linkend="sql-fetch"/>.
<link linkend="sql-fetch"><command>FETCH</command></link>.
</para>
<note>
@@ -124,8 +124,8 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
<term><replaceable class="parameter">query</replaceable></term>
<listitem>
<para>
A <xref linkend="sql-select"/> or
<xref linkend="sql-values"/> command
A <link linkend="sql-select"><command>SELECT</command></link> or
<link linkend="sql-values"><command>VALUES</command></link> command
which will provide the rows to be returned by the cursor.
</para>
</listitem>
@@ -183,9 +183,9 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
<productname>PostgreSQL</productname> reports an error if such a
command is used outside a transaction block.
Use
<xref linkend="sql-begin"/> and
<xref linkend="sql-commit"/>
(or <xref linkend="sql-rollback"/>)
<link linkend="sql-begin"><command>BEGIN</command></link> and
<link linkend="sql-commit"><command>COMMIT</command></link>
(or <link linkend="sql-rollback"><command>ROLLBACK</command></link>)
to define a transaction block.
</para>
@@ -244,7 +244,7 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI
If the cursor's query includes <literal>FOR UPDATE</literal> or <literal>FOR
SHARE</literal>, then returned rows are locked at the time they are first
fetched, in the same way as for a regular
<xref linkend="sql-select"/> command with
<link linkend="sql-select"><command>SELECT</command></link> command with
these options.
In addition, the returned rows will be the most up-to-date versions;
therefore these options provide the equivalent of what the SQL standard