diff --git a/index.html b/index.html
index 542a6b3..94abd52 100755
--- a/index.html
+++ b/index.html
@@ -23,9 +23,11 @@ var reload = () => {
// process text...
var text = Wiki.text
+ var editing = $('.text').prop('contenteditable') != 'true'
+ var filters = []
// expand macros...
- if($('.text').prop('contenteditable') != 'true'){
+ if(editing){
text = text
// Syntax:
// @( )
@@ -39,8 +41,7 @@ var reload = () => {
//console.log('>>>>>', macro, args)
if(macro == 'filter' && args.length == 1){
- console.log('FILTER:', args[0])
- // XXX
+ filters.push(args[0])
return ''
}
@@ -94,7 +95,7 @@ var reload = () => {
})
}
- $('.text').html(activateWikiWords(text))
+ $('.text').html(activateWikiWords(text, filters.indexOf('show_link_brackets') < 0 && editing))
// XXX save...
localStorage['wiki-data'] = JSON.stringify(Wiki.__wiki_data)
@@ -103,7 +104,6 @@ var reload = () => {
$('title').text(Wiki.location)
}
-// XXX add history support...
var go = (path) => {
history.pushState({
wikipath: path
@@ -118,16 +118,27 @@ var go = (path) => {
var clearWikiWords = elem => {
// clear existing...
elem.find('.WikiWord').each(function(){
- $(this).replaceWith(this.childNodes)})
+ $(this).attr('braced') == 'yes' ?
+ $(this).replaceWith(['['].concat(this.childNodes, [']']))
+ : $(this).replaceWith(this.childNodes)
+ })
return elem
}
-var activateWikiWords = text =>
+var activateWikiWords = (text, show_brackets) =>
text
// set new...
.replace(
Wiki.__wiki_link__,
- '$1')
+ function(l){
+ return ''
+ + (show_brackets && l[0] == '[' ? l.slice(1, -1) : l)
+ +''
+ })
$(() => {