Skip to content

Commit

Permalink
feat: add the reference of the sprites in the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorin committed Mar 18, 2023
1 parent 2c3d5d4 commit 6fd37b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/library/generate/tasks/item/item_documentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl ItemDocumentationTask {
})
}
pub fn get_relative_documentation_path(&self) -> Box<Path> {
Box::from(Path::new(format!("{}.md", self.item_urn, ).as_str()))
Box::from(Path::new(format!("{}.md", self.item_urn,).as_str()))
}
fn get_full_documentation_path(&self) -> Box<Path> {
Path::new(&self.output_directory)
Expand Down Expand Up @@ -201,7 +201,7 @@ mod test {
"{}/{}.md",
generator.output_directory, generator.item_urn,
))
.unwrap();
.unwrap();
assert!(content.contains(r"# Item"));
assert!(content.contains(r"| Illustration | Icon | Card | Group |"));
assert!(content.contains(r"| ![illustration for Illustration](../../.././Icon.png) | ![illustration for Icon](../../.././Item.png) | ![illustration for Card](../../.././ItemCard.png) | ![illustration for Group](../../.././ItemGroup.png) |"));
Expand Down
14 changes: 14 additions & 0 deletions src/cmd/library/generate/templates/item_documentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ include('{{ data.item_urn }}')
{% endif -%}
{% endblock objects %}
{% set icons = data.objects | filter(attribute="type", value="Icon") -%}
{% block sprites %}
{% if icons | length > 0 -%}
## Sprites
The item provides the following stipes
{% for icon in icons %}
- `${{ icon.name }}Xs`
- `${{ icon.name }}Sm`
- `${{ icon.name }}Md`
- `${{ icon.name }}Lg`
{% endfor %}
{% endif -%}
{% endblock sprites %}
{% set elements = data.objects | filter(attribute="type", value="Element") -%}
{% block elements %}
{% if elements | length > 0 -%}
Expand Down

0 comments on commit 6fd37b6

Please sign in to comment.