Squashed 'themes/tabi-lean/' content from commit efb4246
git-subtree-dir: themes/tabi-lean git-subtree-split: efb42461fde7ee5b0c140d27f2789fdf9c98b100
This commit is contained in:
commit
8be91ee3d9
336 changed files with 25227 additions and 0 deletions
30
templates/shortcodes/remote_text.html
Normal file
30
templates/shortcodes/remote_text.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{%- set start = start | default(value=1) -%}
|
||||
{%- set end = end | default(value=0) -%}
|
||||
|
||||
{#- load_data uses different arguments based on whether it's a remote or local file -#}
|
||||
{%- if src is starting_with("http") -%}
|
||||
{%- set response = load_data(url=src, format="plain") -%}
|
||||
{%- else -%}
|
||||
{#- Try to load the file from a relative path -#}
|
||||
{%- set colocated_path = page.colocated_path | default(value="") -%}
|
||||
{%- set relative_path = colocated_path ~ src -%}
|
||||
{%- set response = load_data(path=relative_path, format="plain", required=false) -%}
|
||||
{#- If relative path fails, try absolute path -#}
|
||||
{%- if not response -%}
|
||||
{%- set response = load_data(path=src, format="plain") -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- set lines = response | trim_end | split(pat="\n") -%}
|
||||
|
||||
{%- if start > 0 -%}
|
||||
{%- set start = start - 1 -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if end == 0 or end > lines | length -%}
|
||||
{%- set end = lines | length -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- set lines = lines | slice(start=start, end=end) -%}
|
||||
|
||||
{{- lines | join(sep="\n") | safe -}}
|
Loading…
Add table
Add a link
Reference in a new issue