version = '1.11.1'
extension_default = 'md'
note_file_extensions_md = [
    'md',
    'markdown',
    'markdn',
    'mdown',
    'mdtxt',
]
note_file_extensions_rst = [
    'rst',
    'rest',
]
note_file_extensions_html = ['htmlnote']
note_file_extensions_txt = [
    'txtnote',
    'adoc',
    'asciidoc',
]
note_file_extensions_no_viewer = [
    't2t',
    'textile',
    'twiki',
    'mediawiki',
]
tmpl_new_content = '''
---
title:      {{ path | trim_tag | cut | json_encode }}
subtitle:   {{ 'Note' | json_encode }}
author:     {{ username | json_encode }}
date:       {{ now() | date(format='%Y-%m-%d') | json_encode }}
lang:       {{ get_env(name='LANG', default='') | json_encode }}
---


'''
tmpl_new_filename = '''{{ now() | date(format='%Y%m%d') }}-{{ fm_title | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_subtitle | default(value='') | sanit  }}{{ extension_default | prepend_dot }}'''
tmpl_copy_content = '''
---
title:      {{ fm_title | default(value = path|trim_tag) | cut | json_encode }}
subtitle:   {{ fm_subtitle | default(value = 'Note') | cut | json_encode }}
author:     {{ fm_author | default(value=username) | json_encode }}
date:       {{ fm_date | default(value = now()|date(format='%Y-%m-%d')) | json_encode }}
lang:       {{ fm_lang | default(value = get_env(name='LANG', default='')) | json_encode }}
{% for k, v in fm_all| remove(var='fm_title')| remove(var='fm_subtitle')| remove(var='fm_author')| remove(var='fm_date')| remove(var='fm_lang') %}{{ k }}:		{{ v | json_encode }}
{% endfor %}---

{{ stdin ~ clipboard }}

'''
tmpl_copy_filename = '''{{ fm_sort_tag | default(value = now() | date(format='%Y%m%d-')) }}{{ fm_title | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_subtitle | default(value='') | sanit  }}{{ fm_file_ext | default(value = extension_default ) | prepend_dot }}'''
tmpl_clipboard_content = '''
{%- set lname = stdin ~ clipboard | linkname -%}
{%- set ok_linkname = lname !=''and not lname is starting_with("http")and not lname is starting_with("HTTP") -%}
---
{% if ok_linkname %}title:      {{ stdin ~ clipboard | linkname | cut | json_encode }}
{% else %}title:      {{ stdin ~ clipboard | heading | cut | json_encode }}
{% endif %}{% if stdin ~ clipboard | linkname !='' and stdin ~ clipboard | heading == stdin ~ clipboard %}subtitle:   {{ 'URL' | json_encode }}
{% else %}subtitle:   {{ 'Note' | json_encode }}
{% endif %}author:     {{ username | json_encode }}
date:       {{ now() | date(format='%Y-%m-%d') | json_encode }}
lang:       {{ get_env(name='LANG', default='') | json_encode }}
---

{{ stdin ~ clipboard }}

'''
tmpl_clipboard_filename = '''{{ now() | date(format='%Y%m%d-') }}{{ fm_title | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_subtitle | default(value='') | sanit  }}{{ extension_default | prepend_dot }}'''
tmpl_annotate_content = '''
---
title:      {% filter json_encode %}{{ file | stem }}{{ file | ext | prepend_dot }}{% endfilter %}
{% if stdin ~ clipboard | linkname !='' and stdin ~ clipboard | heading == stdin ~ clipboard %}subtitle:   {{ 'URL' | json_encode }}
{% else %}subtitle:   {{ 'Note' | json_encode }}
{% endif %}author:     {{ username | json_encode }}
date:       {{ now() | date(format='%Y-%m-%d') | json_encode }}
lang:       {{ get_env(name='LANG', default='') | json_encode }}
---

[{{ file | tag }}{{ file | stem }}{{ file | ext | prepend_dot }}](<{{ file | tag }}{{ file | stem }}{{ file | ext | prepend_dot }}>)
{% if stdin ~ clipboard != '' %}{% if stdin ~ clipboard != stdin ~ clipboard | heading %}
---
{% endif %}
{{ stdin ~ clipboard }}
{% endif %}
'''
tmpl_annotate_filename = '''{{ file | tag }}{{ fm_title | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_subtitle | default(value='') | sanit }}{{ extension_default | prepend_dot }}'''
tmpl_sync_filename = '''{{ fm_sort_tag | default(value = file | tag) }}{{ fm_title | default(value='No title') | sanit(alpha=true) }}{% if fm_subtitle | default(value='') | sanit != '' %}--{% endif %}{{ fm_subtitle | default(value='') | sanit  }}{{ fm_file_ext | default(value = file | ext) | prepend_dot }}'''
tmpl_compulsory_field_content = 'title'
editor_args = [
    [
    'code',
    '-w',
    '-n',
],
    [
    'flatpak',
    'run',
    'com.visualstudio.code',
    '-w',
    '-n',
],
    [
    'atom',
    '-w',
],
    [
    'marktext',
    '--no-sandbox',
    '--new-window',
],
    [
    'flatpak',
    'run',
    'com.github.marktext.marktext',
    '--new-window',
],
    ['typora'],
    ['retext'],
    [
    'geany',
    '-s',
    '-i',
    '-m',
],
    [
    'gedit',
    '-w',
],
    ['mousepad'],
    ['leafpad'],
    [
    'nvim-qt',
    '--nofork',
],
    [
    'gvim',
    '--nofork',
],
]
editor_console_args = [
    ['nano'],
    ['nvim'],
    ['vim'],
    ['emacs'],
    ['vi'],
]
clipboard_read_enabled = true
clipboard_empty_enabled = true
copy_counter_extra_separator = '-'
copy_counter_opening_brackets = '('
copy_counter_closing_brackets = ')'
viewer_enabled = true
viewer_notify_period = 1000
viewer_served_mime_types = [
    [
    'bmp',
    'image/bmp',
],
    [
    'gif',
    'image/gif',
],
    [
    'ico',
    'image/vnd.microsoft.icon',
],
    [
    'jpeg',
    'image/jpeg',
],
    [
    'jpg',
    'image/jpeg',
],
    [
    'png',
    'image/png',
],
    [
    'svg',
    'image/svg+xml',
],
    [
    'tiff',
    'image/tiff',
],
    [
    'tif',
    'image/tiff',
],
    [
    'webp',
    'image/webp',
],
]
viewer_rendition_tmpl = '''
<!DOCTYPE html>
<html lang="{{ fm_lang | default(value='en') }}">
<head>
<meta charset="utf-8">
<title>{{ fm_title }}</title>
<style>
table, th, td { font-weight: normal; }
table.center {
  margin-left: auto;
  margin-right: auto;
  background-color: #f3f2e4;
  border:1px solid grey;
}
th, td {
  padding: 3px;
  padding-left:15px;
  padding-right:15px;
}
th.key{ color:#444444; text-align:right; }
th.val{
  color:#316128;
  text-align:left;
  font-family:sans-serif;
}
th.keygrey{ color:grey; text-align:right; }
th.valgrey{ color:grey; text-align:left; }
pre { white-space: pre-wrap; }
em { color: #523626; }
a { color: #316128; }
h1 { font-size: 150% }
h2 { font-size: 132% }
h3 { font-size: 115% }
h4, h5, h6 { font-size: 100% }
h1, h2, h3, h4, h5, h6 { color: #263292; font-family:sans-serif; }

</style>
  </head>
  <body>
  <table class="center">
    <tr>
    <th class="key">title:</th>
    <th class="val"><b>{{ fm_title }}</b></th>
  </tr>
    <tr>
    <th class="key">subtitle:</th>
    <th class="val">{{ fm_subtitle | default(value='') }}</th>
  </tr>
    <tr>
    <th class="keygrey">date:</th>
    <th class="valgrey">{{ fm_date | default(value='') }}</th>
  </tr>
  {% for k, v in fm_all| remove(var='fm_title')| remove(var='fm_subtitle')| remove(var='fm_date') %}
    <tr>
    <th class="keygrey">{{ k }}:</th>
    <th class="valgrey">{{ v }}</th>
  </tr>
  {% endfor %}
  </table>
  <div class="noteBody">{{ noteBody }}</div>
  <script>{{ noteJS }}</script>
</body>
</html>
'''
viewer_error_tmpl = '''
<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"utf-8\">
<title>Syntax error</title>
<style>
.noteError { color: #523626; }
pre { white-space: pre-wrap; }
a { color: #316128; }
h1, h2, h3, h4, h5, h6 { color: #d3af2c; font-family:sans-serif; }
</style>
</head>
<body>
<h3>Syntax error</h3>
<p> in note file: <pre>{{ file }}</pre><p>
<div class="noteError">
<hr>
<pre>{{ noteError }}</pre>
<hr>
</div>
{{ noteErrorContent }}
<script>{{ noteJS }}</script>
</body>
</html>
'''
exporter_rendition_tmpl = '''
<!DOCTYPE html>
<html lang="{{ fm_lang | default(value='en') }}">
<head>
<meta charset="utf-8">
<title>{{ fm_title }}</title>
<style>
table, th, td { font-weight: normal; }
table.center {
  margin-left: auto;
  margin-right: auto;
  background-color: #f3f2e4;
  border:1px solid grey;
}
th, td {
  padding: 3px;
  padding-left:15px;
  padding-right:15px;
}
th.key{ color:#444444; text-align:right; }
th.val{
  color:#316128;
  text-align:left;
  font-family:sans-serif;
}
th.keygrey{ color:grey; text-align:right; }
th.valgrey{ color:grey; text-align:left; }
pre { white-space: pre-wrap; }
em { color: #523626; }
a { color: #316128; }
h1 { font-size: 150% }
h2 { font-size: 132% }
h3 { font-size: 115% }
h4, h5, h6 { font-size: 100% }
h1, h2, h3, h4, h5, h6 { color: #263292; font-family:sans-serif; }

</style>
  </head>
  <body>
  <table class="center">
    <tr>
    <th class="key">title:</th>
    <th class="val"><b>{{ fm_title }}</b></th>
  </tr>
    <tr>
    <th class="key">subtitle:</th>
    <th class="val">{{ fm_subtitle | default(value='') }}</th>
  </tr>
    <tr>
    <th class="keygrey">date:</th>
    <th class="valgrey">{{ fm_date | default(value='') }}</th>
  </tr>
  {% for k, v in fm_all| remove(var='fm_title')| remove(var='fm_subtitle')| remove(var='fm_date') %}
    <tr>
    <th class="keygrey">{{ k }}:</th>
    <th class="valgrey">{{ v }}</th>
  </tr>
  {% endfor %}
  </table>
  <div class="noteBody">{{ noteBody }}</div>
</body>
</html>
'''
