Skip to content

Commit 3a0c268

Browse files
committed
fix translation: move decryption_failure_message to html template
1 parent 7df9319 commit 3a0c268

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Install the package from source with pip:
6363
```bash
6464
cd mkdocs-encryptcontent-plugin/
6565
python setup.py sdist bdist_wheel
66-
pip install dist/mkdocs_encryptcontent_plugin-2.4.2-py3-none-any.whl
66+
pip install dist/mkdocs_encryptcontent_plugin-2.4.3-py3-none-any.whl
6767
```
6868

6969
Enable the plugin in your `mkdocs.yml`:

encryptcontent/decrypt-contents.tpl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ function decryptor_reaction(content_decrypted, password_input, fallback_used, se
294294
if (!fallback_used || set_global) {
295295
// create HTML element for the inform message
296296
let mkdocs_decrypt_msg = document.getElementById('mkdocs-decrypt-msg');
297-
mkdocs_decrypt_msg.textContent = '{{ decryption_failure_message }}';
297+
mkdocs_decrypt_msg.textContent = decryption_failure_message;
298298
{% if remember_password -%}
299299
delItemName(location_path);
300300
{%- endif %}

encryptcontent/decrypt-form.tpl.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ <h1>{{ summary }}</h1>
1111

1212
<script type="text/javascript">
1313
var encryptcontent_path = "{{ encryptcontent_path }}";
14+
var decryption_failure_message = {{ decryption_failure_message }};
1415
</script>
1516
{% for library in js_libraries %}
1617
<script type="text/javascript" src="{{ library }}"></script>

encryptcontent/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import base64
55
import hashlib
66
import logging
7+
import json
78
from pathlib import Path
89
from Crypto import Random
910
from jinja2 import Template
@@ -130,6 +131,7 @@ def __encrypt_content__(self, content, password, base_path, encryptcontent_path)
130131
'password_button': self.config['password_button'],
131132
'password_button_text': self.config['password_button_text'],
132133
'encryption_info_message': self.config['encryption_info_message'],
134+
'decryption_failure_message': json.dumps(self.config['decryption_failure_message']),
133135
'input_class': self.config['input_class'],
134136
'button_class': self.config['button_class'],
135137
# this benign decoding is necessary before writing to the template,
@@ -148,7 +150,6 @@ def __generate_decrypt_js__(self):
148150
decrypt_js = Template(self.config['js_template']).render({
149151
# custom message and template rendering
150152
'password_button': self.config['password_button'],
151-
'decryption_failure_message': self.config['decryption_failure_message'],
152153
# enable / disable features
153154
'arithmatex': self.config['arithmatex'],
154155
'hljs': self.config['hljs'],

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def read(fname):
1111

1212
setup(
1313
name='mkdocs-encryptcontent-plugin',
14-
version='2.4.2',
14+
version='2.4.3',
1515
author='unverbuggt',
1616
author_email='[email protected]',
1717
description='A MkDocs plugin that encrypt/decrypt markdown content with AES',

0 commit comments

Comments
 (0)