Thread: SGML on functions

SGML on functions

From
Thom Brown
Date:
Copied from another thread...

Something I've noticed is an inconsistency in the SGML markup around
functions listed in tables.  Sometimes the entire function signature
is considered to be the function, and other times it's just the
function name, with its parameters outside of the <function> tags.

E.g.:

<function>variance</function>(<replaceable
class="parameter">expression</replaceable>)

vs

<function>stddev_samp(<replaceable
class="parameter">expression</replaceable>)</function>

Which way is correct?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Re: SGML on functions

From
Thom Brown
Date:
On 27 August 2010 19:56, Thom Brown <thom@linux.com> wrote:
> Copied from another thread...
>
> Something I've noticed is an inconsistency in the SGML markup around
> functions listed in tables.  Sometimes the entire function signature
> is considered to be the function, and other times it's just the
> function name, with its parameters outside of the <function> tags.
>
> E.g.:
>
> <function>variance</function>(<replaceable
> class="parameter">expression</replaceable>)
>
> vs
>
> <function>stddev_samp(<replaceable
> class="parameter">expression</replaceable>)</function>
>
> Which way is correct?
>

I've also noticed that a lot of the <screen> contents are indented as
part of the markup, but when output in HTML, each space it recreated
as it ends up in either <code> or <pre> tags.

<programlisting> contents seem to have been intentionally entered so
that they break with the indenting style so they're output correctly.
Shouldn't tags such as <screen> follow the same style so that they can
also avoid unintentional leading whitespace?
--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Re: SGML on functions

From
Alvaro Herrera
Date:
Excerpts from Thom Brown's message of vie ago 27 14:56:04 -0400 2010:
> Copied from another thread...
>
> Something I've noticed is an inconsistency in the SGML markup around
> functions listed in tables.  Sometimes the entire function signature
> is considered to be the function, and other times it's just the
> function name, with its parameters outside of the <function> tags.
>
> E.g.:
>
> <function>variance</function>(<replaceable
> class="parameter">expression</replaceable>)
>
> vs
>
> <function>stddev_samp(<replaceable
> class="parameter">expression</replaceable>)</function>
>
> Which way is correct?

The latter I think -- see
http://www.docbook.org/tdg/en/html/function.html
(but perhaps search the actual standard)

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: SGML on functions

From
"Kevin Grittner"
Date:
Alvaro Herrera <alvherre@commandprompt.com> wrote:
> Excerpts from Thom Brown's message:

>> <function>variance</function>(<replaceable
>> class="parameter">expression</replaceable>)
>>
>> vs
>>
>> <function>stddev_samp(<replaceable
>> class="parameter">expression</replaceable>)</function>
>>
>> Which way is correct?
>
> The latter I think -- see
> http://www.docbook.org/tdg/en/html/function.html
> (but perhaps search the actual standard)

Nothing I saw at that link suggests that the parameters should be
included within the <function> scope.  If you follow links from
there to here:

http://www.docbook.org/tdg/en/html/funcsynopsis.html

You find examples like this:

<funcsynopsis>
<funcprototype>
  <funcdef>void <function>qsort</function></funcdef>
    <paramdef>void *<parameter>dataptr</parameter>[]</paramdef>
    <paramdef>int <parameter>left</parameter></paramdef>
    <paramdef>int <parameter>right</parameter></paramdef>
    <paramdef>int <parameter>(* comp)</parameter>
      <funcparams>void *, void *</funcparams></paramdef>
</funcprototype>
</funcsynopsis>

-Kevin

Re: SGML on functions

From
Thom Brown
Date:
On 29 August 2010 16:21, Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:
> Alvaro Herrera <alvherre@commandprompt.com> wrote:
>> Excerpts from Thom Brown's message:
>
>>> <function>variance</function>(<replaceable
>>> class="parameter">expression</replaceable>)
>>>
>>> vs
>>>
>>> <function>stddev_samp(<replaceable
>>> class="parameter">expression</replaceable>)</function>
>>>
>>> Which way is correct?
>>
>> The latter I think -- see
>> http://www.docbook.org/tdg/en/html/function.html
>> (but perhaps search the actual standard)
>
> Nothing I saw at that link suggests that the parameters should be
> included within the <function> scope.  If you follow links from
> there to here:
>
> http://www.docbook.org/tdg/en/html/funcsynopsis.html
>
> You find examples like this:
>
> <funcsynopsis>
> <funcprototype>
>  <funcdef>void <function>qsort</function></funcdef>
>    <paramdef>void *<parameter>dataptr</parameter>[]</paramdef>
>    <paramdef>int <parameter>left</parameter></paramdef>
>    <paramdef>int <parameter>right</parameter></paramdef>
>    <paramdef>int <parameter>(* comp)</parameter>
>      <funcparams>void *, void *</funcparams></paramdef>
> </funcprototype>
> </funcsynopsis>
>

But that page also says "Using FuncSynopsis for languages that are
unrelated to C may prove difficult."

Using that syntax will result in a semi-colon being placed at the end
of the function when parsed.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Re: SGML on functions

