[Chore] Update extractor for 30web
This commit is contained in:
@ -112,11 +112,11 @@ try {
|
||||
|
||||
output += snippet.attributes.text;
|
||||
|
||||
output += `\`\`\`${config.language}\n${snippet.attributes.codeBlocks.code}\n\`\`\``;
|
||||
output += `\`\`\`${config.language.short}\n${snippet.attributes.codeBlocks.code}\n\`\`\``;
|
||||
|
||||
output += misc.collapsible(
|
||||
'Examples',
|
||||
`\`\`\`${config.language}\n${snippet.attributes.codeBlocks.example}\n\`\`\``,
|
||||
`\`\`\`${config.language.short}\n${snippet.attributes.codeBlocks.example}\n\`\`\``,
|
||||
);
|
||||
|
||||
output +=
|
||||
|
||||
@ -43,6 +43,7 @@ const completeData = {
|
||||
meta: {
|
||||
specification: 'http://jsonapi.org/format/',
|
||||
type: 'snippetArray',
|
||||
language: config.language
|
||||
},
|
||||
};
|
||||
let listingData = {
|
||||
@ -61,6 +62,7 @@ let listingData = {
|
||||
meta: {
|
||||
specification: 'http://jsonapi.org/format/',
|
||||
type: 'snippetListingArray',
|
||||
language: config.language
|
||||
},
|
||||
};
|
||||
// Write files
|
||||
|
||||
@ -36,11 +36,11 @@ const prepTaggedData = tagDbData =>
|
||||
);
|
||||
const makeExamples = data => {
|
||||
data =
|
||||
data.slice(0, data.lastIndexOf(`\`\`\`${config.language}`)).trim() +
|
||||
data.slice(0, data.lastIndexOf(`\`\`\`${config.language.short}`)).trim() +
|
||||
misc.collapsible(
|
||||
'Examples',
|
||||
data.slice(
|
||||
data.lastIndexOf(`\`\`\`${config.language}`),
|
||||
data.lastIndexOf(`\`\`\`${config.language.short}`),
|
||||
data.lastIndexOf('```'),
|
||||
) + data.slice(data.lastIndexOf('```')),
|
||||
);
|
||||
|
||||
@ -53,7 +53,7 @@ const getCodeBlocks = str => {
|
||||
});
|
||||
}
|
||||
const replacer = new RegExp(
|
||||
`\`\`\`${config.language}([\\s\\S]*?)\`\`\``,
|
||||
`\`\`\`${config.language.short}([\\s\\S]*?)\`\`\``,
|
||||
'g',
|
||||
);
|
||||
results = results.map(v => v.replace(replacer, '$1').trim());
|
||||
@ -99,6 +99,9 @@ const readSnippets = snippetsPath => {
|
||||
},
|
||||
meta: {
|
||||
hash: hashData(data.body),
|
||||
firstSeen: execSync(`git log --diff-filter=A --pretty=format:%at -- snippets/${snippet}`).toString(),
|
||||
lastUpdated: execSync(`git log -n 1 --pretty=format:%at -- snippets/${snippet}`).toString(),
|
||||
updateCount: execSync(`git log --pretty=%H -- snippets/${snippet}`).toString().split('\n').length
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user