Skip to content

various tweaks #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
31 changes: 17 additions & 14 deletions vObjectLib.livecodescript
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ end vObjectGroupProperties
*
* @param pObject Passed by reference. It points to the vObject container that will be changed.
*/
on vObjectReverse @pObject
repeat with x = the number of lines of pObject down to 1
put line x of pObject & lf after tRetVal
private command vObjectReverse @pObject
repeat for each line tLine in pObject
--repeat with x = the number of lines of pObject down to 1
--put line x of pObject & lf after tRetVal
put tLine & cr before tRetVal
end repeat
put tRetVal into pObject
end vObjectReverse
Expand Down Expand Up @@ -250,11 +252,13 @@ end getvObjectParam
* @param pObject The object to be folded.
*/
on vObjectFold @pObject
repeat with x = 1 to the number of lines in pObject
put line x of pObject into tLine
local x
put 1 into x
repeat for each line tLine in pObject
if len(tLine) > 75 then
put LF & " " after char 75 of line x of pObject
end if
add 1 to x
end repeat
return true
end vObjectFold
Expand Down Expand Up @@ -316,17 +320,20 @@ end vObjectGet
* @return An array of vObjects
*/
function vObjectSplit pObjectType, pObject
local x

put "BEGIN:" & pObjectType into tHeader
put "END:" & pObjectType into tFooter
repeat with x = 1 to the number of lines in pObject
put line x of pObject into tLine
put 1 into x
repeat for each line tLine in pObject
if tLine contains tHeader then put x into tBeginBlock
if tLine contains tFooter then put x into tEndBlock
if tEndBlock is not empty then
put line tBeginBlock to tEndBlock of pObject & numToChar(4) after tRetVal
put empty into tEndBlock
put empty into tBeginBlock
end if
add 1 to x
end repeat
delete char -1 of tRetVal
split tRetVal by numToChar(4)
Expand Down Expand Up @@ -543,7 +550,8 @@ on vCardAddNote @pObject, pValue
end vCardAddNote

on vCardAddProdID @pObject, pValue
put format("-//$s//Revolution/MetaCard//EN", pValue) into tValue
--put format("-//$s//Revolution/MetaCard//EN", pValue) into tValue
put format("-//$s//LiveCode//EN", pValue) into tValue
vObjectAddProperty pObject, "PRODID", tValue
end vCardAddProdID

Expand Down Expand Up @@ -620,12 +628,7 @@ on vCardSerialize @pObject
if it is false then
return "Error: Required prop name. use vCardAddName to add name."
end if
repeat with x = 1 to the number of lines in pObject
put line x of pObject into tLine
if len(tLine) > 75 then
put LF & " " after char 75 of line x of pObject
end if
end repeat
vObjectFold pObject
return true
end vCardSerialize

Expand Down