[Chore] Update extractor for 30web
This commit is contained in:
@ -35,10 +35,10 @@ 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('```')) +
|
||||
data.slice(data.lastIndexOf(`\`\`\`${config.language.short}`), data.lastIndexOf('```')) +
|
||||
data.slice(data.lastIndexOf('```'))
|
||||
)
|
||||
return `${data}\n<br>${misc.link('⬆ Back to top', misc.anchor('Contents'))}\n\n`
|
||||
|
||||
@ -51,9 +51,9 @@ const getCodeBlocks = str => {
|
||||
results.push(match)
|
||||
})
|
||||
}
|
||||
const replacer = new RegExp(`\`\`\`${config.language}([\\s\\S]*?)\`\`\``, 'g')
|
||||
const secondReplacer = new RegExp(`\`\`\`${config.secondLanguage}([\\s\\S]*?)\`\`\``, 'g')
|
||||
const optionalReplacer = new RegExp(`\`\`\`${config.optionalLanguage}([\\s\\S]*?)\`\`\``, 'g')
|
||||
const replacer = new RegExp(`\`\`\`${config.language.short}([\\s\\S]*?)\`\`\``, 'g')
|
||||
const secondReplacer = new RegExp(`\`\`\`${config.secondLanguage.short}([\\s\\S]*?)\`\`\``, 'g')
|
||||
const optionalReplacer = new RegExp(`\`\`\`${config.optionalLanguage.short}([\\s\\S]*?)\`\`\``, 'g')
|
||||
results = results.map(v =>
|
||||
v
|
||||
.replace(replacer, '$1')
|
||||
@ -159,7 +159,10 @@ const readSnippets = snippetsPath => {
|
||||
tags: data.attributes.tags.split(',').map(t => t.trim())
|
||||
},
|
||||
meta: {
|
||||
hash: hashData(data.body)
|
||||
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
|
||||
}
|
||||
}
|
||||
snippets[snippet].attributes.codeBlocks.scopedCss = sass
|
||||
|
||||
Reference in New Issue
Block a user