@@ -1294,19 +1294,24 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
1294
1294
return result
1295
1295
1296
1296
def _register_templated_shortcodes (self ):
1297
- """Register shortcodes provided by templates in shortcodes/ folder."""
1298
- if not os .path .isdir ('shortcodes' ):
1299
- return
1300
- for fname in os .listdir ('shortcodes' ):
1301
- name , ext = os .path .splitext (fname )
1302
- if ext == '.tmpl' :
1303
- with open (os .path .join ('shortcodes' , fname )) as fd :
1304
- template_data = fd .read ()
1305
-
1306
- def render_shortcode (t_data = template_data , ** kw ):
1307
- return self .template_system .render_template_to_string (t_data , kw )
1308
-
1309
- self .register_shortcode (name , render_shortcode )
1297
+ """Register shortcodes provided by templates in shortcodes/ folders."""
1298
+
1299
+ builtin_sc_dir = resource_filename ('nikola' , os .path .join ('data' , 'shortcodes' , utils .get_template_engine (self .THEMES )))
1300
+ sc_dirs = [builtin_sc_dir ]
1301
+ if os .path .isdir ('shortcodes' ):
1302
+ sc_dirs .append ('shortcodes' )
1303
+
1304
+ for sc_dir in sc_dirs :
1305
+ for fname in os .listdir (sc_dir ):
1306
+ name , ext = os .path .splitext (fname )
1307
+ if ext == '.tmpl' :
1308
+ with open (os .path .join (sc_dir , fname )) as fd :
1309
+ template_data = fd .read ()
1310
+
1311
+ def render_shortcode (t_data = template_data , ** kw ):
1312
+ return self .template_system .render_template_to_string (t_data , kw )
1313
+
1314
+ self .register_shortcode (name , render_shortcode )
1310
1315
1311
1316
def register_shortcode (self , name , f ):
1312
1317
"""Register function f to handle shortcode "name"."""
0 commit comments