Compare commits
	
		
			No commits in common. "master" and "v1.0.0" have entirely different histories.
		
	
	
		
	
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,3 @@ | |||||||
| node_modules |  | ||||||
| bower_components |  | ||||||
| 
 |  | ||||||
| # Logs | # Logs | ||||||
| logs | logs | ||||||
| *.log | *.log | ||||||
|  | |||||||
							
								
								
									
										31
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								README.md
									
									
									
									
									
								
							| @ -1,31 +1,2 @@ | |||||||
| # datamap-ruhoh | # datamap-ruhoh | ||||||
| 
 | A ruhoh-compatible data mapper for desirae | ||||||
| A ruhoh-compatible data mapper for [desirae](http://dear.desi) |  | ||||||
| 
 |  | ||||||
| This mapper attempts to map both `ruhoh@1.0` (ruhoh-twitter) |  | ||||||
| and `ruhoh@2.6` (ruhoh-bootstrap-2) views onto the same object. |  | ||||||
| 
 |  | ||||||
| As it turns out, there don't seem to be any conflicts, |  | ||||||
| but if we find out there are, we can separate into two functions. |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| npm install --save desirae-datamap-ruhoh |  | ||||||
| 
 |  | ||||||
| bower install --save desirae-datamap-ruhoh |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ### browser |  | ||||||
| 
 |  | ||||||
| ```javascript |  | ||||||
| Desirae.registerDataMapper('ruhoh', exports.DesiraeDatamapRuhoh); |  | ||||||
| Desirae.registerDataMapper('ruhoh@1.0', exports.DesiraeDatamapRuhoh); |  | ||||||
| Desirae.registerDataMapper('ruhoh@2.6', exports.DesiraeDatamapRuhoh); |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| ### io.js / node.js |  | ||||||
| 
 |  | ||||||
| ```javascript |  | ||||||
| Desirae.registerDataMapper('ruhoh', require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh); |  | ||||||
| Desirae.registerDataMapper('ruhoh@1.0', require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh); |  | ||||||
| Desirae.registerDataMapper('ruhoh@2.6', require('desirae-datamap-ruhoh').DesiraeDatamapRuhoh); |  | ||||||
| ``` |  | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "desirae-datamap-ruhoh", |   "name": "desirae-datamap-ruhoh", | ||||||
|   "version": "1.0.2", |   "version": "1.0.0", | ||||||
|   "homepage": "https://github.com/DearDesi/datamap-ruhoh", |   "homepage": "https://github.com/DearDesi/datamap-ruhoh", | ||||||
|   "authors": [ |   "authors": [ | ||||||
|     "AJ ONeal <awesome@coolaj86.com>" |     "AJ ONeal <awesome@coolaj86.com>" | ||||||
|  | |||||||
| @ -7,39 +7,12 @@ | |||||||
| 
 | 
 | ||||||
|   function map(view) { |   function map(view) { | ||||||
|     var newview |     var newview | ||||||
|       , analytics |  | ||||||
|       , comments |  | ||||||
|       , desi = {} |  | ||||||
|       ; |       ; | ||||||
| 
 | 
 | ||||||
|     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 |  | ||||||
|       }}) |  | ||||||
|       ; |  | ||||||
| 
 |  | ||||||
|     Object.keys(view).forEach(function (key) { |  | ||||||
|       desi[key] = view[key]; |  | ||||||
|     }); |  | ||||||
|     desi.desi = {}; |  | ||||||
|     Object.keys(view).forEach(function (key) { |  | ||||||
|       desi.desi[key] = view[key]; |  | ||||||
|     }); |  | ||||||
| 
 |  | ||||||
|     newview = { |     newview = { | ||||||
|       desi: desi |       content: view.contents | ||||||
|     , content: view.contents |  | ||||||
|     , page: { |     , page: { | ||||||
|         title: view.entity.yml.title || view.site.title     // in rt
 |         title: view.entity.yml.title || view.site.title     // in rt
 | ||||||
|       , filename: view.entity.name                          // in rt
 |  | ||||||
|       , tagline: view.entity.yml.tagline                    // in rt
 |       , tagline: view.entity.yml.tagline                    // in rt
 | ||||||
|       , description: view.entity.yml.description            // in rt
 |       , description: view.entity.yml.description            // in rt
 | ||||||
|       , content: view.contents |       , content: view.contents | ||||||
| @ -51,7 +24,6 @@ | |||||||
|       , next: view.entities[view.entity_index + 1] |       , next: view.entities[view.entity_index + 1] | ||||||
|       , previous: view.entities[view.entity_index - 1] |       , previous: view.entities[view.entity_index - 1] | ||||||
|       , date: view.entity.year + '-' + view.entity.month + '-' + view.entity.day |       , date: view.entity.year + '-' + view.entity.month + '-' + view.entity.day | ||||||
|       , url: view.entity.relative_link |  | ||||||
|       // TODO , url: view.entities.
 |       // TODO , url: view.entities.
 | ||||||
|       } |       } | ||||||
|     , 'page?previous': view.entities[view.entity_index - 1] // ruhoh-twitter only
 |     , 'page?previous': view.entities[view.entity_index - 1] // ruhoh-twitter only
 | ||||||
| @ -62,9 +34,9 @@ | |||||||
|     , posts: { collated: view.desi.collated } |     , posts: { collated: view.desi.collated } | ||||||
|     , urls: { |     , urls: { | ||||||
|         base_url: view.env.base_url |         base_url: view.env.base_url | ||||||
|         // /something/ -> good (leading and trailing slash)
 |         // /something -> good (leading slash)
 | ||||||
|         // / -> bad good (leading and trailing slash)
 |         // / -> bad (trailing slash)
 | ||||||
|       , base_path: (view.env.base_path + '/').replace('//', '/') |       , base_path: view.env.base_path.replace(/^\/$/, '') | ||||||
|       } |       } | ||||||
|     , data: { |     , data: { | ||||||
|         author: { |         author: { | ||||||
| @ -72,22 +44,20 @@ | |||||||
|         , twitter: view.author.twitter |         , twitter: view.author.twitter | ||||||
|         } |         } | ||||||
|       , title: view.site.title |       , title: view.site.title | ||||||
|       , host: view.env.base_url.replace(/^https?:\/\//, '') |  | ||||||
|       } |       } | ||||||
|     , stylesheets: { 'load': function () { |  | ||||||
|         return function (text, render) { |  | ||||||
|           // TODO pay attention to text of which styles to load?
 |  | ||||||
|           // this is unescaped, right?
 |  | ||||||
|           return render(view.desi.styles.join('\n')); |  | ||||||
|         }; |  | ||||||
|       }} |  | ||||||
|     , styles: view.desi.styles.join('\n') |     , styles: view.desi.styles.join('\n') | ||||||
|     , assets: view.desi.styles.join('\n')                   // ruhoh-twitter only
 |     , assets: view.desi.styles.join('\n') // ruhoh-twitter
 | ||||||
|     , comments: comments                                    // ruhoh-twitter only
 |  | ||||||
|     , analytics: analytics                                  // ruhoh-twitter only
 |  | ||||||
|     , widgets: { |     , widgets: { | ||||||
|         comments: comments |         comments: view.site.disqus_shortname && | ||||||
|       , analytics: analytics |           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 |       , facebook_connect: view.desi.partials.facebook_connect | ||||||
|       , twitter: view.desi.partials.twitter |       , twitter: view.desi.partials.twitter | ||||||
|       , google_plusone: view.desi.partials.google_plusone |       , google_plusone: view.desi.partials.google_plusone | ||||||
| @ -117,10 +87,5 @@ | |||||||
|     return newview; |     return newview; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // shoulda made this an object at the start... oops
 |  | ||||||
|   map.ruhoh = map; |  | ||||||
|   map['ruhoh@1.0'] = map; |  | ||||||
|   map['ruhoh@2.6'] = map; |  | ||||||
| 
 |  | ||||||
|   exports.DesiraeDatamapRuhoh = map.DesiraeDatamapRuhoh = map; |   exports.DesiraeDatamapRuhoh = map.DesiraeDatamapRuhoh = map; | ||||||
| }('undefined' !== typeof exports && exports || window)); | }('undefined' !== typeof exports && exports || window)); | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								package.json
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "desirae-datamap-ruhoh", |   "name": "desirae-datamap-ruhoh", | ||||||
|   "version": "1.0.6", |   "version": "1.0.0", | ||||||
|   "description": "A ruhoh datamap plugin for desirae", |   "description": "A ruhoh datamap plugin for desirae", | ||||||
|   "main": "datamapper-ruhoh.js", |   "main": "datamapper-ruhoh.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
| @ -8,7 +8,7 @@ | |||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "https://git.coolaj86.com/coolaj86/desirae-datamap-ruhoh.js.git" |     "url": "https://github.com/DearDesi/datamap-ruhoh.git" | ||||||
|   }, |   }, | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "ruhoh", |     "ruhoh", | ||||||
| @ -18,12 +18,12 @@ | |||||||
|     "datamap" |     "datamap" | ||||||
|   ], |   ], | ||||||
|   "author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)", |   "author": "AJ ONeal <coolaj86@gmail.com> (http://coolaj86.com/)", | ||||||
|   "license": "(MIT OR ISC OR Apache-2.0)", |   "license": "Apache2", | ||||||
|   "bugs": { |   "bugs": { | ||||||
|     "url": "https://git.coolaj86.com/coolaj86/desirae-datamap-ruhoh.js/issues" |     "url": "https://github.com/DearDesi/datamap-ruhoh/issues" | ||||||
|   }, |   }, | ||||||
|   "homepage": "https://git.coolaj86.com/coolaj86/desirae-datamap-ruhoh.js", |   "homepage": "https://github.com/DearDesi/datamap-ruhoh", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "mustache": "^2.3.2" |     "mustache": "^1.0.0" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user