"Fossies" - the Fresh Open Source Software Archive

Member "js-beautify-1.14.0/python/cssbeautifier/css/options.py" (14 Jun 2021, 2392 Bytes) of package /linux/www/js-beautify-1.14.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "options.py": 1.13.13_vs_1.14.0.

    1 #
    2 # The MIT License (MIT)
    3 
    4 # Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
    5 
    6 # Permission is hereby granted, free of charge, to any person
    7 # obtaining a copy of this software and associated documentation files
    8 # (the "Software"), to deal in the Software without restriction,
    9 # including without limitation the rights to use, copy, modify, merge,
   10 # publish, distribute, sublicense, and/or sell copies of the Software,
   11 # and to permit persons to whom the Software is furnished to do so,
   12 # subject to the following conditions:
   13 
   14 # The above copyright notice and this permission notice shall be
   15 # included in all copies or substantial portions of the Software.
   16 
   17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   19 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   21 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   22 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   23 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   24 # SOFTWARE.
   25 
   26 from jsbeautifier.core.options import Options as BaseOptions
   27 
   28 
   29 class BeautifierOptions(BaseOptions):
   30     def __init__(self, options=None):
   31         BaseOptions.__init__(self, options, "css")
   32 
   33         self.selector_separator_newline = self._get_boolean(
   34             "selector_separator_newline", True
   35         )
   36         self.newline_between_rules = self._get_boolean("newline_between_rules", True)
   37 
   38         brace_style_split = self._get_selection_list(
   39             "brace_style",
   40             ["collapse", "expand", "end-expand", "none", "preserve-inline"],
   41         )
   42         self.brace_style = "collapse"
   43         for bs in brace_style_split:
   44             if bs != "expand":
   45                 # default to collapse, as only collapse|expand is implemented for now
   46                 self.brace_style = "collapse"
   47             else:
   48                 self.brace_style = bs
   49 
   50         # deprecated
   51         space_around_selector_separator = self._get_boolean(
   52             "space_around_selector_separator"
   53         )
   54 
   55         # Continue to accept deprecated option
   56         self.space_around_combinator = (
   57             self._get_boolean("space_around_combinator")
   58             or space_around_selector_separator
   59         )
   60         self.keep_quiet = False