Skip to content

Commit

Permalink
rename uri to url
Browse files Browse the repository at this point in the history
  • Loading branch information
bollwyvl committed Dec 21, 2024
1 parent 1af785f commit 8853f17
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [#36]
- adds support for binary files, e.g. uploaded images, in `to_zip_url` template filter
- `to_zip_url` accepts a `name` parameter, to encode into the Data URL
- adds `data_uri_file` and `data_uri_mime` to extract the file name/MIME type from a
- adds `data_url_file` and `data_url_mime` to extract the file name/MIME type from a
Data URL

[#36]: https://github.com/deathbeds/urljsf/pull/36
Expand Down
4 changes: 2 additions & 2 deletions docs/demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ def installer() -> Urljsf:
- a `.github/pull_request_template.md`
{%- if data.pixi.icon -%}
{%- set regExp = r/name=(.*?);/ -%}
{%- set icon = data.pixi.icon | data_uri_file -%}
{%- set icon = data.pixi.icon | data_url_file -%}
{%- set files = (files.push([icon, data.pixi.icon]), files) %}
- `{{ icon }}`, an icon `{{ data.pixi.icon | data_uri_mime }}` file)
- `{{ icon }}`, an icon `{{ data.pixi.icon | data_url_mime }}` file)
{%- endif %} and ):_
```
Expand Down
4 changes: 2 additions & 2 deletions docs/use/advanced/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ compatibility layer][jinjacompat], some custom filters are available by default,
| [format][ff] | filter | note |
| :----------: | -------------------------- | -------------------------------------------------------------------------------------- |
| | `base64` | encode a string as [`Base64`][base64], useful for encoding arbitrary data in URLs |
| | `data_uri_file` | get the file name from a Data URL |
| | `data_uri_mime` | get the MIME type from a Data URL |
| | `data_url_file` | get the file name from a Data URL |
| | `data_url_mime` | get the MIME type from a Data URL |
| | `from_entries` | build an object from `[key,value]` pairs with [`Object.entries`][entries] |
| | `prune` | recursively remove `null` or empty objects and arrays, useful in TOML |
| | `schema_errors(schema)` | get schema validation errors |
Expand Down
8 changes: 4 additions & 4 deletions js/src/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ async function zipFilters(): Promise<IFilters> {
};
}

function data_uri_file(value: string) {
function data_url_file(value: string) {
const match = RE_URI_FILENAME.exec(value);
return match ? match[1] : null;
}

function data_uri_mime(value: string) {
function data_url_mime(value: string) {
const match = RE_URI_MIME_TYPE.exec(value);
return match ? match[1] : null;
}

export const URLJSF_FILTERS = {
prune,
base64: btoa,
data_uri_file,
data_uri_mime,
data_url_file,
data_url_mime,
from_entries,
schema_errors,
};

0 comments on commit 8853f17

Please sign in to comment.