The RakuAST::Doc::Paragraph
class contains the information about a logical paragraph in a RakuDoc
block.
Support for RakuAST
functionality is available in language version 6.e+
and was added in Rakudo compiler release 2023.02. In earlier language versions it is only available when specifying:
use experimental :rakuast;
Object introspection§
RakuAST::Doc::Paragraph
objects are typically created when parsing Raku Programming Language code that has RakuDoc
markers in it. So most developers will only need to know how to introspect the objects created.
method atoms§
.put for .atoms;# Text before B<and> after markup
Returns the atoms of the paragraph. These are generally a mix of strings and RakuAST::Doc::Markup
objects.
method Str§
put ; # Text before B<and> after markup
Returns the string for the paragraph, with any markup stringified.
method raku§
# method .gist falls back to .rakusay ; # RakuAST::Doc::Paragraph.new(...
Returns the string that is needed for the creation of the paragraph using RakuAST
calls.
Object creation§
One seldom creates RakuAST::Doc::Paragraph
objects directly. This documentation is intended for those few people who'd like to devise their own way of programmatically building a RakuAST::Doc::Paragraph
object.
method new§
method new(*)
The new
method must be called to create a new RakuAST::Doc::Paragraph
object. It takes any number of positional arguments as the atoms of the logical paragraph, where an atom is either a string or a RakuAST::Doc::Markup
object.
Typically a RakuAST::Doc::Paragraph
object is only created if a logical paragraph has at least one markup object.
my = RakuAST::Doc::Paragraph.new("Text before ",RakuAST::Doc::Markup.new(:letter<B>, :atoms("and"))," after markup\n");
Object modification§
method add-atom§
.add-atom("baz\n");
Add an atom: should be a string, or a RakuAST::Doc::Markup
object.