diff options
Diffstat (limited to 'scss')
-rw-r--r-- | scss/extension/core.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scss/extension/core.py b/scss/extension/core.py index 6642f1d..c1bdd53 100644 --- a/scss/extension/core.py +++ b/scss/extension/core.py @@ -576,9 +576,13 @@ def str_index(string, substring): def str_slice(string, start_at, end_at=None): expect_type(string, String) expect_type(start_at, Number, unit=None) - py_start_at = start_at.to_python_index(len(string.value)) - if end_at is None: + if int(start_at) == 0: + py_start_at = 1 + else: + py_start_at = start_at.to_python_index(len(string.value)) + + if end_at is None or int(end_at) > len(string): py_end_at = None else: expect_type(end_at, Number, unit=None) |