Skip to content

Commit 1d48f9c

Browse files
committed
factor out getOptions('blogdown.new_bundle') into a function use_bundle()
1 parent db6b5e9 commit 1d48f9c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/utils.R

+6-4
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ dash_filename = function(
304304
}
305305

306306
# return a filename for a post based on title, date, etc
307-
post_filename = function(
308-
title, subdir, ext, date, lang = '', bundle = getOption('blogdown.new_bundle', FALSE)
309-
) {
307+
post_filename = function(title, subdir, ext, date, lang = '', bundle = use_bundle()) {
310308
if (is.null(lang)) lang = ''
311309
file = dash_filename(title)
312310
d = dirname(file); f = basename(file)
@@ -336,8 +334,12 @@ post_slug = function(x) {
336334
trim_ws(gsub('^\\d{4}-\\d{2}-\\d{2}-', '', basename(x)))
337335
}
338336

337+
use_bundle = function() {
338+
getOption('blogdown.new_bundle', FALSE)
339+
}
340+
339341
auto_slug = function() {
340-
if (!getOption('blogdown.new_bundle', FALSE)) return(TRUE)
342+
if (!use_bundle()) return(TRUE)
341343
cfg = load_config()
342344
if (length(cfg[['permalinks']]) > 0) return(TRUE)
343345
con = attr(cfg, 'config_content')

0 commit comments

Comments
 (0)