New Pod Blocks
Error ReportCollection examples

These are the cool possibilities using the Collection and Raku::Pod::Render distributions.

# Assigning new classes to standard HTML templates.

For example, <hr> .

renders as

# Plugins to keep customisation together

Raku::Pod::Render introduces the idea of 'plugins' to keep block names and the templates associated with them together. Collection takes the concept further by having plugins that can run Raku programs at each stage of the Collection process, after the Mode has been configured.

Plugins keep the CSS, templates and new custom block names in the same sub-directory.

This mechanism also means that Mode specific output, such as scripts and CSS for HTML output can be managed by Mode plugins. The Website mode for Collection-Raku-Documentation contains plugins to gather CSS, jQuery scripts, js libraries, and Images from other plugins, and collate them so that they are served with each page.

Since the entire page is in a template, it is also possible to create separate page templates, with different CSS assets.

The following are Custom user-facing Pod::Blocks that come with Collection-Raku-Documentation

# Camelia icon headers with images

For Raku files, a special block was created for the various types of Camelia image. They normally float on the right-hand side. In order to contain them before the next set of texts, they are included in an HTML5 flex-box, which is created using a template for para.

The following code

yields

# Adding new templates for existing Pod::Blocks

Suppose you want a different template to act on an existing block, like Para, which is coded as HTML p. For example,

I like this sonnet:

Let me not to the marriage of true minds
Admit impediments; love is not love
Which alters when it alteration finds,
Or bends with the remover to remove.

Sonnet 116

# New Format Codes

Here is an example where the format code F has been leveraged to generate FontAwesome icons. The plugin here utilises v4.7. The API for v5 / 6 is different, so another plugin may be needed.

Since Raku treats all Unicode characters the same, Chinese/Arabic/Cyrillic glyphs can now be specified to repeat or alias the predefined codes of B C I K T U E Z X N L P V .

Generates Some FontAwesome icons

Example of ambulance

Example of automobile (alias)

Example of bicycle

Example of bus

Example of truck

Example of wheelchair

Example of wheelchair-alt

FontAwesome has some other options.

Generates

Train normal size Triple size train

An animated spinner

Notice how these examples leverage off the idea of meta data together with a Format Code. This is not standard Rakudoc (aka POD6), as this metadata is only specified for X<>  and L<> . Raku::Pod::Render allows for metadata to be added to any non-standard letter used as a Format Code, and any Unicode thingy that Raku treats as a "character" to be made into a Format Code.

# Compilation blocks

When many Rakudoc files are included in a collection, there is a need to collect data from each. So for example, the Raku Documentation files all have metadata associated with the first pod definition. We need to collect files according to the metadata. The keys kind, subkind, and category are allocated to all Raku Documents.

renders as

Programs that support Raku development

Modules and applications used to debug Raku programs

How to run Rakudo, a Raku implementation, and modify its behavior with environment variables.

rakudoc - the Raku pod reader

How to run Rakudo, a Raku implementation, and the command line options you can use with it.

Programs that support Raku development, title is not included in the TOC.

Modules and applications used to debug Raku programs

How to run Rakudo, a Raku implementation, and modify its behavior with environment variables.

rakudoc - the Raku pod reader

How to run Rakudo, a Raku implementation, and the command line options you can use with it.

Other examples of ListFiles can be seen in the TOC and Itemised index pages.

# Images

Content files today, especially for the Web, rely on images.

Generates an image with the text in the Table of Contents. The TOC entry can be eliminated with a :headlevel(0).

# JQuery Plugins

All websites need JQuery plugins or JS scripts. Collection creates the infrastructure for these plugins to be written and added to a site.

For example, the filterlines plugin uses a small JQuery script, adds some html around existing Rakudoc content and handles everything else. (Try typing 'R' then 'e' in the search box).

renders as

Programs that support Raku development

Modules and applications used to debug Raku programs

How to run Rakudo, a Raku implementation, and modify its behavior with environment variables.

rakudoc - the Raku pod reader

How to run Rakudo, a Raku implementation, and the command line options you can use with it.

# LeafletMap

The leafletmap plugin inserts a map in place of the =LeafletMap Pod::Block using the fabulous Leaflet JS library. The map MUST have a fixed height, so this is specified in the config file. However, height and width should be set by CSS, but it is not clear what the best way is to signal that a CSS value is available from CSS in the config file.

By default, the map will point at Cardiff Castle in Cardiff, Wales with a 200px height and 16 unit magnification, using OpenStreetMap as the tile provider. So

produces:

The simplest customisation is to centre the map by specifying the lattitude and longitude, and to change the starting zoom level (smaller numbers are larger views). It is also possible to change the height of the map. Each map on a page must have its own id. Additionally, when developing a page, not setting a width is tiresome. Note another very underutilised feature of Rakudoc, the ability to spread meta-data accross lines. The first virtual column must start in a = and there must be at least one horizontal whitespace character. Thus

will produce

Maps are generated from tiles and the information can be rendered in many ways. There are multiple tile providers, collected in a github resource leaflet-extras. "Leaflet-providers provides tile layers from different providers, including OpenStreetMap, Stamen, Esri and OpenWeatherMap. The full listing of free to use layers can be previewed." (from README of leaflet-providers)

Some providers have map types that do not need registration, most types need registration. Here are all the providers and variants.

For example, is a map with the Esri.WorldImagery provider[.variant] string.

Registration offers more variety and more complex maps, but goes beyond the generic Collection plugin.

However, the extra customisation is possible by changing the config file and the template for the =Leafletmap block.

For example, suppose you have registered with Thunderforest and obtained an api-key, eg. xxxx. Then in config.raku uncomment 'api-key' and insert your key in place of ????. The template already allows for an apikey field, but some providers require other variable names, or two variables. More information can be found in leaflet-extras.

Another common need is to put markers on a map. This can be done using =LeafMarker blocks. The map-id of the map the markers are to be associated with has to be supplied if there are more than one maps on a page, otherwise the default map id is used.

:popup<text> associated the text with the marker but the user needs to click in it to see.

:title<text> allows for the text to be visible with a mouseover.

:fa-icon will work if the FontAwesome plugin has been configured for rendering (see above for detail on extra commands).

:headlevel(0) is set so that the Table of Contents is not affected.

Thus for two chippies judged the best in Cardiff at the time of writing:

# Graphviz

This block introduces a directed graph in the dot language. It is rendered into HTML as an svg using the dot program. Since a graph data is require, only the delimited form of the block (starting with =begin/=end) will be used.

The following diagraph comes from the dot documentation. The following Rakudoc

produces

# Latex

This plugin block sends the Latex markup to the CodeCogs online equation editor. For example,

\begin{align*} \sum_{i=1}^{k+1} i^{3} &= \biggl(\sum_{i=1}^{n} i^{3}\biggr) + i^3\\ &= \frac{k^{2}(k+1)^{2}}{4} + (k+1)^3 \\ &= \frac{k^{2}(k+1)^{2} + 4(k+1)^3}{4}\\ &= \frac{(k+1)^{2}(k^{2} + 4k + 4)}{4}\\ &= \frac{(k+1)^{2}(k+2)^{2}}{4} \end{align*}