Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: deprecate config.external_link (boolean) & config.use_date_for_updated #4371

Merged
merged 2 commits into from Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/plugins/filter/after_post_render/external_link.js
Expand Up @@ -11,6 +11,7 @@ function externalLinkFilter(data) {

if (typeof EXTERNAL_LINK_POST_CONFIG === 'undefined') {
if (typeof config.external_link === 'undefined' || typeof config.external_link === 'object'
// Deprecated: config.external_link boolean option will be removed in future
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact we could remove the boolean value support in Hexo 5.0.0, as it was introduced in Hexo 4.0.0.

|| config.external_link === true) {
EXTERNAL_LINK_POST_CONFIG = Object.assign({
enable: true,
Expand Down
1 change: 1 addition & 0 deletions lib/plugins/filter/after_render/external_link.js
Expand Up @@ -11,6 +11,7 @@ function externalLinkFilter(data) {

if (typeof EXTERNAL_LINK_SITE_CONFIG === 'undefined') {
if (typeof config.external_link === 'undefined' || typeof config.external_link === 'object'
// Deprecated: config.external_link boolean option will be removed in future
|| config.external_link === true) {
EXTERNAL_LINK_SITE_CONFIG = Object.assign({
enable: true,
Expand Down
6 changes: 4 additions & 2 deletions lib/plugins/processor/asset.js
Expand Up @@ -12,7 +12,9 @@ module.exports = ctx => {
const { path } = file;
const doc = Page.findOne({source: path});
const { config } = ctx;
const { timezone: timezoneCfg, use_date_for_updated, updated_option } = config;
const { timezone: timezoneCfg } = config;
// Deprecated: use_date_for_updated will be removed in future
const updated_option = config.use_date_for_updated === true ? 'date' : config.updated_option;

if (file.type === 'skip' && doc) {
return;
Expand Down Expand Up @@ -48,7 +50,7 @@ module.exports = ctx => {

if (data.updated) {
if (timezoneCfg) data.updated = timezone(data.updated, timezoneCfg);
} else if (use_date_for_updated || updated_option === 'date') {
} else if (updated_option === 'date') {
data.updated = data.date;
} else if (updated_option === 'empty') {
delete data.updated;
Expand Down
6 changes: 4 additions & 2 deletions lib/plugins/processor/post.js
Expand Up @@ -27,7 +27,9 @@ module.exports = ctx => {
const { path } = file.params;
const doc = Post.findOne({source: file.path});
const { config } = ctx;
const { timezone: timezoneCfg, use_date_for_updated, updated_option } = config;
const { timezone: timezoneCfg } = config;
// Deprecated: use_date_for_updated will be removed in future
const updated_option = config.use_date_for_updated === true ? 'date' : config.updated_option;
let categories, tags;

if (file.type === 'skip' && doc) {
Expand Down Expand Up @@ -85,7 +87,7 @@ module.exports = ctx => {

if (data.updated) {
if (timezoneCfg) data.updated = timezone(data.updated, timezoneCfg);
} else if (use_date_for_updated || updated_option === 'date') {
} else if (updated_option === 'date') {
data.updated = data.date;
} else if (updated_option === 'empty') {
delete data.updated;
Expand Down