Old Wiki Modules

The original wiki was converted from perl to javascript five years ago. Now we look to modularize it so that it is easy to attach a federated wiki authoring extension. Likely module boundaries are highlighted in gold. github

The javascript fetches and shows one page. The fetch uses the historic xhr interface. Show wraps the markup with a head and foot. A page titled Random redirects to anypage. Init will turn into a loop.

digraph { node [shape=box style=filled] node [fillcolor=gold] init markup node [fillcolor=palegreen] init -> fetchNames init -> fetchPage init -> ready -> show fetchPage -> loadDoc fetchNames -> loadDoc loadDoc -> xhttp xhttp -> open xhttp -> send xhttp -> trouble show -> head show -> markup show -> foot show -> anypage show -> trouble }

The rendering of legacy markup process links one at a time applying prepass substitutions with generated text stashed until a post pass where unstashed text is assembled.

The substitutions of nested lists is made complex by function passing that makes the call graph twisted.

digraph { node [shape=box style=filled] node [fillcolor=gold] markup fullsearch titlesearch node [fillcolor=palegreen] markup -> render markup -> complete render -> links render -> inner inner -> escape inner -> bullets inner -> emhasis links -> prepass links -> postpass postpass -> sanitize postpass -> unstash postpass -> complete prepass -> youtube prepass -> titlesearch prepass -> fullsearch prepass -> isbn prepass -> external prepass -> internal fullsearch -> stash titlesearch -> stash titlesearch -> get -> link titlesearch -> got youtube -> stash external -> stash internal -> stash bullets -> enter complete -> enter }

Complexity in the markup processing emerged through side by side comparisons with perl generated pages. Creative authors found many unintended properties that then became widespread. This code is best kept hands-off except possibly for instrumenting cases without similar validation.

Two exceptions are the search mechanisms where markup is translated into interactive behavior.