diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..40f6292 --- /dev/null +++ b/bower.json @@ -0,0 +1,32 @@ +{ + "name": "desirae-datamap-ruhoh", + "version": "1.0.0", + "homepage": "https://github.com/DearDesi/datamap-ruhoh", + "authors": [ + "AJ ONeal " + ], + "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" + } +} diff --git a/datamapper-ruhoh.js b/datamapper-ruhoh.js new file mode 100644 index 0000000..c25567e --- /dev/null +++ b/datamapper-ruhoh.js @@ -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)); diff --git a/package.json b/package.json new file mode 100644 index 0000000..84569cf --- /dev/null +++ b/package.json @@ -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 (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" + } +}