• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: formatting AS source for web
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: formatting AS source for web


  • Subject: Re: formatting AS source for web
  • From: Bryan <email@hidden>
  • Date: Sun, 12 Aug 2001 04:19:19 -0400
  • Organization: Apex Radiology

The following line doesn't compile

set textList to every style run of paragraph i
-->Expected class name but found property

I don't see this class in Tex-Edit Plus's dictionary;
is it a coercion from the system?

What version of TE are you running?

Bryan Kaufman

Timothy Bates wrote:

> > On 8/1/01 11:53 AM Robert J. Rust wrote:
> >> Does anybody know of a good way to format AppleScript source code for the
> >> web
> On 11/8/01 4:45 PM, "Chris Adams" <email@hidden> wrote:
> > 1) open the script in Script Editor
> > 2) Cut and paste into Appleworks
> > 3) Save as HTML
>
> >To attempt this with style sheets and lists of keywords is
> > agony - I tried it for another project.
>
> OK. Here is the agony free solution.
>
> You need to grab Marco Piovanelli's AppleScript Formatting extension. This
> gives the script access to your script formatting prefs.
>
> You also need to create an AppleScript css style sheet and link it into each
> web page that contains AppleScript (and match up the names used in this
> script with those in your style sheet (I append one which works as is)).
>
> The power of this solution is that the html is much smaller and you can
> change all the styles with one edit (of the css sheet).
>
> The script works in partnership with TexEdit+
>
> You simply copy the code into TexEdit+, run this this script, and then paste
> the clipboard into your html editor of choice (I recommend Pepper and
> Dreamweaver - best solution in the universe).
>
> --***************The script starts here***********--
>
> (*properties*)
> property ValueColor : {12079, 35723, 8224} --{26214, 39321, 13107}
> property valStyleName : "\"value\""
>
> property VarColor : {6168, 8738, 52685}
> property varStyleName : "\"var\""
>
> property ASKeyWordColor : {0, 0, 0}
> property ASKeyStyleName : "\"LangKyWd\""
>
> property CommentColor : {65535, 1968, 1968}
> property commentStyleName : "\"comment\""
>
> property AppKeyWordColor : {5178, 5961, 51772}
> property appKeyStyleName : "\"AppKyWd\""
> -- these settings are the ones I commonly use -
> --whatever you use will be picked up using the AppleScript
> --formatting scripting extension
>
> (*grab the user's own formatting settings*)
> set formatRecord to AppleScript formatting
> set ASKeyWordColor to color of language keyword style of formatRecord
> set ValueColor to color of literal style of formatRecord
> set VarColor to color of user symbol style of formatRecord
> set CommentColor to color of comment style of formatRecord
> set AppKeyWordColor to color of application keyword style of formatRecord
>
> (*
> You could use something like this to programatically get the text
> tell application "Script Debugger"
> activate
> set bugger to the selection
> end tell
> *)
>
> tell application "Tex-Edit Plus"
> if ASKeyWordColor is {0, 0, 0} then set ASKeyWordColor to black
>
> (*make new window
> paste
> *)
> activate
> set theHTML to {}
> tell window 1
> set currentDepth to 0
> set paraCount to count of paragraphs
> repeat with i from 1 to paraCount
> set theLine to paragraph i as string
> set theNewDepth to (count of (REMatch theLine pattern "^\\t+"))
> --- 1
> --set theLine to REMatch theLine pattern "(^\\t+)(.*)" using
> "\\2"
> set insetHTML to ""
> if theNewDepth is equal to currentDepth then
> set insetHTML to "<br>" & return
> else if theNewDepth > currentDepth then
> repeat with k from 1 to theNewDepth - currentDepth
> set insetHTML to insetHTML & "<blockquote>" & return
> end repeat
> set currentDepth to theNewDepth
> else
> repeat with k from 1 to currentDepth - theNewDepth
> set insetHTML to insetHTML & return & "</blockquote>"
> end repeat
> set currentDepth to theNewDepth
> end if
>
> set the end of theHTML to insetHTML
> set textList to every style run of paragraph i
> set theColors to color of every style run of paragraph i
> set theStyleRecList to style of every style run of paragraph i
> repeat with n from 1 to count of textList
> set theStyle to on styles of item n of theStyleRecList
> set thisText to item n of textList
> set thisColor to item n of theColors
>
> --some of what follows makes assumptions that will not hold
> for you. I have not fully
> --prepared the code for wide distribution
> if thisColor is ASKeyWordColor then
> --check for bolded appKeyWord
> if bold is in theStyle then --AS keyword
> set theHTMLFragment to "<span class=" &
> ASKeyStyleName & ">" & thisText & "</span>"
> else
> set theHTMLFragment to thisText --plain black text
> end if
> else if bold is in theStyle then --Application keyword
> set theHTMLFragment to "<span class=" & appKeyStyleName
> & ">" & thisText & "</span>"
> else if thisColor is ValueColor then
> set theHTMLFragment to "<span class=" & valStyleName &
> ">" & thisText & "</span>"
> else if thisColor is VarColor then
> set theHTMLFragment to "<span class=" & varStyleName &
> ">" & thisText & "</span>"
> else if thisColor is CommentColor then
> set theHTMLFragment to "<span class=" & commentStyleName
> & ">" & thisText & "</span>"
> else
> set theHTMLFragment to thisText
> end if
> set the end of theHTML to theHTMLFragment
> end repeat
> end repeat
> --close progress indicator all windows
> end tell
> activate
> set outstring to join list theHTML with delimiters " "
> set outstring to ACME replace tab in outstring with "" with all
> occurrences
>
> set the clipboard to outstring
> end tell
> --Here you could ask the user if they want to store this as an html file
> (*
> If dreamweaver ever becomes scriptable then ...
> tell application "Dreamweaver"
> activate
> end tell
> *)
> --close progress indicator all windows
>
> --used to use progress indicator but it chews cycles
>
> This is my style sheet
>
> h1 { font-family: Georgia, "Times New Roman", Times, serif; text-align:
> justify; font-size: xx-large; font-weight: bold; font-style: normal;
> font-variant: normal; color: #3399CC}
> h2 { font-family: "Times New Roman", Times, serif; font-size: x-large;
> color: #996600; border-color: black black #996600; border-bottom-width:
> thin}
> h3 { font-family: "Times New Roman", Times, serif; font-size: large}
> h4 { font-family: "Times New Roman", Times, serif; font-size: large;
> font-style: italic; color: #3399CC}
> h5 { font-family: "Times New Roman", Times, serif; font-weight: bold;
> font-style: normal; font-size: medium}
> h6 { font-family: "Times New Roman", Times, serif; font-size: 12pt;
> font-style: italic; font-variant: small-caps}
>
> a { text-decoration: underline}
> A:visited {color: #000000; text-decoration: underline}
> A:link {text-decoration: underline}
> A:hover {color: #336600; text-decoration: underline}
> A:active {color: #FF0000; text-decoration: none}
>
> .footer { font-family: Arial, Helvetica, sans-serif; font-size: 9pt}
> .timEdit { color: #FF0000}
> .timDelete { color: #FF0000 ; text-decoration: line-through} h3 {
> font-family: "Times New Roman", Times, serif; font-weight: 700; color:
> #000000}
> .highlightGreen { color: #999900}
> tt { color: #0000FF}
> .jVol { font-weight: bold}
> .jTitle { font-style: italic }
> .AppKyWd { color: #0000CC; font-weight: bold}
> .LangKyWd { color: #000000; font-weight: bold}
> .comment { font-style: italic; color: #FF0000}
> .value { color: #669900}
> .var { color: #0000CC; font-weight: normal}
> .UsrSymbl { color: #0000CC; font-weight: normal}
> .howDoI { font-family: Arial, Helvetica, sans-serif; font-style: italic;
> background-color: #CCCCCC}
> .references
> {text-align:justify;
> text-indent:-28.35pt;
> font-size:12.0pt;
> font-family:"Times New Roman";}
> p { font-family: "Times New Roman", Times, serif}
> .advanced { font-family: Arial, Helvetica, sans-serif; font-style: italic;
> background-color: #FFCCCC}
> .payattention { font-family: Arial, Helvetica, sans-serif; font-style:
> italic; background-color: #FF6633}
> .legacy { font-family: Arial, Helvetica, sans-serif; font-style: italic;
> background-color: #CCCCCC }
> .--legacy { font-family: Arial, Helvetica, sans-serif; font-style: italic;
> background-color: #006666}
> .--note { font-family: Arial, Helvetica, sans-serif; font-style: italic;
> background-color: #CCCCCC }
> -->
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users


References: 
 >Re: formatting AS source for web (From: Timothy Bates <email@hidden>)

  • Prev by Date: Re: does property exists in a record
  • Next by Date: Re: Can't download Smile from VersionTracker
  • Previous by thread: Re: formatting AS source for web
  • Next by thread: RE: Scripting VSS
  • Index(es):
    • Date
    • Thread