1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/lib/read-file-contents.js
Kevin Heis 8a56437c93 Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00

20 lines
635 B
JavaScript

import readFileAsync from './readfile-async.js'
import encodeBracketedParentheses from './encode-bracketed-parentheses.js'
import fm from './frontmatter.js'
/**
* Read only the frontmatter from file
*/
export default 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 })
}