balrog-meta-htmlcomment

0.0.1 • Public • Published

balrog-meta-htmlcomment

Build Status

Extract metadata from files by looking at a leading comment!

Example

Input:

<!--
  title: How to eat food
  author: @brianloveswords
  sandwich: grilled cheese & tomato
  tags: pizza, taco, burrito
  date: 2013-10-28
-->
 
How to eat food
Step 1: eat it up
Step 2: awesome

Output:

{
  title: 'How to eat food',
  author: 'Brian J Brennan',
  sandwich: 'grilled cheese & tomato',
  tags: [ 'pizza', 'taco', 'burrito' ],
  date: '2013-10-28'
}

Install

TODO: talk about balrog integration

$ npm install balrog-meta-htmlcomment

Usage

TODO: talk about balrog usage

var extract = require('balrog-meta-htmlcomment')

extract(content)

content should be either a string or a buffer. If it is a buffer, it will be converted to a string with .toString('utf8').

It's expected that the first non-whitspace string in content is <!-- on its own line. Every line after that will be treated like a <key>:<value> pair. Any whitespace at the beginning and end of the line will be trimmed, as well as any whitespace before and after the “:”.

A “tags” key will be represented in the metadata as an array, using the comma character (and any leading/trailing whitespace) as the separator to split the string. So something like tags: hey, you, guys would be represented as ['hey', 'you', 'guys'].

License

Simplified BSD License

Readme

Keywords

none

Package Sidebar

Install

npm i balrog-meta-htmlcomment

Weekly Downloads

0

Version

0.0.1

License

BSD-2-Clause

Last publish

Collaborators

  • brianloveswords