chore: Use ES6 template strings in CSS and code generators (#5902)

* Unindent CSS, save 3 kb of code.
* Convert generator functions to template strings. 
This resolves #5761.
This commit is contained in:
Neil Fraser
2022-01-28 17:58:43 -08:00
committed by GitHub
parent a31003fab9
commit 1f6a1bd8d9
39 changed files with 2194 additions and 2062 deletions

View File

@@ -70,16 +70,20 @@ Python['controls_for'] = function(block) {
// Helper functions.
const defineUpRange = function() {
return Python.provideFunction_('upRange', [
'def ' + Python.FUNCTION_NAME_PLACEHOLDER_ + '(start, stop, step):',
' while start <= stop:', ' yield start', ' start += abs(step)'
]);
return Python.provideFunction_('upRange', `
def ${Python.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
while start <= stop:
yield start
start += abs(step)
`);
};
const defineDownRange = function() {
return Python.provideFunction_('downRange', [
'def ' + Python.FUNCTION_NAME_PLACEHOLDER_ + '(start, stop, step):',
' while start >= stop:', ' yield start', ' start -= abs(step)'
]);
return Python.provideFunction_('downRange', `
def ${Python.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
while start >= stop:
yield start
start -= abs(step)
`);
};
// Arguments are legal Python code (numbers or strings returned by scrub()).
const generateUpDownRange = function(start, end, inc) {