ERK

NAME

ERK - Embedded RaKu

SYNOPSIS

use ERK;
use MONKEY-SEE-NO-EVAL;

my $erk-code = q:to/END/;
	Hello! I’d like the first 10 primes, please.
	OK: <%= (1 .. ∞).grep({ .is-prime })[0 .. 9].join(', ') %>
	END

EVAL to-raku($erk-code);

# OUTPUT:
#   Hello! I’d like the first 10 primes, please.
#   OK: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29

DESCRIPTION

ERK (Embedded RaKu) is a templating engine for evaluating Raku code embedded in arbitrary text files. Heavily inspired by ESH (Embedded SHell), which is itself like ERB (Embedded RuBy).

TEMPLATE SYNTAX

ERK has two tags for inserting Raku code and one for comments. Every opened tag must be closed.

  • Untagged text

    Text outside of tags is printed verbatim.

  • <% code %>

    The code is left to be executed as-is, with an added newline and semicolon.

  • <%= expression %>

    Calls the .Str method on the expression and prints it.

  • <%# comment %>

    Removed from output.

  • <%-, <%=- and <%#-

    May be used instead of <%, <%= and <%# to remove leading horizontal whitespace prior to the opening tag.

  • -%>

    May be used instead of %> to remove trailing horizontal whitespace following the closing tag.

  • <%%

    A literal <% when used outside of tags.

  • %%>

    A literal %> when used inside of tags.

COPYRIGHT AND LICENSE

Copyright 2025 Ulises Bortoletti.

This package is free software; you may redistribute it and/or modify it under the terms of the Artistic 2.0 license (see LICENSE).

ERK v1.1.4

Templating engine for embedded Raku code

Authors

  • UlisesB

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • ERK
  • ERK::Actions
  • ERK::Grammar

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.