updated README, add versions stub
This commit is contained in:
		
							parent
							
								
									ad24089583
								
							
						
					
					
						commit
						8bb749c4a7
					
				
							
								
								
									
										31
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								README.md
									
									
									
									
									
								
							| @ -1,2 +1,31 @@ | |||||||
| # 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); | ||||||
|  | ``` | ||||||
|  | |||||||
| @ -7,6 +7,22 @@ | |||||||
| 
 | 
 | ||||||
|   function map(view) { |   function map(view) { | ||||||
|     var newview |     var newview | ||||||
|  |       , analytics | ||||||
|  |       , comments | ||||||
|  |       ; | ||||||
|  | 
 | ||||||
|  |     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 | ||||||
|  |       }}) | ||||||
|       ; |       ; | ||||||
| 
 | 
 | ||||||
|     newview = { |     newview = { | ||||||
| @ -46,18 +62,12 @@ | |||||||
|       , title: view.site.title |       , title: view.site.title | ||||||
|       } |       } | ||||||
|     , styles: view.desi.styles.join('\n') |     , styles: view.desi.styles.join('\n') | ||||||
|     , assets: view.desi.styles.join('\n') // ruhoh-twitter
 |     , assets: view.desi.styles.join('\n')                   // ruhoh-twitter only
 | ||||||
|  |     , comments: comments                                    // ruhoh-twitter only
 | ||||||
|  |     , analytics: analytics                                  // ruhoh-twitter only
 | ||||||
|     , widgets: { |     , widgets: { | ||||||
|         comments: view.site.disqus_shortname && |         comments: comments | ||||||
|           Mustache.render(view.desi.partials.disqus, { disqus: { |       , analytics: analytics | ||||||
|             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 | ||||||
| @ -87,5 +97,10 @@ | |||||||
|     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)); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user