-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilthify.html
69 lines (51 loc) · 2.53 KB
/
filthify.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{% capture workspace__filthify %}
{% comment %}
This attempts to stupify and filthify content that
spent time with smartify and sanitation filters.
Note, this will add one blank line at the end of output.
{% endcomment %}
{% assign input = include.input | default: nil %}
{% assign strip_html = include.strip_html | default: false %}
{% if input %}
{% assign html_sanitized = '&:&, <:<, >:>, ~:~' %}
{% assign smartified = '“:", ”:", –:--, —:---, …:...' %}
{% assign smartified_quotes = "‘:', ’:'" %}
{% assign characters_list = html_sanitized %}
{% assign characters_list = characters_list | append: ', ' | append: smartified %}
{% assign characters_list = characters_list | append: ', ' | append: smartified_quotes %}
{% assign characters_list = characters_list | split: ', ' %}
{% if strip_html %}
{% assign filthified_input = input | strip_html %}
{% else %}
{% assign filthified_input = nil %}
{% endif %}
{% for character_pare in characters_list %}
{% assign sanitized = character_pare | split: ':' | first %}
{% assign filthified = character_pare | split: ':' | last %}
{% if input contains sanitized %}
{% if filthified_input %}
{% assign filthified_input = filthified_input | replace: sanitized, filthified %}
{% else %}
{% assign filthified_input = input | replace: sanitized, filthified %}
{% endif %}
{% else %}
{% unless filthified_input %}
{% assign filthified_input = input %}
{% endunless %}
{% endif %}
{% endfor %}
{% endif %}
{% comment %}
filthify.html is a submodule for Git tracked web sites
Copyright (C) 2019 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
{% endcomment %}
{% endcapture %}{% if filthified_input %}{{ filthified_input }}{% endif %}{% assign filthified_input = nil %}{% assign workspace__filthify = nil %}