The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CSS::Object::Format - CSS Object Oriented Stringificator

SYNOPSIS

    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 );

VERSION

    v0.1.0

DESCRIPTION

CSS::Object::Format::Inline is a CSS inline stringificator

CONSTRUCTOR

new

To instantiate a new CSS::Object::Format object, pass an hash reference of following parameters:

debug

This is an integer. The bigger it is and the more verbose is the output.

PARAMETERS

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.

METHODS

backup_parameters

This will create a deep copy of this formatter's "parameters" and return it.

See "restore_parameters"

close_brace_on_new_line

This takes a boolean value. If true, this will instruct the formatter to place the closing brace on a new line.

comment_as_string

Provided with a comment object, and this will return the comment formatted.

copy_parameters_from

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.

elements_as_string

Provided with an array object (Module::Generic::Array), and this will format all the elements and return a string.

indent

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.

keyframes_as_string

This formats the keyframe special rule and returns a string.

new_line

This sets or gets the new line character to be used for new lines.

This returns the current character value as a Module::Generic::Scalar object.

open_brace_on_new_line

This takes a boolean value. If true, this will instruct the formatter to place the opening brace on a new line.

open_brace_and_new_line

This takes a boolean value. If true, this will instruct the formatter to insert a new line after the opening brace.

properties_as_string

Provided with an array reference of a CSS::Object::Property objects and this will format them and return their string representation.

property_as_string

Provided with a CSS::Object::Property object and this will format it and return its string representation.

property_separator

This sets or gets the property separator. By default, this is a new line \n

If you want the formatter to put all properties on a single line, you could replace this default value with an empty string.

This returns the current character value as a Module::Generic::Scalar object.

restore_parameters

Provided with an hash reference, typically that created by "backup_parameters" and this will restore this formatter's "parameters"

It returns our object

rule_as_string

Provided with a CSS::Object::Rule object and this will format it and return its string representation.

selectors_as_string

Provided with an array reference of a CSS::Object::Selector objects and this will format them and return their string representation.

value_as_string

Provided with a CSS::Object::Value object and this will format it and return its string representation.

values_as_string

Provided with an array reference of a CSS::Object::Value objects and this will format them and return their string representation.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

CSS::Object

COPYRIGHT & LICENSE

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.