Mercurial > repos > rhope
changeset 1:b3f71490858c
Small fixes and enhancements from main windows box
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 29 Apr 2009 02:13:24 -0400 |
parents | 76568becd6d6 |
children | 73e978d590c7 |
files | extendlib.rhope framework.rhope parser.vistxt |
diffstat | 3 files changed, 107 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/extendlib.rhope Tue Apr 28 23:06:07 2009 +0000 +++ b/extendlib.rhope Wed Apr 29 02:13:24 2009 -0400 @@ -70,9 +70,19 @@ } } +To String@String[string:out] +{ + out <- string +} + +Empty@String[string:out] +{ + out <- "" +} + In[needle,haystack:found?] { - [haystack]Get DString[needle] + [haystack]Get DString[To String[needle]] { found? <- Yes } {} {} { @@ -201,6 +211,41 @@ } } +_Zip[left,lindex,right,rindex,outlist:out] +{ + nlist <- [outlist]Append[ + [[()]Append[ [left]Index[lindex] ]]Append[ [right]Index[rindex] ] + ] + nlindex <- [left]Next[lindex] + { + [right]Next[rindex] + { + out <- _Zip[left,nlindex,right,~,nlist] + }{ + out <- Val[nlist] + } + }{ + out <- Val[nlist] + } +} + +Zip[left,right:out] +{ + lindex <- [left]First + { + Print[~] + [right]First + { + Print[~] + out <- _Zip[left,lindex,right,~,()] + }{ + out <- () + } + }{ + out <- () + } +} + _Dict Split[dict,entry,index,keydelim:out] { parts <- [entry]Split[keydelim] @@ -524,3 +569,28 @@ out <- Fold["_Keys", New@List[], container] } +And[left,right:out] +{ + ,out <- If[left] + { + out,out <- If[right] + } +} + +Or[left,right:out] +{ + out <- If[left] {} + { + out,out <- If[right] + } +} + +After[text,prefix:after,not found] +{ + If[[text]Starts With[prefix]] + { + ,after <- [text]Slice[[prefix]Length] + }{ + not found <- text + } +}
--- a/framework.rhope Tue Apr 28 23:06:07 2009 +0000 +++ b/framework.rhope Wed Apr 29 02:13:24 2009 -0400 @@ -323,7 +323,7 @@ newlist <- [destlist]Set[index, [[""]Put Byte[From Hex@Whole Number[code]]]Append[rest]] [list]Next[index] { - out <- Decode Helper Straight[list, newlist, ~] + out <- Decode Helper Decode[list, newlist, ~] }{ out <- Val[newlist] } @@ -658,7 +658,7 @@ }{ queryvars <- "" } - out <- [[[[[[["<a href=\""]Append[[link]Target>>]]Append[queryvars]]Append["\""] + out <- [[[[[[["<a href=\""]Append[[[link]Target>>]Replace["\"", "%22"]]]Append[queryvars]]Append["\""] ]Append[Get Class[link]]]Append[">"]]Append[Escape HTML Text[[link]Text>>]]]Append["</a>"] } @@ -748,3 +748,35 @@ ]Append[ Fold[["Make Table Row"]<String@Worker, "", [table]Data >>] ] ]Append["\t</table>\n"] } + +Blueprint Web Image +{ + Source + Alt +} + +New@Web Image[source,alt:out] +{ + out <- [[Build["Web Image"]]Source <<[source]]Alt <<[alt] +} + +Name@Web Image[image:name,none] +{ + name <- [image]Source >> +} + +Set Session@Web Image[in,session:out] +{ + out <- in +} + +Postback@Web Image[image,post data:out,events] +{ + out <- image + events <- () +} + +Render@Web Image[image:out,headers] +{ + out <- [[[["<img src=\""]Append[[image]Source >>]]Append["\" alt=\""]]Append[[image]Alt >>]]Append["\">"] +}
--- a/parser.vistxt Tue Apr 28 23:06:07 2009 +0000 +++ b/parser.vistxt Wed Apr 29 02:13:24 2009 -0400 @@ -846,12 +846,13 @@ value,after(1) <- Parse Number[name, params(1)] :||: delims <- [[[[[[{"\n"}]Append[[params(1)]Block Begin >>]]Append[[params(1)]Block End >>]]Append[[params(1)]Empty Block >>]]Append[[params(1)]Arg End >>]]Append[[params(1)]List Delim >>]]Append[[params(1)]List End >>] - ,before,delim <- [name]Get Comment DString[delims, params(1)] + afterdelim,raw before,delim <- [name]Get Comment DString[delims, params(1)] |: after(1) <- [delim]Append[~] :| |::| |::| |: after(1) <- "" :| + before <- Trim[raw before, "\r\n\t "] If[[before] = ["Yes"]] |: yesno <- Yes