package0xxxxzzk d_Xiibook 1995-99. S. Weyer, G. Simon. All Rights Reserved Worldwidenssyn.htmNewtPack 3.4 1995-98, S. Weyer (portions may be derived from Newton Toolkit 1992-95, Apple Computer, Inc.)bookAiCk A@UR+book@URC[labelsTC!qY x LAN!TYhi jXAy1Qq!AY@UR/vversion@URflags@URiISBN@URtitle@URSshortTitle@UR3 {author@UR hcopyright@UR-publisher @UR@publicationDate@URIdata@UR !styles@URjɿ~contents@URbrowsers@URߧwtemplates@UR0.rendering@URu?appSymbol@UR\7icon@URohints @nssyn.htm@UR_stringN@Newt's Cape: NewtonScript Syntax @NC NS Syn<@Steve Weyer, Greg Simon@ 1995-99. S. Weyer, G. Simon. All Rights Reserved Worldwide$@Steve Weyer$C1 )9(AYy@URform_hidden @URUBform_printnames@URh base_href@URn9links@URJqGetUserConfig@URedata CA C@http://members.bellatlantic.net/~sweyer/newton/newtscape/docs/nssyn.htm A@URArray C!  $AIa@UR% Fclass@UR:instructions@UR`literals@UR@argFrame@UR[<;numArgs@UR?(CodeBlock @a(|o({|AA 9 Q y@URGetRoot$@UR&!NewtsCape:NewtsCape@URX[GetGlobals C q$A   9 Y@UR _nextArgFrame@UR_parent@URU{y_implementor@URߧwconfigSym@URappC A  ,AA @A 9i)yAY !!!")""#$$$%&9&'!(q*,a,12415617)7;Q<)>@1ABBCD1DEFGHIJ1JC QA Aq  9@UR㧦bviewFont@URiname6@NewtonScript: Syntax@TopC Aq h@This document covers issues related to embedding NewtonScript syntax in HTML: quoting for &, <, >, "; unicode; comments. A new section covers embedding HTML in NewtonScript.C QJ@More advanced documents cover:C @ " Adding META Slots and Values: book slots, special slots/methods, precedence.CAq*@ " URL interpretation/shadowing (this permits the same HTML file to have one behavior in a desktop version and another behavior on the Newton):$A`Cai Aq1I@URazǸhrefs@UR'vscriptsn@ " IMG SRC: string, expressions, soupName/objName$AA (A1$02@advmeta.htm#IMGURLA"@UR!viewgesturescript C!@a{|;A@UR PhrefScript C1$A  Yq@URX'@unit@UR9:LgestureIDC CYi@ " A HREF: string, method, appSymbol, mailto:, http:, isbn#name$AA(A$04@advmeta.htm#HREFURLCiz@ " FORM ACTION: string, method, Notes, mailto: soupName$A,A(A,$D04@advform.htm#FORMURLCIyi0@ " Newt's Cape APIA<A(A<$|0*@advapi.htm#APIC `@ " eventually it may contain more introductory/tutorial information; currently it assumes at least some NewtonScript experience (via NTK or Newt Development Environment).C @6@NewtonScript in HTML.@NewtonScriptHTMLC9i@NewtonScript source for expressions and methods is processed normally as HTML before being compiled on your Newton. You need to do a few things differently because of HTML (delimiters) so that your embedded NewtonScript source is converted as you intended. (Use how the example appears in your browser rather than the underlying HTML source since that has extra quoting):$ADAI(AqD8:@htmlsyn.htm#DelimitersC t@ " use &lt; for < (less than (or equal) test), e.g.,C YD@ " HTML: x &lt; y, 3&lt;=fooC H@ " NewtonScript: x < y, 3<=fooC z@ " use &gt; for > (greater than (or equal) test), e.g.,C D@ " HTML: x &gt; y, 3&gt;=barC H@ " NewtonScript: x > y, 3>=fooC q`@ " use &quot; for " (quote strings), e.g.,C @ " HTML: &quot;this is a string with \&quot; an embedded quote&quot;C @ " NewtonScript: "this is a string with \" an embedded quote"C !9j@ " use &amp; for & (concatenate strings), e.g.,C !h@ " HTML: &quot;abc&quot; &amp; &quot;def&quot;C "AH@ " NewtonScript: "abc" & "def"C "2@ " result: "abcdef"C "@ " use &amp;&amp; for && (concat strings with extra space), e.g.,C #z@ " HTML: &quot;hello&quot; &amp;&amp; &quot;world&quot;C $1R@ " NewtonScript: "hello" && "world"C $<@ " result: "hello world"C $@ " use entity names or unicode sequences (\u) for special characters, e.g.,C %z@ " HTML(entities): &quot;&iquest;Qu&iacute;en es?&quot;C &Qt@ " NewtonScript(unicode): "\u00BF\uQu\u00ED\uen es?"C &:@ " result: "Quen es?"C '96@ " inside PRE, spaces, tabs, and newline characters are preserved; otherwise inside strings, use \t for tab, \n for newline (don't use extra spaces?)C (@ " inside PRE or at the end of an expression, you can use // to comment out rest of line; otherwise, delimit comments with /* ... */ (since returns are removed, your code is really only one line, so first occurrence of // comments out the rest of your code!).C *@ " inside META CONTENT, if a subsequent line does not begin with whitespace, make sure that the previous line has a delimiter -- otherwise (since returns are removed), NewtonScript syntax errors may result.C ,y@6@HTML in NewtonScriptC,1@HTML can be embedded inside a NewtonScript string (if you quote \ and "). This can be useful when using Newt's Cape via its API from NTK Inspector or another application (e.g., HelpURL example). For examples, see examples.htm. This assumes you're relatively comfortable using NS and NTK (you could also track down NS problems using NewtDevEnv/Sloup -- if there's enough interest, I could provide details). Here is a process I use for testing new HTML documents that contain NewtonScript (NS); I use BBEdit Lite (BBEL) on Mac for simple text editing -- adapt this accordingly for your own editor/browser.$AT0C 1@ " after editing document, view it first in a desktop browser (like Netscape) to expose obvious HTML problemsC 2\@ " in a text editor, replace \ with \\ (\\\ in BBEL) -- important for special characters like \n, \t, \u, and for embedding " inside NS strings where you used: \&quot;.C 4Iv@ " replace " with \" -- since the document you'll be using in NTK is a string; this is just for " in HTML; you've already used &quot; instead of " inside of NS expressions -- right?C 5V@ " Select All, Copy (modified source)C 6I@ " Revert (or close/reopen) document to avoid accidentally saving it later with temporary substitutions!C 7AL@ " Paste into an NTK expression:C 7@/* //useful expressions GetGlobalVar('|NewtsCape:NewtsCape|).|YOURISBN| // data for FORM(s) GetRoot().|NewtsCape:NewtsCape|.curBook.data // items added by META to current book GetRoot().Copperfield.contentArea:childViewFrames() // objects on current book page */ GetRoot().|NewtsCape:NewtsCape|:dispatchFile( "text/html", "foo.htm", // provide a complete URL if there are relative URLs to resolve "PASTE YOUR DOCUMENT HERE", nil); // or other options C ;i@ " select dispatchFile expression in NTK -- Select All if you've used the pattern aboveC @ " if you see compile errors on NS objects/methods, copy the reported source code back into text editor (this contains character entity substitutions); look for obvious problems like missing &, mismatched ", and regular NS syntax problems; fix in HTML/NS sourceC @I@ " test individual methods via: GetRoot().|NewtsCape:NewtsCape|.curBook.data:YOURMETHOD(params)C A1@ " inspect data collected by (1st) form via: GetGlobalVar('|NewtsCape:NewtsCape|).|YOURISBN|.|1_YOURACTION|C B1@ " if you have BreakOnThrows on, ignore "bus error 0" (an internal book viewer problem)C C @ " I'm willing to provide more help to registered users and those willing to publish examples.C CA D(@For More Info@CreditsCDQDDi6@ " Top: this documentAHAD(ADH$0@#TopCEEYEyi:@ " Next: Advanced: METAAPAE(AEP$0,@advmeta.htm#TopCFF)FIi&@ " TOC: IntroA(AFY(AF($0.@introtoc.htm#TOCCFFGi(@ " Index: tagsA,AG)(AGQ,$02@tagindex.htm#IndexCGGH i<@ " Newt's Cape Home PageATAH(AHAT$0@http://members.bellatlantic.net/~sweyer/newton/newtscape.htmC H@This document (in all its formats) is 1995-99. Steve Weyer, Greg Simon. All Rights Reserved WorldwideC IT@Version 2.0. Last updated: Feb 1999CJIJyJAJaq@URtype@URZrformCJAJJ@URf"C_proto@URKviewFormatCKKKi@Steve Weyer - weyer@kagi.com Greg Simon - greg@accesscom.com,A888HAK(AL 88(x88@mailto:weyer@kagi.comALQCLiLLA 9L@URLz@\list@ContentsALMyMMCLMY AMM)MA@URw>bounds@URCitem@URazǸlevelA0CLMyA`CLM,aAHCLNCADAN1CNINNANiNI@UR 97nColumns@URcolumnANCN0ANJa@URS6width,AO)PqPQ1QYR1RQ C!OIOO 1@a(~o(~*o{|}~;_${|~B$A 9 Q yOO@UR҃hrefScriptG@URUhasVariable(CPPY,A  PAYq Y@URYu!CobjC  @URxFviewClickScript C!PP@a"CPQ A  Q@UR=argC $@UR;viewSetupDoneScript C!QyQQ @a({o({AA 9 Q yQ@URļ"BookOpenScriptCQR A   YC @UR)ZviewQuitScript C!RqRS=@a()o{@_0{o{_"o/{*_0"0A 9RSS)SASiSSS@URv-Copperfield$@URQj4SetStatusBarButtons@UR*d]hasVar!@URClearKeyCommands@UR(qlbuttonsOn@URG7G[extraButtons@UR?hstepChildren@URƐRemoveSlotCT TA A  T)@URviewerC ATiCTTUyhATT@URIpageSize@URopagesCT AUU1UIUa@UR+left@UR.top@URǢright@URۡbottom0AUXZ^1_abdgCUN1VAUU@URJ0|template@URNblocks4ALVIVVW WAWyWWX!CVaVy AMM)ACVaV9ACVaVA PCVaW!iA XCVaWYA@ CVaWA@CVaWA@PCVaX)A@XCX9XqAMM)XY@URodataLenA CUN1X,AXMyYqYYZZQZCXY9YY AMM)YXY@UR}mdataOffsetA 0C CVaYAx(CVaYA 8CVaYAA@CVaZ1A@CVaZiA pCVaZA@xCUN1ZDA[![Y[[\\9\q\\]]Q]]]CVa[9A@0`CVa[qYA hCVa[A@CVa[ A@hCVa\!!A pCVa\Q!A@8CVa\")A@@pCVa\"A@xCVa\"A CVa]1#A@xCVa]i$A@CVa]$A@CVa]$A PCVa^%A@XCUN1^I(A^q^^__QM_CVa^&9A@0CVa^&A@CVa^'!A CVa_1(qA CVa_i*A CX9_,$A`CUN1_A_`aaICX``9(DA0C,1`YiA`i(A`P0$4F@../examples.htm#NewtonScriptCVa`1A @CVaa)2A HCX9aa41A CUN1a AabbIbbCXaaA 0C 4ICVab)5A CVaba61A hCVab7)A pCX9b7ACUN1c $Ac1cccd1diCXcQcqDA0C 7CVac;QA `CVac<)A hCVad>A CVadI@1A xCX9dAA CUN1d@AdeQeMeef1fiffggIgCXee9A 0C A1CVaeiBA 0CVaeBA 8CVaeD1A TCVafDA CVafIEA CVafFA ,CVafGA 4dCVafHAtCVag)IALCVagaJ1AdlCX9gJpACUN1gAgCXhh!t|A0hCKKhAiAhQ(AhyH8@@mailto:greg@accesscom.comAhA @URqnssyn.htmCi!iQiAi9M@URO"bits@i98x ?80=.L5$L5L5$L5$|464646464670?8 CT|tA@URǢbooks