Commit a8f2e5302a6a84092092788222c9b0ce48769fc9

Authored by totoro
1 parent 94b434c7

add media attribute to css file

Showing 1 changed file with 50 additions and 11 deletions   Show diff stats
web/CXM_making_a_web_site.anubis
... ... @@ -1040,9 +1040,47 @@ public type TextAreaOption:
1040 1040 public type CSS_Style:
1041 1041 text_options(List(Text_Option)).
1042 1042  
  1043 +public type CSS_File_Media:
  1044 + screen, //Intended for non-paged computer screens.
  1045 + tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities.
  1046 + tv, //Intended for television-type devices (low resolution, color, limited scrollability).
  1047 + projection, //Intended for projectors.
  1048 + handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth).
  1049 + print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode.
  1050 + braille, //Intended for braille tactile feedback devices.
  1051 + aural, //Intended for speech synthesizers.
  1052 + all. //Suitable for all devices.
  1053 +
  1054 +public define String
  1055 + to_String
  1056 + (
  1057 + CSS_File_Media css_file_media
  1058 + )=
  1059 + if css_file_media is
  1060 + {
  1061 + screen then "screen",
  1062 + tty then "tty",
  1063 + tv then "tv",
  1064 + projection then "projection",
  1065 + handheld then "handheld",
  1066 + print then "print",
  1067 + braille then "braille",
  1068 + aural then "aural",
  1069 + all then "all"
  1070 + }.
  1071 +
  1072 +
  1073 + .
1043 1074 public type CSS_File:
1044   - css_file(String file_name).
  1075 + css_file(String file_name, CSS_File_Media).
1045 1076  
  1077 +public define CSS_File
  1078 + css_file
  1079 + (
  1080 + String file_name
  1081 + )=
  1082 + css_file(file_name, all).
  1083 +
1046 1084 public type JS_Attribute:
1047 1085 attr (String, String).
1048 1086  
... ... @@ -3927,17 +3965,18 @@ define Printable_tree
3927 3965 }.
3928 3966  
3929 3967 define Printable_tree
3930   - add_css_files
3931   - (
3932   - List(CSS_File) l
3933   - ) =
3934   - if l is
3935   - {
3936   - [ ] then [ ],
3937   - [h . t] then
3938   - [ ["<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file_name(h) + "\" />\n" ]
  3968 + add_css_files
  3969 + (
  3970 + List(CSS_File) l
  3971 + ) =
  3972 + if l is
  3973 + {
  3974 + [ ] then [ ],
  3975 + [h . t] then
  3976 + since h is css_file(file_name, media),
  3977 + [ ["<link rel=\"stylesheet\" type=\"text/css\" href=\"" + file_name + "\" media=\""+to_String(media)+"\"/>\n" ]
3939 3978 . add_css_files(t)]
3940   - }.
  3979 + }.
3941 3980  
3942 3981 define Printable_tree
3943 3982 add_js_files_attributes
... ...