Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@single_token
def bleed(token):
"""``bleed`` property validation."""
keyword = get_keyword(token)
if keyword == 'auto':
return 'auto'
else:
return get_length(token)
@single_token
def image_resolution(token):
# TODO: support 'snap' and 'from-image'
return get_resolution(token)
@single_token
def min_width_height(token):
"""``min-width`` and ``min-height`` properties validation."""
# See https://www.w3.org/TR/css-flexbox-1/#min-size-auto
keyword = get_keyword(token)
if keyword == 'auto':
return keyword
else:
return length_or_precentage([token])
@single_token
def list_style_image(token, base_url):
"""``list-style-image`` property validation."""
if token.type != 'function':
if get_keyword(token) == 'none':
return 'none', None
parsed_url = get_url(token, base_url)
if parsed_url:
if parsed_url[0] == 'url' and parsed_url[1][0] == 'external':
return 'url', parsed_url[1][1]
@single_token
def order(token):
if token.type == 'number' and token.int_value is not None:
return token.int_value
@single_token
def z_index(token):
"""Validation for the ``z-index`` property."""
if get_keyword(token) == 'auto':
return 'auto'
if token.type == 'number' and token.int_value is not None:
return token.int_value
@single_token
def hyphens(token):
"""Validation for ``hyphens``."""
keyword = get_keyword(token)
if keyword in ('none', 'manual', 'auto'):
return keyword
@single_token
def orphans_widows(token):
"""Validation for the ``orphans`` and ``widows`` properties."""
if token.type == 'number' and token.int_value is not None:
value = token.int_value
if value >= 1:
return value
@single_token
def border_width(token):
"""Border, column rule and outline widths properties validation."""
length = get_length(token, negative=False)
if length:
return length
keyword = get_keyword(token)
if keyword in ('thin', 'medium', 'thick'):
return keyword
@single_token
def column_count(token):
"""Validation for the ``column-count`` property."""
if token.type == 'number' and token.int_value is not None:
value = token.int_value
if value >= 1:
return value
if get_keyword(token) == 'auto':
return 'auto'