5 markup_string.mas - display an arbitrary string, marked up for display using Text.Markup
15 optional unique HTML id for the string
19 hashref of Text.Markup style definitions to use
23 arrayref of Text.Markup regions of the string to apply said styles
36 % if( $styles && %$styles && $regions && @$regions ) {
37 % $id ||= next_auto_id();
39 <& /util/import_javascript.mas, classes => 'Text.Markup' &>
40 <span id="<% $id %>"><% $string %></span>
41 <script type="text/javascript">
42 var markup = new Text.Markup(<% $json->encode($styles) %>);
43 var markup_el = document.getElementById('<% $id %>');
44 markup_el.innerHTML = markup.markup( <% $json->encode($regions) %>, document.all ? markup_el.innerText : markup_el.textContent );
56 my $json = JSON::Any->new;
59 'markup_string_'.($auto_id++)