New Pod Blocks
These are the cool possibilities using the Raku::Pod::Render distribution.
Assigning classes to HTML containers.
These effects can be found in the plugin simple-extras.
For example, <hr> .
=for HR :class<yellowish-dots> :!toc
=for HR :class<bluish-dots> :!toc
=for HR :class<greenish-dots> :!toc
renders as
HR
HR
HR
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:
=for para :template<quotation> :author<William Shakespeare> :citation<Sonnet 116> :!toc
Let me not to the marriage of true minds\n
Admit impediments; love is not love\n
Which alters when it alteration finds,\n
Or bends with the remover to remove.
I like this sonnet:
Let me not to the marriage of true minds\n Admit impediments; love is not love\n Which alters when it alteration finds,\n Or bends with the remover to remove.
Plugins to keep customisation together
Raku::Pod::Render introduces the idea of 'plugins' to keep the CSS, templates and
new custom block names in the same sub-directory.
This mechanism also means that scripts and CSS for HTML output can also be managed by plugins. There are plugins to gather CSS, jQuery scripts, js libraries, and Images from other plugins, and collate them so that they are served with each page.
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 .
Some FontAwesome icons
F<fa-ambulance> Example of ambulance
F<fa-automobile> Example of automobile (alias)
F<fa-bicycle> Example of bicycle
F<fa-bus> Example of bus
F<fa-truck> Example of truck
F<fa-wheelchair> Example of wheelchair
F<fa-wheelchair-alt> Example of wheelchair-alt
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.
Train normal size F<fa-train> Triple size train F<fa-train|fa-3x>
An animated spinner F<fa-refresh|fa-spin fa-3x fa-fw>
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.
Images
Content files today, especially for the Web, rely on images.
=for Image :src<asset_files/images/octopus-build.gif> :class<justify-center>
New functionality is being developed
Generates an image with the text in the Table of Contents. The TOC entry
can be eliminated with a :!toc.
image izef_raku_pod_render_dist_resources_asset_files_images_octopus_build_gif not found
Graphviz
This block introduces a directed graph in the dot language. It is rendered into HTML as an svg using the
dot program. Since many lines of graph data are required, only the delimited form of the block
(starting with =begin/=end) should be used, and not the contracted =Graphviz form.
The following diagraph comes from the dot documentation. The following Rakudoc
=begin Graphviz :!toc
digraph G {
main -> parse -> execute;
main -> init;
main -> cleanup;
execute -> make_string;
execute -> printf
init -> make_string;
main -> printf;
execute -> compare;
}
=end Graphviz
produces
Latex
This plugin block sends the Latex markup to the CodeCogs online equation editor (the html page needs to be served with a live internet link. For example,
=for Latex :!toc
\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*}
Errors
If a block is used in a Rakudoc document that is misspelt or a Custom plugin has not been correctly
defined, then the ProcessedPod renderer will render the block as an Unknown Name with an error
message. For example, suppose 'head' is misspelt as 'header'.
=header1 This should be a header
This is some text
renders as: =header1 This should be a header
This is some text