From f6568c4a9e754b56105e0a9d1086fedd35b643b4 Mon Sep 17 00:00:00 2001 From: Joost De Cock Date: Mon, 10 Sep 2018 12:07:36 +0200 Subject: [PATCH] sparkles: Support for prefix, and made title optional --- packages/plugin-title/src/index.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/plugin-title/src/index.js b/packages/plugin-title/src/index.js index 5c16e875873..44a2a4bf513 100644 --- a/packages/plugin-title/src/index.js +++ b/packages/plugin-title/src/index.js @@ -15,15 +15,21 @@ export default { title: function(so) { let overwrite = true; if (so.append) overwrite = false; - this.points._titleNr = so.at + let prefix = ""; + if (so.prefix) prefix = so.prefix; + this.points[`_${prefix}_titleNr`] = so.at .attr("data-text", so.nr, overwrite) .attr("data-text-class", "title-nr note fill-note"); - this.points._titleName = so.at - .shift(-90, 13) - .attr("data-text", so.title) - .attr("data-text-class", "title-name"); - this.points._titlePattern = so.at - .shift(-90, 20) + let shift = 10; + if (so.title && so.title !== "") { + this.points[`_${prefix}_titleName`] = so.at + .shift(-90, 13) + .attr("data-text", so.title) + .attr("data-text-class", "title-name"); + shift += 10; + } + this.points[`_${prefix}_titlePattern`] = so.at + .shift(-90, shift) .attr("data-text", this.context.config.name) .attr("data-text", "v" + this.context.config.version) .attr("data-text-class", "title-pattern fill-note");