You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
webpack-plugin/src/factories/block.js

49 lines
925 B

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

const path = require('path')
const parseMarkdownFile = require('./../parsers/markdown.js')
const assign = require('assign-deep')
/**
* Block
*
* parsed markdown-file that can
* contains fields as yaml
*
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/HerrHase/siteomat-webpack-plugin.git
*
*/
class Block {
/**
*
*
* @param {string} fileString
*
*/
constructor(fileString) {
// parse string of file
const parsedFile = parseMarkdownFile(fileString)
// getting parsed data
this._content = parsedFile.content
this._fields = parsedFile.fields
}
/**
*
*
* @return {object}
*
*/
get() {
return assign({
'content': this._content
}, this._fields)
}
}
module.exports = Block