initial commit

This commit is contained in:
AJ ONeal 2015-01-15 21:29:44 -07:00
parent cad4b2caeb
commit ad24089583
3 changed files with 152 additions and 0 deletions

32
bower.json Normal file
View File

@ -0,0 +1,32 @@
{
"name": "desirae-datamap-ruhoh",
"version": "1.0.0",
"homepage": "https://github.com/DearDesi/datamap-ruhoh",
"authors": [
"AJ ONeal <awesome@coolaj86.com>"
],
"description": "A ruhoh datamap plugin for desirae",
"main": "datamapper-ruhoh.js",
"moduleType": [
"globals",
"node"
],
"keywords": [
"ruhoh",
"desirae",
"desi",
"deardesi",
"datamap"
],
"license": "Apache2",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"mustache": "~1.0.0"
}
}

91
datamapper-ruhoh.js Normal file
View File

@ -0,0 +1,91 @@
/*jshint -W054 */
;(function (exports) {
'use strict';
var Mustache = exports.Mustache || require('mustache')
;
function map(view) {
var newview
;
newview = {
content: view.contents
, page: {
title: view.entity.yml.title || view.site.title // in rt
, tagline: view.entity.yml.tagline // in rt
, description: view.entity.yml.description // in rt
, content: view.contents
, youtube: view.entity.yml.youtube
, tags: view.entity.yml.tags
, categories: view.entity.yml.categories
, player_width: view.entity.yml.player_width
, player_height: view.entity.yml.player_height
, next: view.entities[view.entity_index + 1]
, previous: view.entities[view.entity_index - 1]
, date: view.entity.year + '-' + view.entity.month + '-' + view.entity.day
// TODO , url: view.entities.
}
, 'page?previous': view.entities[view.entity_index - 1] // ruhoh-twitter only
// should contain { url: ..., title: ... }
, 'page?next': view.entities[view.entity_index + 1] // ruhoh-twitter only
, 'page.categories?to_categories': [] // ruhoh-twitter only
, 'page.tags?to_tags': [] // ruhoh-twitter only
, posts: { collated: view.desi.collated }
, urls: {
base_url: view.env.base_url
// /something -> good (leading slash)
// / -> bad (trailing slash)
, base_path: view.env.base_path.replace(/^\/$/, '')
}
, data: {
author: {
name: view.author.name
, twitter: view.author.twitter
}
, title: view.site.title
}
, styles: view.desi.styles.join('\n')
, assets: view.desi.styles.join('\n') // ruhoh-twitter
, widgets: {
comments: view.site.disqus_shortname &&
Mustache.render(view.desi.partials.disqus, { disqus: {
shortname: view.site.disqus_shortname
, identifier: view.entity.disqus_identifier || undefined
, url: !view.entity.disqus_identifier && view.entity.disqus_url || undefined
}})
, analytics: view.site.google_analytics_tracking_id &&
Mustache.render(view.desi.partials.google_analytics, { google_analytics: {
tracking_id: view.site.google_analytics_tracking_id
}})
, facebook_connect: view.desi.partials.facebook_connect
, twitter: view.desi.partials.twitter
, google_plusone: view.desi.partials.google_plusone
, amazon_link_enhancer: view.site.amazon_affiliate_id &&
Mustache.render(view.desi.partials.amazon_link_enhancer, {
amazon_affiliate_id: view.site.amazon_affiliate_id
})
}
, site: {
navigation: view.navigation
, title: view.site.title // ruhoh-twitter only
, author: { // ruhoh-twitter only
name: view.author.name // ruhoh-twitter only
}
}
};
// backwards compat
newview.site['navigation?to_pages'] = newview.site.navigation; // ruhoh-twitter only
newview.site['navigation?to__root'] = newview.site.navigation;
newview.data.navigation = view.site.navigation;
newview.data['navigation?to_pages'] = newview.site.navigation;
newview.data['navigation?to__root'] = newview.site.navigation;
newview.page.content = view.contents;
return newview;
}
exports.DesiraeDatamapRuhoh = map.DesiraeDatamapRuhoh = map;
}('undefined' !== typeof exports && exports || window));

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "desirae-datamap-ruhoh",
"version": "1.0.0",
"description": "A ruhoh datamap plugin for desirae",
"main": "datamapper-ruhoh.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/DearDesi/datamap-ruhoh.git"
},
"keywords": [
"ruhoh",
"desirae",
"desi",
"deardesi",
"datamap"
],
"author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)",
"license": "Apache2",
"bugs": {
"url": "https://github.com/DearDesi/datamap-ruhoh/issues"
},
"homepage": "https://github.com/DearDesi/datamap-ruhoh",
"dependencies": {
"mustache": "^1.0.0"
}
}