WikiScript

From Director Online Wiki
Jump to: navigation, search
on WikiScript(aScript) -----------------------------------------------
   -- INPUT: <aScript> should be a string or a script member, or the
   --         name or number of a script member
   -- OUTPUT: Returns a string with a space before each line so that
   --         the string will appear as pre-formatted text in DougWiki
   --------------------------------------------------------------------
 
   case ilk(aScript) of
     #string:
       -- continue
 
     #member:
      return WikiScript(aScript.scriptText)
 
     #integer, #string:
       return WikiScript(member(aScript))
 
     otherwise
       return "String or script member expected"
   end case
 
   i = the number of lines of aScript
   repeat while i
     if the number of words of line i of aScript then
       put " " before line i of aScript
     end if
 
     i = i - 1
   end repeat
 
   return aScript
 end WikiScript