CSS::Object::Format - CSS Object Oriented Stringificator
use CSS::Object::Format; my $format = CSS::Object::Format->new( debug => 3 ) || die( CSS::Object::Format->error ); my $prop = CSS::Object::Property->new( format => $format, debug => 3, name => 'display', value => 'inline-block', ) || die( CSS::Object::Property->error ); print( $prop->as_string );
v0.1.0
CSS::Object::Format::Inline is a CSS inline stringificator
To instantiate a new CSS::Object::Format object, pass an hash reference of following parameters:
This is an integer. The bigger it is and the more verbose is the output.
The available parameters used to alter the formatting of the formatters are as follow. Please see each of them methods for their respective purpose and usage.
"close_brace_on_new_line"
"new_line"
"open_brace_on_new_line"
"open_brace_and_new_line"
"indent"
"property_separator"
This will create a deep copy of this formatter's "parameters" and return it.
See "restore_parameters"
This takes a boolean value. If true, this will instruct the formatter to place the closing brace on a new line.
Provided with a comment object, and this will return the comment formatted.
Provided with another CSS::Object::Format object, and this will copy all suitable "parameters" to it.
This is called from the format methods in CSS element classes when a new format object is provided to the element.
Provided with an array object (Module::Generic::Array), and this will format all the elements and return a string.
This is one of "parameters" that sets the string to use as indent. Indent string can be provided in rule formatter or property formatter.
This returns the current character value as a Module::Generic::Scalar object.
This formats the keyframe special rule and returns a string.
This sets or gets the new line character to be used for new lines.
This takes a boolean value. If true, this will instruct the formatter to place the opening brace on a new line.
This takes a boolean value. If true, this will instruct the formatter to insert a new line after the opening brace.
Provided with an array reference of a CSS::Object::Property objects and this will format them and return their string representation.
Provided with a CSS::Object::Property object and this will format it and return its string representation.
This sets or gets the property separator. By default, this is a new line \n
\n
If you want the formatter to put all properties on a single line, you could replace this default value with an empty string.
Provided with an hash reference, typically that created by "backup_parameters" and this will restore this formatter's "parameters"
It returns our object
Provided with a CSS::Object::Rule object and this will format it and return its string representation.
Provided with an array reference of a CSS::Object::Selector objects and this will format them and return their string representation.
Provided with a CSS::Object::Value object and this will format it and return its string representation.
Provided with an array reference of a CSS::Object::Value objects and this will format them and return their string representation.
Jacques Deguest <jack@deguest.jp>
CSS::Object
Copyright (c) 2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.
To install CSS::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CSS::Object
CPAN shell
perl -MCPAN -e shell install CSS::Object
For more information on module installation, please visit the detailed CPAN module installation guide.