Helpers

We will examine each helper function used by request handlers of the Small Again Wiki. These all appear in the helpers section of the source code. github

See Handlers for where these definitions are used.

Do 'show slug' to fetch and render as html a json format file from this server's pages.

Do 'path slug' to construct the path to a page within the server's filesystem.

Do 'render page' to construct the html version of a page already in ruby's native hash representation.

We treat every item as if they have text that will make sense to the reader. Should there be not text we settle for the item type which hints at more capability available in the browser-based version.

Do 'header title' to construct the html page title including the site's flag (favicon) linking back to the page.

The flag's link normally links to a lineup of both the welcome-visitors and current page. We could link back to welcome which can be useful but choose to link to the current page so that it drags properly to other wiki tabs.

Do 'resolve text' to convert internal markup to html hypertext links.

Link resolution normally identifies all sites in the federation that could contain the desired page. We skip this important detail. We also skip external links and the html escaping done as part of resolution.

Do 'slug title' to convert a title to a hyphenated, lowercase, punctuation free string.

The whole federation relies on consistent rules for generating slugs from titles. This process is intentionally lossy. Several heuristics account for cases where less loss or no loss would be better.