TOC Index
Contains the information about a RakuDoc paragraph
class RakuAST::Doc::Paragraph { }
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;
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.
.put for $paragraphs.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.
put $paragraph; # Text before B<and> after markup
Returns the string for the paragraph, with any markup stringified.
# method .gist falls back to .rakusay $block; # RakuAST::Doc::Paragraph.new(...
Returns the string that is needed for the creation of the paragraph using RakuAST calls.
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(*@atoms)
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 $paragraph = RakuAST::Doc::Paragraph.new( "Text before ", RakuAST::Doc::Markup.new(:letter<B>, :atoms("and")), " after markup\n");
$paragraph.add-atom("baz\n");
Add an atom: should be a string, or a RakuAST::Doc::Markup object.