escaping bugfix, now almost systematic...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-10-18 05:03:11 +04:00
parent f453871665
commit e765bd34bf
9 changed files with 32 additions and 18 deletions

View File

@ -1,7 +1,7 @@
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20131018000820'''
__sub_version__ = '''20131018001840'''
__copyright__ = '''(c) Alex A. Naanou 2011'''
@ -365,7 +365,7 @@ def build_images(path, config=CONFIG, gid_generator=hash_gid, dry_run=False, ver
orientation = 0
# build a file-list...
##!!! should this be split out into a seporate function???
# XXX should this be split out into a seporate function???
filelist = pathjoin(path, cache_dir, config['filelist'])
# NOTE: we do not need to filter anything here as all the filtering
# will anyway happen later on...

View File

@ -109,7 +109,7 @@ Roadmap
[_] 27% Gen 3 current todo
[_] 54% High priority
[_] 55% High priority
[_] Q: how do we mark unsorted sections in base ribbon after aligning?
| - there is a big gap in the ribbon below, but it's not visible...
| - can we "mark" big gaps? ...what's the threshold of "big"?
@ -215,7 +215,8 @@ Roadmap
| - CouchDB
| - SQL
| - file-db
[_] BUG CLASS: file-name auto escaping...
[X] BUG CLASS: file-name auto escaping...
| mostly fixed, but need to check more thoroughly...
[_] BUG CLASS: everything should work with empty ribbons...
| currently some code breaks when seeing an empty ribbon...
[_] BUG: jumping in ribbon sometimes does not load the ribbon correctly...

View File

@ -172,10 +172,23 @@ function concatZip(){
}
function getImageFileName(gid, images, do_unescape){
gid = gid == null ? getImageGID() : gid
images = images == null ? IMAGES : images
do_unescape = do_unescape == null ? true : do_unescape
if(do_unescape){
return unescape(images[gid].path.split('/').pop())
} else {
return images[gid].path.split('/').pop()
}
}
// Get the first sequence of numbers in the file name...
function getImageNameSeq(gid, data){
data = data == null ? IMAGES : data
var n = data[gid].path.split('/').pop()
var n = getImageFileName(gid, data)
var r = /([0-9]+)/m.exec(n)
return r == null ? n : parseInt(r[1])
}
@ -185,7 +198,7 @@ function getImageNameSeq(gid, data){
// at the filename start...
function getImageNameLeadingSeq(gid, data){
data = data == null ? IMAGES : data
var n = data[gid].path.split('/').pop()
var n = getImageFileName(gid, data)
var r = /^([0-9]+)/g.exec(n)
return r == null ? n : parseInt(r[1])
}

View File

@ -196,7 +196,7 @@ function ribbonsFromFavDirs(path, images, cmp){
var index = {}
var name
for(var gid in images){
name = images[gid].path.split('/').pop()
name = getImageFileName(gid)
// XXX we assume that names are unique...
index[name] = gid
}
@ -643,7 +643,7 @@ function exportTo(path, im_name, dir_name, size){
var gid = ribbon[j]
// get correct preview...
var src = getBestPreview(gid, size).url
var orig = IMAGES[gid].path.split('/').pop()
var orig = getImageFileName(gid)
// XXX might be a good idea to combine this with docs as a
// single mechanism...

View File

@ -59,7 +59,7 @@ function updateGlobalImageInfo(image){
// path...
'<span class="expanding-text path">'+
'<span class="shown">'+
unescape(data.path.split('/').pop()) +
getImageFileName(gid) +
'</span>'+
'<span class="hidden" '+
'style="position:absolute;'+
@ -130,7 +130,7 @@ function updateInlineImageInfo(image){
return updateInfo(elem,
// name...
data.path.split('/').pop() +'<br>'+
getImageFileName(gid) +'<br>'+
// date...
'<span class="secondary expanding-text date">'+

View File

@ -383,7 +383,7 @@ var toggleImageInfoDrawer = makeDrawerToggler(
var orientation = data.orientation
orientation = orientation == null ? 0 : orientation
var order = DATA.order.indexOf(gid)
var name = data.path.split('/').pop()
var name = getImageFileName(gid)
return $('<div>'+
'<h1>"'+ name +'"</h1>'+

View File

@ -240,7 +240,7 @@ function setupDataBindings(viewer){
if(window.setWindowTitle != null){
// XXX do we need to hide the extension...
setWindowTitle(IMAGES[getImageGID(image)].path.split('/').pop())
setWindowTitle(getImageFileName())
//.split(/\.(jpg|jpeg|png|gif)$/)[0])
}
})

View File

@ -82,8 +82,8 @@ function imageNameCmp(a, b, get, data){
a = get(a)
b = get(b)
}
a = data[a].path.split('/').pop()
b = data[b].path.split('/').pop()
a = getImageFileName(a, data)
b = getImageFileName(b, data)
if(a == b){
return 0
} else if(a < b){
@ -121,8 +121,8 @@ function imageSeqOrNameCmp(a, b, get, data, get_seq){
// get the names if there are no sequence numbers...
// NOTE: at this point both a and b are either numbers or NaN's...
a = isNaN(aa) ? data[a].path.split('/').pop() : aa
b = isNaN(bb) ? data[b].path.split('/').pop() : bb
a = isNaN(aa) ? getImageFileName(a, data) : aa
b = isNaN(bb) ? getImageFileName(b, data) : bb
// do the actual comparison
if(a == b){

View File

@ -1027,7 +1027,7 @@ function showImageInfo(){
var flipped = data.flipped
flipped = flipped == null ? '' : ', flipped '+flipped+'ly'
var order = DATA.order.indexOf(gid)
var name = data.path.split('/').pop()
var name = getImageFileName(gid)
var comment = data.comment
comment = comment == null ? '' : comment
comment = comment.replace(/\n/g, '<br>')
@ -1040,7 +1040,7 @@ function showImageInfo(){
// basic info...
'<tr><td colspan="2"><hr></td></tr>'+
'<tr><td>GID: </td><td>'+ gid +'</td></tr>'+
'<tr><td>Path: </td><td>"'+ data.path +'"</td></tr>'+
'<tr><td>Path: </td><td>"'+ unescape(data.path) +'"</td></tr>'+
'<tr><td>Orientation: </td><td>'+ orientation +'&deg;'+flipped+'</td></tr>'+
'<tr><td>Order: </td><td>'+ order +'</td></tr>'+
'<tr><td>Position (ribbon): </td><td>'+ (DATA.ribbons[r].indexOf(gid)+1) +