Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A start at opening the door to support for other languages. #103

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/legacy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ $ ->
active.set this unless $(e.target).is("a")

.delegate '.internal', 'click', (e) ->
name = $(e.target).data 'pageName'
name = $(e.target).text()
# ensure that name is a string (using string interpolation)
name = "#{name}"
pageHandler.context = $(e.target).attr('title').split(' => ')
Expand Down Expand Up @@ -167,4 +167,3 @@ $ ->
state.first()
$('.page').each refresh.cycle
active.set($('.page').last())

15 changes: 8 additions & 7 deletions lib/link.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ active = require './active'
refresh = require './refresh'
{asSlug, pageEmitter} = require './page'

createPage = (name, loc) ->
createPage = (slug, loc, title=null) ->
site = loc if loc and loc isnt 'view'
$page = $ """
<div class="page" id="#{name}">
<div class="page" id="#{slug}">
<div class="twins"> <p> </p> </div>
<div class="header">
<h1> <img class="favicon" src="#{ if site then "//#{site}" else "" }/favicon.png" height="32px"> #{name} </h1>
</div>
</div>
"""
$page.data('site', site) if site
$page.data('title', title) if title
$page

showPage = (name, loc) ->
createPage(name, loc).appendTo('.main').each refresh.cycle
showPage = (slug, loc, title=null) ->
createPage(slug, loc, title).appendTo('.main').each refresh.cycle

doInternalLink = (name, $page, site=null) ->
name = asSlug(name)
slug = asSlug(name)
$($page).nextAll().remove() if $page?
lineup.removeAllAfterKey $($page).data('key') if $page?
showPage(name,site)
showPage(slug,site,name)
active.set($('.page').last())

showResult = (pageObject) ->
Expand All @@ -41,4 +42,4 @@ pageEmitter.on 'show', (page) ->
console.log 'pageEmitter handling', page
showResult page

module.exports = {createPage, doInternalLink, showPage, showResult}
module.exports = {createPage, doInternalLink, showPage, showResult}
2 changes: 1 addition & 1 deletion lib/page.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ newPage = (json, site) ->

{getRawPage, getContext, isPlugin, isRemote, isLocal, getRemoteSite, getRemoteSiteDetails, getSlug, getNeighbors, getTitle, setTitle, getRevision, getTimestamp, addItem, getItem, addParagraph, seqItems, seqActions, become, siteLineup, merge, apply}

module.exports = {newPage, asSlug, pageEmitter}
module.exports = {newPage, asSlug, pageEmitter}
4 changes: 3 additions & 1 deletion lib/pageHandler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pageFromLocalStorage = (slug)->
undefined

recursiveGet = ({pageInformation, whenGotten, whenNotGotten, localContext}) ->
{slug,rev,site} = pageInformation
{slug,rev,site,title} = pageInformation

if site
localContext = []
Expand Down Expand Up @@ -55,6 +55,8 @@ recursiveGet = ({pageInformation, whenGotten, whenNotGotten, localContext}) ->
type: 'GET'
dataType: 'json'
url: url + "?random=#{random.randomBytes(4)}"
data:
'title': title
success: (page) ->
page = revision.create rev, page if rev
#NEWPAGE server from pageHandler.get
Expand Down
1 change: 1 addition & 0 deletions lib/refresh.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ cycle = ->
slug: slug
rev: rev
site: $page.data('site')
title: $page.data('title')
}

createGhostPage = ->
Expand Down
2 changes: 0 additions & 2 deletions lib/resolve.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ resolve.resolveLinks = (string, sanitize=escape) ->
.replace /\[((http|https|ftp):.*?) (.*?)\]/gi, external
sanitize string
.replace /〖(\d+)〗/g, unstash