Skip to content

Commit e9331d6

Browse files
committed
add documentation on using the fill command
1 parent 1f2813d commit e9331d6

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

docs/manual.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,37 @@ target is enabled, `somesy` will generate your `codemeta.json` by:
387387
As `codemeta.json` is considered a technical "backend-format" derived from other
388388
inputs, in most cases you probably do not need or should edit it by hand anyway.
389389

390+
## Using somesy to insert metadata into project documentation
391+
392+
While `somesy` can synchronize structured metadata files and formats, there is a common case that cannot be covered by the `sync` command - when project metadata should appear in plain text documents, such as documentation files and web pages.
393+
394+
As for documentation the needs and used tooling in different projects is vastly different, `somesy` provides a very general solution to this problem
395+
with the `fill` command. It takes a
396+
[Jinja2](https://jinja.palletsprojects.com/en/3.1.x/)
397+
template and returns the resulting file where the project metadata is inserted the form dictated by the template.
398+
399+
For example, a template is used to generate the
400+
[`AUTHORS.md`](https://github.com/Materials-Data-Science-and-Informatics/somesy/blob/main/AUTHORS.md)
401+
file in the somesy repository, which is also shown as the
402+
[Credits](./credits.md) page, using the following command:
403+
404+
```shell
405+
somesy fill docs/_template_authors.md -o AUTHORS.md
406+
```
407+
408+
??? example "_template_authors.md"
409+
```
410+
--8<-- "docs/_template_authors.md"
411+
```
412+
413+
??? example "AUTHORS.md"
414+
```
415+
--8<-- "AUTHORS.md"
416+
```
417+
418+
The template gets the complete
419+
[ProjectMetadata](reference/somesy/core/models.md#somesy.core.models.ProjectMetadata) as its context, so it is possible to access all included project and contributor information.
420+
390421
## FAQ
391422

392423
### Somesy introduces it's own metadata format... isn't this counter-productive?

0 commit comments

Comments
 (0)