Skip to content

Commit

Permalink
Merge 3dac3de into 2f6dee6
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhub committed Jul 26, 2019
2 parents 2f6dee6 + 3dac3de commit 403c127
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
38 changes: 38 additions & 0 deletions docs/cli/creation.md
Expand Up @@ -39,3 +39,41 @@ linked item: TST001 (@/reqs/tests/TST001.yml) -> REQ001 (@/reqs/REQ001.yml)

It is not allowed to create links which would end up in a self reference or
cyclic dependency.

# Document Configuration

The settings and attribute options of each document are stored in a
corresponding `.doorstop.yml` file. Some configuration options can be set via
`doorstop create` command line parameters such as the document *prefix*, the
item UID *digits*, and the *parent* prefix. Others can only be changed by
manually editing the configuration file. The list of options follows:

* *settings*

* *digits*: defines the number of digits in an item UID. The default value
is 3. Optionally, you can set it through the `-d` command line option of
the `doorstop create` command. It is a mandatory and read-only document
setting.

* *parent*: defines the parent document prefix. You set it through the `-p`
command line option of the `doorstop create` command. It is an optional
and read-only document setting.

* *prefix*: defines the document prefix. You set it through the prefix of
the `doorstop create` command. It is a mandatory and read-only document
setting.

* *sep*: defines the separator between the document prefix and the number in
an item UID. The default value is the empty string. You have to set it
manually before an item is created. Afterwards, it should be considered as
read-only. This document setting is mandatory.

* *attributes*

* *defaults*: defines the
[defaults for extended attributes](../reference/item.md#defaults-for-extended-attributes).
This is an optional document configuration option.

* *reviewed*: defines which
[ extended attributes contribute to the item fingerprint](../reference/item.md#extended-reviewed-attributes).
This is an optional document configuration option.
4 changes: 2 additions & 2 deletions docs/reference/item.md
Expand Up @@ -285,7 +285,7 @@ In this example, an extended attribute `invented-by` is added to the item.
invented-by: jane@example.com
```

**Defaults for extended attributes**
## Defaults for extended attributes

Optionally, you can add custom default values for extended attributes. Add
them as key-value pairs to the `defaults` dictionary under the `attributes`
Expand All @@ -310,7 +310,7 @@ attributes:
attribute-key-3: ... default values can be arbitrarily complex
```

**Extended reviewed attributes**
## Extended reviewed attributes

By default, the values of extended attributes do **not** contribute to the
[fingerprint](item.md#reviewed) of the item. Optionally, you can add the
Expand Down
6 changes: 1 addition & 5 deletions doorstop/core/document.py
Expand Up @@ -183,15 +183,11 @@ def save(self):
for key, value in self._data.items():
if key == 'prefix':
sets[key] = str(value)
elif key == 'sep':
sets[key] = value
elif key == 'digits':
sets[key] = value
elif key == 'parent':
if value:
sets[key] = value
else:
data[key] = value
sets[key] = value
data['settings'] = sets
# Save the attributes
attributes = {}
Expand Down

0 comments on commit 403c127

Please sign in to comment.