jgoerzen / pygopherd

Multiprotocol Gopher/Web Server [Python]
GNU General Public License v2.0
170 stars 25 forks source link

Clarification on gophermap grammar #11

Open sternenseemann opened 3 years ago

sternenseemann commented 3 years ago

From the man page pygopherd(8) (shortened):

       The gophermap files contain two types of  lines,  which  are  described
       here  using  the  same  convention normally used for command line argu-
       ments.  In this section, the symbol \t will be used to indicate  a  tab
       character, Control-I.

        full line of informational text

        gophertypeDESCRIPTION [ \tselector [ \thost [ \tport ] ] ]

       Note:  spaces  shown above are for clarity only and should not actually
       be present in your file.

       […]

       The  second  type of line represents a link to a file or directory.  It
       begins with a single-character  Gopher  type  (see  Gopher  Item  Types
       below)  followed  immediately  by  a  description  and a tab character.
       There is no space or other separator between the gopher  type  and  the
       description.  The description may contain spaces but not tabs.

Following the paragraph on the second type of line, shouldn't be the grammar read like the following?

        gophertypeDESCRIPTION \t [selector [ \thost [ \tport ] ] ]

It says „followed immediately by a description and a tab character“ while the grammar suggests the tab character and selector can be omitted together.

Haven't yet had a chance to check how it is in the code, but needs a documentation fix either way.

The impact of this difference can be seen using the following example. Consider the following gophermap line:

i'm blue

With the grammar not requiring a tab after the description, this would become an info line with the text 'm blue. If the tab was required however, it would become a info line with the text i'm blue.

sternenseemann commented 3 years ago

After reading up on it, I believe the line should read:

        gophertypeDESCRIPTION\t   [ selector [ \thost [ \tport ] ] ]