From
"Kevin Grittner"
Date:
Thom Brown <thom@linux.com> wrote:
> Kevin Grittner <Kevin.Grittner@wicourts.gov> wrote:

>>  You find examples like this:
>>
>> <funcsynopsis>
>> <funcprototype>
>>  <funcdef>void <function>qsort</function></funcdef>
>>    <paramdef>void *<parameter>dataptr</parameter>[]</paramdef>
>>    <paramdef>int <parameter>left</parameter></paramdef>
>>    <paramdef>int <parameter>right</parameter></paramdef>
>>    <paramdef>int <parameter>(* comp)</parameter>
>>      <funcparams>void *, void *</funcparams></paramdef>
>> </funcprototype>
>> </funcsynopsis>
>>
>
> But that page also says "Using FuncSynopsis for languages that are
> unrelated to C may prove difficult."
>
> Using that syntax will result in a semi-colon being placed at the
> end of the function when parsed.

Yes, but that's the only place I could find an example of function
and parameter together.  The parameter tag can be used inside of
function as well as in most of the places function can be used, so
the definition seemed ambiguous to me.  I took these examples as
being the best evidence I could find about whether parameter tags
were intended to be inside or outside of the function tag.

I suppose an argument could be made that for functions for which the
identity is totally determined by function name (as in C) the
parameters should be outside the tag, while functions in SQL need
the parameters inside the tag, because they are used to identify a
particular function among many with the same name.

It appears that, technically, either format is allowed.

-Kevin

Re: SGML on functions

From
Peter Eisentraut
Date:
On fre, 2010-08-27 at 21:57 +0100, Thom Brown wrote:
> I've also noticed that a lot of the <screen> contents are indented as
> part of the markup, but when output in HTML, each space it recreated
> as it ends up in either <code> or <pre> tags.
>
> <programlisting> contents seem to have been intentionally entered so
> that they break with the indenting style so they're output correctly.
> Shouldn't tags such as <screen> follow the same style so that they can
> also avoid unintentional leading whitespace?

I don't really know what you mean here.  Do you have an example?


Re: SGML on functions

From
Peter Eisentraut
Date:
On fre, 2010-08-27 at 19:56 +0100, Thom Brown wrote:
> E.g.:
>
> <function>variance</function>(<replaceable
> class="parameter">expression</replaceable>)
>
> vs
>
> <function>stddev_samp(<replaceable
> class="parameter">expression</replaceable>)</function>
>
> Which way is correct?

"Correct" is a strong word in such matters, but I prefer the latter
version.


Re: SGML on functions

From
Thom Brown
Date:
On 29 August 2010 20:12, Peter Eisentraut <peter_e@gmx.net> wrote:
> On fre, 2010-08-27 at 21:57 +0100, Thom Brown wrote:
>> I've also noticed that a lot of the <screen> contents are indented as
>> part of the markup, but when output in HTML, each space it recreated
>> as it ends up in either <code> or <pre> tags.
>>
>> <programlisting> contents seem to have been intentionally entered so
>> that they break with the indenting style so they're output correctly.
>> Shouldn't tags such as <screen> follow the same style so that they can
>> also avoid unintentional leading whitespace?
>
> I don't really know what you mean here.  Do you have an example?

Yes, although it appears to have been resolved in 9.0's documentation:

http://www.postgresql.org/docs/8.4/static/libpq-connect.html

Compare to..

http://www.postgresql.org/docs/9.0/static/libpq-connect.html

The part in question is the line after which it says "Makes a new
connection to the database server".

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Re: SGML on functions

From
Thom Brown
Date:
On 29 August 2010 20:24, Thom Brown <thom@linux.com> wrote:
> On 29 August 2010 20:12, Peter Eisentraut <peter_e@gmx.net> wrote:
>> On fre, 2010-08-27 at 21:57 +0100, Thom Brown wrote:
>>> I've also noticed that a lot of the <screen> contents are indented as
>>> part of the markup, but when output in HTML, each space it recreated
>>> as it ends up in either <code> or <pre> tags.
>>>
>>> <programlisting> contents seem to have been intentionally entered so
>>> that they break with the indenting style so they're output correctly.
>>> Shouldn't tags such as <screen> follow the same style so that they can
>>> also avoid unintentional leading whitespace?
>>
>> I don't really know what you mean here.  Do you have an example?
>
> Yes, although it appears to have been resolved in 9.0's documentation:
>
> http://www.postgresql.org/docs/8.4/static/libpq-connect.html
>
> Compare to..
>
> http://www.postgresql.org/docs/9.0/static/libpq-connect.html
>
> The part in question is the line after which it says "Makes a new
> connection to the database server".

Ah, it appears it was actually *you* who fixed it!

"Fix indentation of verbatim block elements

Block elements with verbatim formatting (literallayout, programlisting,
screen, synopsis) should be aligned at column 0 independent of the surrounding
SGML, because whitespace is significant, and indenting them creates erratic
whitespace in the output.  The CSS stylesheets already take care of indenting
the output.

Assorted markup improvements to go along with it."

http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/libpq.sgml.diff?r1=1.313.2.2;r2=1.313.2.3

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935