This tool requires a description TEMPLATE that is tagged with "keys"
and a SPREADSHEET of replacement values for each "key".
It will produce a spreadsheet of descriptions from those inputs.
A "key" is a placeholder variable that you define and add within the TEMPLATE.
Keys are always enclosed in double braces,
so a key indicating a title within the template might be called {{title}},
and a product brand might be called {{brand}}.
All keys are user-definable. They are not case sensitive, so upper and lower case keys are considered identical.
The chosen format for the key must be exactly the same throughout the template and within the spreadsheet.
Keys can be placed anywhere in the template.
Any keys within a template that are without spreadsheet substitutions will be removed from the final output.
Marking the TEMPLATE
There are two kinds of keys within a TEMPLATE: replacement keys and option keys:
- Replacement Keys, which are simple "substitutions" or "variables", will be the most popular
and look like {{title}} or {{brand}} or {{size}}.
A Replacement Key may include most characters, but can not begin with "?".
User-defined spreadsheet data will replace the key, wherever it is found within the template.
The same keys can be used multiple times within the same template,
as when a product brand appears multiple times within a description.
The user replacement can be a single word or multiple paragraphs of HTML code.
- Option Keys are more complex and add power to a template.
An option key can be any alphanumeric word of any length,
and may include uppercase letters, lowercase letters, and numbers.
No other punctuation, symbols, or extended characters are allowed within the keys.
Rather than being a direct substitution, an option key is just a code that
identifies a section of the template to include or remove.
Various options (or choices) can be loaded into the template, to be chosen by a keyword in the spreadsheet data.
Options look like {{?option?text here}}.
Notice that options use a keyword that is surrounded by question marks,
and the entire phrase is bracketed with curly braces.
Options allow the user to predefine words, sentences, or blocks of text
that can be selected by the spreadsheet to customize a template to a product.
Examples are:
{{?option1?This item will shrink when washed.}}
{{?option2?We have preshrunk this item to guarantee proper fit.}}
Options reside within the template and are selected using keywords out in the spreadsheet.
Many different options or "selectables" can be added to a template, while unused options will be purged.
And the same key can be used for multiple options.
For instance, in a template for all sorts of clothing,
every block of text that belongs to a skirt can be marked with the same keyword, such as:
{{?skirt?Fully lined}}
{{?skirt?Side zipper}}
{{?skirt?Full waistband.}}
Options may include replacement keys, but the opposite is not allowed.
For instance, this scenario is allowed:
{{?option1?When washed, this item will shrink from a {{sizeA}} to a {{sizeB}}.}}"
Notice that the entire option is enclosed in double braces, and so are the included replacement keys.
A user may want to make options for different types of products,
and may find that some can be shared and some can not.
Shared options can be set up with a shared key that is pipe-delimited.
For example, both the Lee brand and the Levis brands can select the same "shrink" message.
{{?Lee|levis?This item will shrink when washed.}}
{{?skirt|Lee|levis?Full waistband.}}
Controlling the template with a SPREADSHEET
The spreadsheet must have at least two columns, although one column can be empty.
The spreadsheet must have a header row containing keys that will match the template.
The same key can not be reused to head other columns — each column must have a unique key as its header.
The two types of keys (replacement keys and option keys) are treated differently in the spreadsheet.
The keys in the spreadsheet must be identical to the template keys,
but will not have the braces or question marks that appear in the template.
- Replacement keys (in the spreadsheet) for simple substitutions:
In our example above, the template included {{title}} and {{brand}},
so those would be headings on spreadsheet columns.
The actual data for each listing would appear in the rows below those headers.
One row might have New dark blue denim Levis in a cell under title
and might contain Levis under the brand heading.
A complex replacement key is also allowed in the spreadsheet.
The heading might be features and the data cell might include a bullet list of features.
Rather than listing all the HTML in the cell data,
we can pipe-delimit (|) the start and end tag, or code, in the header name,
and then pipe-delimit the feature list in the subsequent data cells, like this:
Heading: Features(<li>|<li>)
Cell data: Pearl buttons|Fully lined|Pointed collar|Tailored hem
Realizing that it may be easier to paste bullet rows into a cell, rather than pipe-delimiting the cell data,
and that other pasted text may contain linebreaks, this tool will accept linebreaks within cells.
However, the tool must be told this is the plan by adding a new column to the front of the spreadsheet.
The first cell of every row in the spreadsheet must contain the @-symbol
followed by a few non-delimiter characters to signal the start of a new row.
Each row must use the same @-start code.
Something like @@ would work.
There can be no spaces or characters ahead of the @-symbol in a row.
With this designation, linebreaks found within a data cell will be converted to pipe-delimited data within that cell,
and will be used as an option list in template substitutions.
Spreadsheet data cells may also embed additional replacement keys, as long as the data to populate those keys
will be found in subsequent columns, rather than in earlier columns.
This ability will allow extending a template using the spreadsheet.
- Selectable options:
The only requirement for an option-list header is that it start with a "?".
Everything after the "?" in the header cell is unused by the system,
and multiple option columns are allowed as long as each heading includes a unique identifier after the "?".
The sytem will collect all the row data for all the "?" columns and will treat them as one big group for that specific row.
Options are processed after the substitutions are processed.
Option columns are lists of keys (codes) that select which options to turn on in the template.
Option cells should not include any other data.
However, since all option keys are grouped and applied last, you are allowed to separate them into useful columns
and can combine keys under one heading if the keys are pipe-delimited.
In the examples above, we used these options "option1,option2,skirt,Lee,levis",
so they could be formatted in various rows under one "?" heading as needed, like option1|levis.
But if we want to segregate our lists, we could create two columns:
?wash and ?details
with contents like option1 and Lee for one product row,
and option2 and skirt for another product row.
Unused options that are encoded in the template will be removed from the code output.
OVERVIEW | Key (simple) | Key (complex) | Option Key |
Template key | {{title}} | {{specs}} | {{?Levi? text here}} |
Spreadsheet Heading | title | specs(<li>|<\li>) | ? |
Spreadsheet data | Great new item | Unwashed |black| loose-fit | Levi | Lee |
Spreadsheet data | New Blue Denims | Original |501| 32W 31L | Levi |
Spreadsheet data | Preshunk Jeans Sale | Prewashed |blue | Lee |