forked from yousinix/portfolYOU
-
Notifications
You must be signed in to change notification settings - Fork 0
/
element.html
141 lines (115 loc) · 4.39 KB
/
element.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{% assign page_title = page.title | slice: 2, page.title.size %}
<h2 id="{{ page_title | slugify }}">{{ page_title }}</h2>
{%- assign code = content | strip -%}
{%- if code contains '{% ' -%}
{%- assign code = code | newline_to_br | split: '<br />' -%}
{%- assign start_capture = false -%}
{%- assign captured_text = '' -%}
{%- assign captured_var = '' -%}
{%- assign includes = '' | split: '' -%}
{%- for line in code -%}
{%- if line contains '{% endcapture' -%}
{%- assign start_capture = false -%}
{%- elsif start_capture == true -%}
{%- assign captured_text = captured_text | append: line -%}
{%- elsif line contains '{% capture' -%}
{%- assign temp = line | split: ' ' -%}
{%- assign captured_var = temp[2] -%}
{%- assign start_capture = true -%}
{%- elsif line contains '{% include' -%}
{%- assign includes = includes | push: line -%}
{%- endif -%}
{%- endfor -%}
{%- assign list_items = nil -%}
{%- assign carousel_images = nil -%}
{%- case captured_var -%}
{%- when 'list_items' -%}
{%- assign list_items = captured_text -%}
{%- when 'carousel_images' -%}
{%- assign carousel_images = captured_text -%}
{%- endcase -%}
{%- for include in includes -%}
{%- assign incl = include | strip -%}
{%- assign incl = incl | remove: '{% include ' -%}
{%- assign incl = incl | remove: ' %' | remove: '}' -%}
{%- assign incl = incl | replace_first: ' ', '" ' -%}
{%- assign temp = incl | split: '" ' -%}
{%- assign file = temp | first -%}
{%- assign params = temp | shift -%}
{%- assign alt = nil -%}
{%- assign block = nil -%}
{%- assign caption = nil -%}
{%- assign id = nil -%}
{%- assign image = nil -%}
{%- assign link = nil -%}
{%- assign size = nil -%}
{%- assign style = nil -%}
{%- assign title = nil -%}
{%- assign text = nil -%}
{%- assign type = nil -%}
{%- for param in params -%}
{%- assign pair = param | split: '=' -%}
{%- assign key = pair[0] -%}
{%- assign value = pair[1] | remove: '"' -%}
{%- case key -%}
{%- when 'alt' -%}
{%- assign alt = value -%}
{%- when 'block' -%}
{%- assign block = value -%}
{%- when 'caption' -%}
{%- assign caption = value -%}
{%- when 'id' -%}
{%- assign id = value -%}
{%- when 'image' -%}
{%- assign image = value -%}
{%- when 'link' -%}
{%- assign link = value -%}
{%- when 'size' -%}
{%- assign size = value -%}
{%- when 'style' -%}
{%- assign style = value -%}
{%- when 'title' -%}
{%- assign title = value -%}
{%- when 'text' -%}
{%- assign text = value -%}
{%- when 'type' -%}
{%- assign type = value -%}
{%- endcase -%}
{%- endfor -%}
{%- include {{ file }}
alt=alt
block=block
caption=caption
id=id
image=image
link=link
size=size
style=style
title=title
text=text
type=type
-%}
{%- endfor -%}
{%- else -%}
{{ code | markdownify }}
{%- endif -%}
<details>
<summary class="text-monospace">View Code...</summary>
{%- highlight liquid -%}
{%- if code contains 'gist.github' -%}
{%- assign parts = code | split: '/' -%}
{%- assign id = parts[3] | split: '.' | first -%}
{%- assign gist = id | prepend: '{%- gist ' -%}
{%- assign gist = gist | append: ' %' -%}
{%- assign gist = gist | append: '}' -%}
{{ gist }}
{%- else -%}
{{ code }}
{%- endif -%}
{%- endhighlight -%}
{%- for tip in page.tips -%}
<blockquote>
{{ tip | markdownify }}
</blockquote>
{%- endfor -%}
</details>