PronounsToday/doc/User-Preference-String-Spec.txt

57 lines
2.7 KiB
Plaintext

User preferences are an unpadded base32 string, whose contents are defined in this
document. Because the pref string is passed through the page URL, a small size is a top
priority.
user-preferences := [spec-version spec-variant contents]
spec-version := 5 bits
spec-variant := 3 bits
contents := version-0 | ...
If user-preferences is not present (i.e. is zero-length), then the default preferences
should be assumed. Default preferences will be set by the instance operator
version-1 := variant-0-0
variant-0-0 := default-enabled default-weight *command
default-enabled := 1 bit
default-weight := weight
Variant zero works with a series of commands. The version starts off with one byte. The
first bit defines whether pronoun sets are enabled or disabled by default. A 1 indicates
that all pronoun sets are enabled by default. The next 7 bits are the default weight of
any enabled pronoun set. Disabled pronoun sets have a weight of zero.
Following these defaults are a series of commands. The resolution of this algorithm
assumes a cursor that moves over the list of pronoun sets. The cursor starts at the first
pronoun set. After the execution of each command, the cursor moves forward by one pronoun
set.
Every pronoun set is either enabled or disabled. Enabled pronoun sets have the default
weight, unless overridden. Each command is exactly one byte
command := set-weight | skip
set-weight := "0b" weight
weight := 7 bits
The set weight command sets the weight of the pronoun set under the cursor, and implicitly
enables it, if it wasn't already enabled. The cursor moves forward by one pronoun set
after executing the command, so several set-weight commands can be chained together in
order to set several pronoun sets in a row.
skip := "1b" toggle-enabled distance
toggle-enabled := 1 bit
distance := 6 bits
The skip command moves the cursor ahead by a certain number of pronoun sets, and then
optionally enables or disables the pronoun set under the cursor. If toggle-enabled is set
to 1, then the "enabled" state of the pronoun set is toggled. Otherwise, it is left as
the default. If a pronoun set is moved into the enabled state, it's weight is set to the
default pronoun set weight. To set it to a different weight, move the cursor to one
before the target pronoun set (without toggling state) and then issue a set-weight
command.
Remember that the cursor moves forward after EVERY command, including the skip command.
This means that to set a weight other than the default weight, you must move the cursor to
one before the pronoun set you want to change, and then issue a set-weight command.