Convert site to a single JavaScript archive
* Convert build to use a single JavaScript file on the site (instead of downloading each library separately). This also means that all global variables (e.g., `$` for JQuery, `_` for Underscore.js) can be removed. * Remove unused scripts and/or move them to a more appropriate repo * Update the `deploy` script to work with CircleCI's automation * Update markdown display code to allow images to be located with the markdown data files instead of the pre-rendered index pages
This commit is contained in:
@@ -6,6 +6,8 @@ All rights reserved.
|
||||
###
|
||||
|
||||
BaseController = require './base_controller'
|
||||
_ = require 'underscore'
|
||||
{markdown} = require 'markdown'
|
||||
{Url} = require '../constants'
|
||||
|
||||
########################################################################################################################
|
||||
@@ -14,13 +16,15 @@ module.exports = class MarkdownSectionController extends BaseController
|
||||
|
||||
constructor: (options={})->
|
||||
if not options.modPack? then throw new Error 'options.modPack is required'
|
||||
options.imageBase ?= ''
|
||||
options.model ?= ''
|
||||
options.title ?= 'Description'
|
||||
options.templateName = 'markdown_section'
|
||||
super options
|
||||
|
||||
@modPack = options.modPack
|
||||
@title = options.title
|
||||
@imageBase = options.imageBase
|
||||
@modPack = options.modPack
|
||||
@title = options.title
|
||||
|
||||
# BaseController Overrides #####################################################################
|
||||
|
||||
@@ -50,15 +54,17 @@ module.exports = class MarkdownSectionController extends BaseController
|
||||
tree = markdown.parse @model, 'Maruku'
|
||||
|
||||
findLinkRefs = (node)=>
|
||||
logger.verbose "inspecting a #{node[0]}"
|
||||
logger.verbose -> "inspecting a #{node[0]}"
|
||||
if node[0] is 'link_ref'
|
||||
logger.verbose "looking for item named: #{node[2]}"
|
||||
logger.verbose -> "looking for item named: #{node[2]}"
|
||||
item = @modPack.findItemByName node[2]
|
||||
if item?
|
||||
logger.verbose "found item #{item.slug}, updating link"
|
||||
logger.verbose -> "found item #{item.slug}, updating link"
|
||||
node[0] = 'link'
|
||||
node[1].href = Url.item itemSlug:item.slug.item, modSlug:item.slug.mod
|
||||
delete node[1].ref
|
||||
else if node[0] is 'img'
|
||||
node[1].href = "#{@imageBase}/#{node[1].href}"
|
||||
else
|
||||
for index in [1...node.length]
|
||||
if _.isArray node[index]
|
||||
|
||||
Reference in New Issue
Block a user