Constant tpnote_lib::config::TMPL_FROM_CLIPBOARD_CONTENT
source · pub const TMPL_FROM_CLIPBOARD_CONTENT: &str = "\
{%- set lname = stdin ~ clipboard | link_text -%}
{%- set is_link_text =
lname !='' and
not lname is starting_with(\"http\")
and not lname is starting_with(\"HTTP\") -%}
{%- if is_link_text -%}
{%- set title_text = stdin ~ clipboard | link_text -%}
{%- else -%}
{%- set title_text = stdin ~ clipboard | heading -%}
{% endif -%}
---
title: {{ title_text | cut | json_encode }}
{% if stdin ~ clipboard | link_text !='' and
stdin ~ clipboard | cut | linebreaksbr == stdin ~ clipboard | cut -%}
subtitle: {{ 'URL' | json_encode -}}
{%- else -%}
subtitle: {{ 'Note' | json_encode -}}
{%- endif %}
author: {{ username | capitalize | json_encode }}
date: {{ now() | date(format='%Y-%m-%d') | json_encode }}
lang: {{ title_text | get_lang | map_lang(default=lang) | json_encode }}
---
{{ stdin ~ clipboard }}
";Expand description
Default template used, when the clipboard or the input stream stdin
contains a string and this string has no valid YAML front matter section.
The clipboards content is in {{ clipboard }}, its truncated version in
{{ clipboard | heading }} When the clipboard contains a hyperlink in
Markdown or reStruncturedText format. See crate parse-hyperlinks for
details. For example: [<link-name>](<link-url> "link-title"), can be
accessed with the variables: {{ clipboard | link_text }}, {{ clipboard | link_dest }} and {{ clipboard | linkttitle }}.