njk-tool 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- <!-- Head.njk -->
1
+ <!-- Head.njk -->
2
2
  {% macro use_head(ctx) %}
3
3
  <head>
4
4
  <meta charset="UTF-8" />
@@ -15,10 +15,10 @@
15
15
  <script src="{{ js }}"></script>
16
16
  {% endfor %}
17
17
  {% endif %}
18
- {% endmacro %}
19
- <!-- /Head.njk -->
20
-
21
- <!-- TOC.njk -->
18
+ {% endmacro %}
19
+ <!-- /Head.njk -->
20
+
21
+ <!-- TOC.njk -->
22
22
  {% macro use_toc(ctx) %}
23
23
  <div class="article-toc">
24
24
  <input type="checkbox" id="toc-toggle" class="toc-toggle-checkbox">
@@ -51,10 +51,10 @@
51
51
  {% endfor %}
52
52
  </nav>
53
53
  </div>
54
- {% endmacro %}
55
- <!-- /TOC.njk -->
56
-
57
- <!-- Title.njk -->
54
+ {% endmacro %}
55
+ <!-- /TOC.njk -->
56
+
57
+ <!-- Title.njk -->
58
58
  {% macro title_default(ctx) %}
59
59
  <h1 style="text-align: center">{{ ctx.text }}</h1>
60
60
  {% endmacro %}
@@ -88,10 +88,10 @@
88
88
  {% else %}
89
89
  {{ title_default(ctx) }}
90
90
  {% endif %}
91
- {% endmacro %}
92
- <!-- /Title.njk -->
93
-
94
- <!-- Notice.njk -->
91
+ {% endmacro %}
92
+ <!-- /Title.njk -->
93
+
94
+ <!-- Notice.njk -->
95
95
  {% macro use_notice(ctx) %}
96
96
  {% if ctx.type %}
97
97
  {% set type = ctx.type %}
@@ -102,27 +102,27 @@
102
102
  <div class="notice-title">{{ type|capitalize }}:</div>
103
103
  <pre class="notice-content">{{ ctx.text }}</pre>
104
104
  </div>
105
- {% endmacro %}
106
- <!-- /Notice.njk -->
107
-
108
- <!-- Block.njk -->
105
+ {% endmacro %}
106
+ <!-- /Notice.njk -->
107
+
108
+ <!-- Block.njk -->
109
109
  {% macro use_block(ctx) %}
110
110
  <div class="code-block">
111
111
  <pre><code>{{ ctx.text }}</code></pre>
112
112
  </div>
113
- {% endmacro %}
114
- <!-- /Block.njk -->
115
-
116
- <!-- Date.njk -->
113
+ {% endmacro %}
114
+ <!-- /Block.njk -->
115
+
116
+ <!-- Date.njk -->
117
117
  {% macro use_date(ctx) %}
118
118
  <div>Date:{{ ctx.text}}</div>
119
119
  {% endmacro %}
120
120
  {% macro use_checker(ctx) %}
121
121
  <div>Checker:{{ ctx.text}}</div>
122
- {% endmacro %}
123
- <!-- /Date.njk -->
124
-
125
- <!-- Table.njk -->
122
+ {% endmacro %}
123
+ <!-- /Date.njk -->
124
+
125
+ <!-- Table.njk -->
126
126
  {% macro table_default(ctx) %}
127
127
  {% if ctx.columns %}
128
128
  {% set columns = ctx.columns %}
@@ -171,10 +171,10 @@
171
171
  {% else %}
172
172
  {{ table_default(ctx) }}
173
173
  {% endif %}
174
- {% endmacro %}
175
- <!-- /Table.njk -->
176
-
177
- <!-- Tab.njk -->
174
+ {% endmacro %}
175
+ <!-- /Table.njk -->
176
+
177
+ <!-- Tab.njk -->
178
178
  {% macro useTab(tabs) %}
179
179
  <style>
180
180
  /* 显示选中的 Tab 内容 */
@@ -203,10 +203,10 @@
203
203
  </div>
204
204
  {% endfor %}
205
205
  </div>
206
- {% endmacro %}
207
- <!-- /Tab.njk -->
208
-
209
- <!-- Component.njk -->
206
+ {% endmacro %}
207
+ <!-- /Tab.njk -->
208
+
209
+ <!-- Component.njk -->
210
210
  {% macro pick_component(ctx) %}
211
211
  {% if ctx.tag == "head" %}
212
212
  {{ use_head(ctx) }}
@@ -240,10 +240,10 @@
240
240
  {% endif %}
241
241
  {% endmacro %}
242
242
 
243
- {{ use_component(ctx) }}
244
- <!-- /Component.njk -->
245
-
246
- <!-- Text.njk -->
243
+ {{ use_component(ctx) }}
244
+ <!-- /Component.njk -->
245
+
246
+ <!-- Text.njk -->
247
247
  {% macro text_default(ctx) %}
248
248
  {{ ctx.text | replace("false", "❌") | replace("true", "✔️") }}
249
249
  {% endmacro %}
@@ -258,5 +258,5 @@
258
258
  {% else %}
259
259
  {{ text_default(ctx) }}
260
260
  {% endif %}
261
- {% endmacro %}
262
- <!-- /Text.njk -->
261
+ {% endmacro %}
262
+ <!-- /Text.njk -->
@@ -42,7 +42,6 @@ interface Options {
42
42
  templateDir?: string;
43
43
  asyncLoad?: boolean;
44
44
  }
45
- declare const njkRender: (config: ConfItem | ConfItem[], options?: Options) => Promise<string>;
46
45
  declare const njkRenderSync: (config: ConfItem | ConfItem[], options?: Options) => string;
47
46
 
48
- export { njkRender, njkRenderSync };
47
+ export { njkRenderSync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "njk-tool",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "nunjucks no JavaScript 模板工具,兼容jinja",
5
5
  "types": "dist/bundle/type.d.ts",
6
6
  "exports": {