Skip to content

Commit

Permalink
Add README links
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudcolas committed Oct 30, 2020
1 parent 9e24f68 commit a39b8c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ Documentation is available at [torchbox.github.io/django-pattern-library/](https

- [Getting started](https://torchbox.github.io/django-pattern-library/getting-started/)
- Guides
- [Defining template context](https://torchbox.github.io/django-pattern-library/guides/defining-template-context/)
- [Overriding template tags](https://torchbox.github.io/django-pattern-library/guides/overriding-template-tags/)
- [Customizing template rendering](https://torchbox.github.io/django-pattern-library/guides/customizing-template-rendering/)
- [Workflows that work](https://torchbox.github.io/django-pattern-library/guides/workflows-that-work/)
- Reference
- [API & settings](https://torchbox.github.io/django-pattern-library/reference/api/)
- [Known issues and limitations](https://torchbox.github.io/django-pattern-library/reference/known-issues/)

## Contributing

Expand Down
13 changes: 7 additions & 6 deletions docs/guides/overriding-template-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ The override process has two parts:
1. Override your template tag with a mock implementation
2. Define fake result for your tag in a YAML file

## Providing a default value for template tags

### Providing a default value for template tags
To provide a default for a template tag, you need to provide a keyword argument default_html when overriding your tag.

```
```python
from pattern_library.monkey_utils import override_tag

override_tag(register, 'a_tag_name', default_html="https://potato.com")
override_tag(register, 'a_tag_name', default_html="https://example.com/")
```

This default is used for any tag that's not passed its own context, allowing specificity for those elements that need it while preventing the tag from breaking when it's not structural to the component.

#### Limitation
Currently this feature only supports providing a default for the output of the tag, this does not support modifying context in templates such as {% an_example_tag page.url as example_variable %}.
### Limitation

Currently this feature only supports providing a default for the output of the tag, this does not support modifying context in templates such as `{% an_example_tag page.url as example_variable %}`.

### When do I need to override a template tag?

Ideally your pattern library should be independent, so it doesn't fail when
Expand Down Expand Up @@ -252,4 +254,3 @@ tags:
```

Note the `target_var` field.

2 changes: 1 addition & 1 deletion docs/reference/known-issues.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Known issues
# Known issues and limitations

django-pattern-library has a few known limitations due to its design, which are worth knowing about when authoring templates or attempting to document them in the pattern library.

Expand Down

0 comments on commit a39b8c9

Please sign in to comment.