mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +09:00
Merge pull request #112 from lonekorean/new-frontmatter-getters
New frontmatter getters
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// get author, without decoding
|
||||
// WordPress doesn't allow funky characters in usernames anyway
|
||||
module.exports = (post) => {
|
||||
return post.data.creator[0];
|
||||
}
|
||||
@@ -10,5 +10,5 @@ module.exports = (post) => {
|
||||
.filter(category => category.$.domain === 'category')
|
||||
.map(({ $: attributes }) => decodeURIComponent(attributes.nicename));
|
||||
|
||||
return categories.filter(category => !settings.filter_categories.includes(category));
|
||||
return categories.filter(category => !settings.filter_categories.includes(category));
|
||||
};
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
// get excerpt, not decoded, newlines collapsed
|
||||
module.exports = (post) => {
|
||||
return post.data.encoded[1].replace(/[\r\n]+/gm, ' ');
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// get ID
|
||||
module.exports = (post) => {
|
||||
return post.data.post_id[0];
|
||||
}
|
||||
@@ -8,5 +8,5 @@ module.exports = (post) => {
|
||||
.filter(category => category.$.domain === 'post_tag')
|
||||
.map(({ $: attributes }) => decodeURIComponent(attributes.nicename));
|
||||
|
||||
return categories;
|
||||
return categories;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// get type, often this will always be "post"
|
||||
// but can also be "page" or other custom types
|
||||
module.exports = (post) => {
|
||||
return post.data.post_type[0];
|
||||
}
|
||||
Reference in New Issue
Block a user