Socket
Socket
Sign inDemoInstall

reed

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reed - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

5

lib/reed.js

@@ -105,4 +105,5 @@ var fs = require("fs"),

while(match = markdown.match(/^([a-z]+):\s*(.*)\s*\n/i)) {
var name = match[1].toLowerCase(),
value = match[2];
var name = match[1];
name = name[0].toLowerCase() + name.substring(1);
var value = match[2];
markdown = markdown.substr(match[0].length);

@@ -109,0 +110,0 @@ props[name] = value;

4

package.json
{
"author": "projectmoon (http://www.agnos.is/)",
"author": "ProjectMoon",
"name": "reed",

@@ -7,3 +7,3 @@ "email": "rei@thermetics.net",

"tags": [ "redis", "blog" ],
"version": "0.9.2",
"version": "0.9.3",
"homepage": "http://www.agnos.is/",

@@ -10,0 +10,0 @@ "repository": {

@@ -17,2 +17,7 @@ reed

What reed does not do:
* Comments. Use a system like Disqus or roll your own. Comments might be added
as a separate library later.
What is reed?

@@ -92,5 +97,5 @@ -------------

#### Metadata ####
Like Wheat, articles support user-defined metadata at the top of the article.
These take the form of simple headers. They are transferred into the metadata
object as properties.
Similar to Wheat, articles support user-defined metadata at the top of the
article. These take the form of simple headers. They are transferred into the
metadata object as properties.

@@ -109,3 +114,3 @@ the-first-post.md:

* metadata.author
* metadata.someotherfield
* metadata.someOtherField

@@ -115,4 +120,7 @@ Field names can only alphabetical characters. So, "Some-Other-Field" is not a

API
---
Note: starting in 0.9.3, metadata fields are camelCase, rather than all lower
case.
Blog API
--------
Reed exposes the following functions:

@@ -141,2 +149,5 @@

prematurely interrupted by an error.
* `refresh()`: Forces a refresh of the Redis index, removing any entries that
are no longer present on the filesystem. This should usually not be necessary,
as reed should handle this internally.

@@ -150,11 +161,14 @@ **Note**: `get`, `list`, `index`, `remove`, and `removeAll` asynchronously

* `error`: Fired when there is an error in certain internal procedures. Usually,
inspecting the error object of a callback will be sufficient.
inspecting the error object of callbacks is sufficient.
* `ready`: Fired when reed has loaded.
* `add`: Fired when a post is added to the blog. Note: posts updated while reed
is not running are currently considered `add` events.
* `update`: Fired when a blog post is updated while reed is running. Note; posts
* `update`: Fired when a blog post is updated while reed is running. Note: posts
updated while reed is not running are currently considered `add` events.
* `remove`: Fired when a blog post is removed (from the filesystem, through an
API call, etc). The callback receives the full path of the file that was
removed.
Pages
-----
Pages API
---------
Reed 0.9 introduces pages functionality. This operates similarly to the blog

@@ -165,4 +179,21 @@ functionality. Each page is a markdown file in a specified directory, and

This functionality is useful for static pages on a website.
This functionality is useful for static pages on a website. A simple example,
using [Express](http://www.expressjs.com) to send the HTML of a reed page to
a user:
```javascript
app.get('/pages/:page', function(req, res) {
reed.pages.get(req.params.page, function(err, metadata, htmlContent) {
//In a real scenario, you should use a view
//and make use of the metadata object.
if (err) {
res.send('There was an error: ' + JSON.stringify(err));
}
else {
res.send(htmlContent);
}
});
});
```
The pages API is contained within the `pages` namespace:

@@ -176,12 +207,7 @@

`get` method.
More pages API functionality is in the works, such as listing page titles and
retrieving metadata.
The pages API exposes the following events:
* `error`: Fired when there is an error in certain internal procedures. Usually,
inspecting the error object of a callback will be sufficient.
* `pagesReady`: Fired when the `open` call has completed.
* `addPage`: Fired when a new page is added to Redis.
* `updatePage`: Fired when a page is updated.
var reed = require('./lib/reed');
reed.open('./articles');
reed.on('add', function(metadata) {
console.log(metadata);
reed.on('ready', function() {
reed.list(function(err, titles) {
console.log('derp');
console.log(titles);
});
});
reed.on('update', function() {
console.log('file updated');
reed.on('remove', function(f) {
console.log('removed ' + f);
});
reed.on('remove', function(filename) {
console.log('file removed: ' + filename);
});
reed.open('./articles');
reed.on('error', function(err) {
console.log('internal error: ' + JSON.stringify(err));
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc