From b29dd58c6b63a647c1f7bc5a115ab6d16e1d4cf5 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 1 May 2017 23:41:56 -0400 Subject: [PATCH] Added IDEAS file to docs as a place to collect ideas as I have them. --- docs/IDEAS.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/IDEAS.md diff --git a/docs/IDEAS.md b/docs/IDEAS.md new file mode 100644 index 0000000..c37fb1c --- /dev/null +++ b/docs/IDEAS.md @@ -0,0 +1,76 @@ +Ideas +===== + +This file is simply a collection of ideas for future capabilities of glabels. +The ideas may or may not be very well thought out -- it simply a scratchpad. + + +Merge Fields +------------ + +Currently substitution fields are specified simply by `${field-name}`. Here, I +am exploring ideas to extend this to be a richer substitution language. +Some of the criteria to consider are: + + - A rich formatting capability probably cannot be done through GUI controls alone. + - It should be simple and easy to understand, but also powerful. + - Is there an existing language that can be used in whole or in part. + + +## Format Control +It is desirable to control the format of the fields -- e.g. decimal, hex, +number of digits, leading zeros, fixed width, left or right justification, +etc. Perhaps something like `${NAME:%-10s}`, i.e. +`${field-name:printf-style-format}`. + + +## Default Values +It would also be desirable to specify a default value. (Or an initial value +in the event of a counter, see Label Counter below.) Perhaps, something like +`${field-name:=value}` + + +## Possible Syntax +This is the first stab at a syntax specification. It is roughly based on +the parameter substitution of the Bourne shell. + +``` + ::= "${" [ ":" _modifiers_ ] "}" + ::= [ ":" ] + ::= { "%" | "=" } +``` + +Need a way to quote "`:`" in value. Perhaps "`\:`" or maybe string values +should always be in quotes (you would still need to quote out quotes. + + +## Special Builtin Fields + +### Label Counter + +It would be nice if there was a label counter field. Maybe something like +`${#}` or `${label#}`. Also desirable would be the ability to set the start +value. Possibly even reading it from a file and updating the file each time. +You would want to control if the value is repeated for copies or every copy +would be unique -- perhaps two different fields. It would also be desirable to +control the format of the counter -- e.g. decimal, hex, number of digits, or +leading zeros. + +### Date and Time Fields + +Date and time fields would need to be able to be formatted much like strftime. + + +## Examples +Just some examples of the type of thing I am thinking. + +``` +${1} /// CSV column 1 +${addr1} /// Field named "addr1" +${n:%09d} /// Field named "n", format as 9 decimal digits with leading zeros +${MI:=NMI} /// Field named "MI", with default value of "NMI" +${#:%06d:=1000} /// Label counter, format as 6 decimal digits with leading zeros, starting at 1000 +${#:%06d:count.txt} /// Perhaps a way to read and write the starting and ending value + +``` +