| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  | /*jshint -W054 */ | 
					
						
							|  |  |  | ;(function (exports) { | 
					
						
							|  |  |  |   'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var Mustache = exports.Mustache || require('mustache') | 
					
						
							|  |  |  |     ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   function map(view) { | 
					
						
							|  |  |  |     var newview | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |       , analytics | 
					
						
							|  |  |  |       , comments | 
					
						
							| 
									
										
										
										
											2015-01-31 00:40:41 -07:00
										 |  |  |       , desi = {} | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |       ; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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 | 
					
						
							|  |  |  |       }}) | 
					
						
							|  |  |  |       ; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-07 10:34:59 -07:00
										 |  |  |     analytics = view.site.google_analytics_tracking_id && | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |       Mustache.render(view.desi.partials.google_analytics, { google_analytics: { | 
					
						
							|  |  |  |         tracking_id: view.site.google_analytics_tracking_id | 
					
						
							|  |  |  |       }}) | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       ; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-31 00:40:41 -07:00
										 |  |  |     Object.keys(view).forEach(function (key) { | 
					
						
							|  |  |  |       desi[key] = view[key]; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     desi.desi = {}; | 
					
						
							|  |  |  |     Object.keys(view).forEach(function (key) { | 
					
						
							|  |  |  |       desi.desi[key] = view[key]; | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |     newview = { | 
					
						
							| 
									
										
										
										
											2015-01-31 00:40:41 -07:00
										 |  |  |       desi: desi | 
					
						
							|  |  |  |     , content: view.contents | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |     , page: { | 
					
						
							|  |  |  |         title: view.entity.yml.title || view.site.title     // in rt
 | 
					
						
							| 
									
										
										
										
											2018-11-07 10:34:59 -07:00
										 |  |  |       , filename: view.entity.name                          // in rt
 | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       , 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 | 
					
						
							| 
									
										
										
										
											2015-01-23 17:44:29 -07:00
										 |  |  |       , url: view.entity.relative_link | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       // 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 | 
					
						
							| 
									
										
										
										
											2015-01-23 04:11:11 -07:00
										 |  |  |         // /something/ -> good (leading and trailing slash)
 | 
					
						
							|  |  |  |         // / -> bad good (leading and trailing slash)
 | 
					
						
							|  |  |  |       , base_path: (view.env.base_path + '/').replace('//', '/') | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       } | 
					
						
							|  |  |  |     , data: { | 
					
						
							|  |  |  |         author: { | 
					
						
							|  |  |  |           name: view.author.name | 
					
						
							|  |  |  |         , twitter: view.author.twitter | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       , title: view.site.title | 
					
						
							| 
									
										
										
										
											2015-01-23 17:44:29 -07:00
										 |  |  |       , host: view.env.base_url.replace(/^https?:\/\//, '') | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-01-23 15:15:10 -07:00
										 |  |  |     , stylesheets: { 'load': function () { | 
					
						
							| 
									
										
										
										
											2015-01-23 03:54:04 -07:00
										 |  |  |         return function (text, render) { | 
					
						
							|  |  |  |           // TODO pay attention to text of which styles to load?
 | 
					
						
							|  |  |  |           // this is unescaped, right?
 | 
					
						
							| 
									
										
										
										
											2015-01-23 15:15:10 -07:00
										 |  |  |           return render(view.desi.styles.join('\n')); | 
					
						
							| 
									
										
										
										
											2015-01-23 03:54:04 -07:00
										 |  |  |         }; | 
					
						
							| 
									
										
										
										
											2015-01-23 15:15:10 -07:00
										 |  |  |       }} | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |     , styles: view.desi.styles.join('\n') | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |     , assets: view.desi.styles.join('\n')                   // ruhoh-twitter only
 | 
					
						
							|  |  |  |     , comments: comments                                    // ruhoh-twitter only
 | 
					
						
							|  |  |  |     , analytics: analytics                                  // ruhoh-twitter only
 | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |     , widgets: { | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |         comments: comments | 
					
						
							|  |  |  |       , analytics: analytics | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |       , 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; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-15 22:35:29 -07:00
										 |  |  |   // shoulda made this an object at the start... oops
 | 
					
						
							|  |  |  |   map.ruhoh = map; | 
					
						
							|  |  |  |   map['ruhoh@1.0'] = map; | 
					
						
							|  |  |  |   map['ruhoh@2.6'] = map; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-15 21:29:44 -07:00
										 |  |  |   exports.DesiraeDatamapRuhoh = map.DesiraeDatamapRuhoh = map; | 
					
						
							|  |  |  | }('undefined' !== typeof exports && exports || window)); |