• 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: AppleScript --> HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript --> HTML


  • Subject: Re: AppleScript --> HTML
  • From: John Delacour <email@hidden>
  • Date: Fri, 25 Jul 2003 21:07:21 +0100
  • Mac-eudora-version: 6.0a28

At 3:42 pm +0100 25/7/03, Nigel Smith wrote:

Both JD and Jean-Baptiste replied on how to create a Style Sheet based on a
user's AS formatting preferences (see earlier posts).

Sorry guys, I obviously mis-explained.

The plan should be:

1. Extract, from the .plist, Smile's ASFormat, or whatever, the user's
formatting preferences.
2. Use those preferences to parse the contents of the front script
editor window so you can tag up the text with context-sensitive information.
3. Whip that into HTML.

Here's a script to produce a css header based on the plist -- I don't guarantee the validity of it but it's not far out.:



BEWARE OF LONG LINE

---------
do shell script "perl -e '$pt = qq~pt~;
print qq~<style>$/<!--$/~;
@c=qw~asnew asops aslan asapp ascom asval asvar asref~ ;
@ls = split qq~\\012~, `defaults read com.apple.applescript AppleScriptTextStyles`;
for (@ls[1..8]) {
$class = $c[$i];
s~\\s*\",?~~g;
s~;p;~;font-weight:normal;~g ;
s~;b;~;font-weight:bold;~g ;
s~;i;~;font-style:italic;~g ;
($f,$s,$sz,$c) = split qq~;~;
($r,$g,$b)= split q~ ~, $c;
$r = sprintf qq~rgb(%d,~, $r /= 256;
$g = sprintf qq~%d,~, $g /= 256;
$b = sprintf qq~%d)~, $b /= 256;
print <<EOS;
span.$class { font-family:$f; $s; size:$sz$pt; color:$r$g$b }
EOS
$i++ ;}
print qq~-->$/</style>$/~;'"
---------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: AppleScript --> HTML (From: Nigel Smith <email@hidden>)

  • Prev by Date: Re: UI Scripting FileMaker
  • Next by Date: Script Editor
  • Previous by thread: Re: AppleScript --> HTML
  • Next by thread: Re: AppleScript --> HTML
  • Index(es):
    • Date
    • Thread