зеркало из https://github.com/github/docs.git
20 строки
644 B
JavaScript
20 строки
644 B
JavaScript
const readFileAsync = require('./readfile-async')
|
|
const encodeBracketedParentheses = require('./encode-bracketed-parentheses')
|
|
const fm = require('./frontmatter')
|
|
|
|
/**
|
|
* Read only the frontmatter from file
|
|
*/
|
|
module.exports = async function fmfromf (filepath, languageCode) {
|
|
let fileContent = await readFileAsync(filepath, 'utf8')
|
|
|
|
fileContent = encodeBracketedParentheses(fileContent)
|
|
|
|
// TODO remove this when crowdin-support issue 66 has been resolved
|
|
if (languageCode !== 'en' && fileContent.includes(': verdadero')) {
|
|
fileContent = fileContent.replace(': verdadero', ': true')
|
|
}
|
|
|
|
return fm(fileContent, { filepath })
|
|
}
|