Skip to main content

Module gopher

Module gopher 

Source
Expand description

Gopher menu engine — parses RFC 1436 gopher menus into a portable document.

A gopher menu is a sequence of tab-delimited lines, each of the form:

<type><display>\t<selector>\t<host>\t<port>\r\n

The first character of each line is the item type. A bare . on its own line terminates the menu.

Item types this engine handles explicitly:

  • i informational text (no resource) — merged into paragraph runs
  • 0 text file — emitted as link
  • 1 submenu / directory — emitted as link
  • 7 full-text search server — emitted as link
  • 9 binary — emitted as link
  • g / I images — emitted as link
  • s sound — emitted as link
  • T telnet — emitted as link
  • h URL item (selector starts with URL:) — extracted URL emitted as link
  • 3 server error — folded into informational paragraph text

Unknown types are still emitted as a synthesised gopher:// link so the menu remains navigable even when the type isn’t in the table above.

References:

  • RFC 1436 (The Internet Gopher Protocol)
  • RFC 4266 (gopher URI scheme)

Structs§

GopherEngine
Gopher menu engine.

Constants§

ENGINE_ID
Stable engine identifier.