From 892bcc366e479c0c7c5bf63c4bdd64a8b1bc0fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Omar=20Flores=20Ch=C3=A1vez?= Date: Tue, 29 Oct 2019 19:27:43 -0600 Subject: [PATCH 1/3] Update the templates for new sketches Use today's date to specify the date of the sketch --- ginpar/new.py | 6 ++++-- ginpar/templates/sketch/data.yaml | 14 ++++++++------ ginpar/templates/sketch/sketch.js | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ginpar/new.py b/ginpar/new.py index b329902..d75f414 100644 --- a/ginpar/new.py +++ b/ginpar/new.py @@ -22,6 +22,7 @@ """ import os import yaml +from datetime import date import click from jinja2 import Environment, FileSystemLoader @@ -74,8 +75,9 @@ def new(sketch): sketch_template = _jinja_env.get_template("sketch.js") data_template = _jinja_env.get_template("data.yaml") - create_file(os.path.join(path, "sketch.js"), sketch_template.render()) - create_file(os.path.join(path, "data.yaml"), data_template.render()) + create_file(os.path.join(path, "data.yaml"), data_template.render( + today = date.today().strftime("%Y-%m-%d") + )) echo(f"\nYour new sketch {path} is ready.\n") \ No newline at end of file diff --git a/ginpar/templates/sketch/data.yaml b/ginpar/templates/sketch/data.yaml index 2ce5a11..d800707 100644 --- a/ginpar/templates/sketch/data.yaml +++ b/ginpar/templates/sketch/data.yaml @@ -1,7 +1,9 @@ --- -- var: DIMENSIONS - attrs: - type: dimensions - value: - - 2048 - - 2048 +date: {{ today }} +params: + - DIMENSIONS: + attrs: + type: dimensions + value: + - 2048 + - 2560 \ No newline at end of file diff --git a/ginpar/templates/sketch/sketch.js b/ginpar/templates/sketch/sketch.js index c8ea081..f6c24e6 100644 --- a/ginpar/templates/sketch/sketch.js +++ b/ginpar/templates/sketch/sketch.js @@ -2,7 +2,7 @@ * to do it, you **must** use `var` instead of `let` or `const`. */ -var DIMENSIONS = [400, 2048] +var DIMENSIONS = [2048, 2048] /** * Standard function of p5js From 2ba6a02190e2a51fac7c29217e8e060dbf5af2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Omar=20Flores=20Ch=C3=A1vez?= Date: Tue, 29 Oct 2019 20:35:07 -0600 Subject: [PATCH 2/3] Make `build.py` respect existent ["name"] for the sketch attributes Instead of trying to obtain a display name for every variable name, check for the existence of a custom display name before, and use it in case it exists. --- ginpar/build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ginpar/build.py b/ginpar/build.py index efc7603..358b66e 100644 --- a/ginpar/build.py +++ b/ginpar/build.py @@ -237,11 +237,15 @@ def render_index(build_path, sketches, site, page_template): def param_to_dict(param): param_var = list(param)[0] + if "name" in param[param_var]: + name = param[param_var]["name"] + else: + name = camel_to_space(param_var.capitalize()) return { "var": param_var, "id": param_var.lower(), "attrs": param[param_var]["attrs"], - "name": param_var.capitalize() + "name": name } From 0cc4977cc752cdbc2d6271bf596533989d422410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Omar=20Flores=20Ch=C3=A1vez?= Date: Tue, 29 Oct 2019 23:52:46 -0600 Subject: [PATCH 3/3] Bump v0.7.4 --- docs/source/conf.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 47b1aa1..bc16c91 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = 'David Omar Flores Chavez' # The full version, including alpha/beta/rc tags -release = 'v0.7.3' +release = 'v0.7.4' # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index 42324a6..c378e74 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import setuptools -version = '0.7.3' +version = '0.7.4' requires = ['jinja2 >= 2.7', 'pyyaml', 'click']