frontsau 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +21 -0
  5. data/README.md +30 -0
  6. data/Rakefile +2 -0
  7. data/bin/frontsau +15 -0
  8. data/bin/frontsau-phaml-compiler +35 -0
  9. data/example/.frontsau +12 -0
  10. data/example/assets/head.jpg +0 -0
  11. data/example/assets/script.js +4 -0
  12. data/example/assets/style.css +6 -0
  13. data/example/css/includes.sass +2 -0
  14. data/example/css/style.sass +6 -0
  15. data/example/image/head.jpg +0 -0
  16. data/example/index.html +0 -0
  17. data/example/js/script.coffee +1 -0
  18. data/frontsau.gemspec +41 -0
  19. data/lib/Phamlp/Phamlp.php +72 -0
  20. data/lib/Phamlp/PhamlpException.php +31 -0
  21. data/lib/Phamlp/haml/HamlException.php +29 -0
  22. data/lib/Phamlp/haml/HamlHelpers.php +199 -0
  23. data/lib/Phamlp/haml/HamlParser.php +1250 -0
  24. data/lib/Phamlp/haml/filters/HamlBaseFilter.php +30 -0
  25. data/lib/Phamlp/haml/filters/HamlCdataFilter.php +29 -0
  26. data/lib/Phamlp/haml/filters/HamlCssFilter.php +30 -0
  27. data/lib/Phamlp/haml/filters/HamlEscapedFilter.php +32 -0
  28. data/lib/Phamlp/haml/filters/HamlJavascriptFilter.php +31 -0
  29. data/lib/Phamlp/haml/filters/HamlPhpFilter.php +27 -0
  30. data/lib/Phamlp/haml/filters/HamlPlainFilter.php +28 -0
  31. data/lib/Phamlp/haml/filters/HamlPreserveFilter.php +29 -0
  32. data/lib/Phamlp/haml/filters/HamlSassFilter.php +37 -0
  33. data/lib/Phamlp/haml/filters/HamlScssFilter.php +37 -0
  34. data/lib/Phamlp/haml/filters/_HamlMarkdownFilter.php +50 -0
  35. data/lib/Phamlp/haml/filters/_HamlTextileFilter.php +50 -0
  36. data/lib/Phamlp/haml/messages/_i18n.php +32 -0
  37. data/lib/Phamlp/haml/messages/de.php +32 -0
  38. data/lib/Phamlp/haml/messages/fr.php +32 -0
  39. data/lib/Phamlp/haml/renderers/HamlCompactRenderer.php +32 -0
  40. data/lib/Phamlp/haml/renderers/HamlCompressedRenderer.php +48 -0
  41. data/lib/Phamlp/haml/renderers/HamlExpandedRenderer.php +58 -0
  42. data/lib/Phamlp/haml/renderers/HamlNestedRenderer.php +77 -0
  43. data/lib/Phamlp/haml/renderers/HamlRenderer.php +137 -0
  44. data/lib/Phamlp/haml/tree/HamlCodeBlockNode.php +58 -0
  45. data/lib/Phamlp/haml/tree/HamlCommentNode.php +41 -0
  46. data/lib/Phamlp/haml/tree/HamlDoctypeNode.php +27 -0
  47. data/lib/Phamlp/haml/tree/HamlElementNode.php +52 -0
  48. data/lib/Phamlp/haml/tree/HamlFilterNode.php +50 -0
  49. data/lib/Phamlp/haml/tree/HamlHelperNode.php +73 -0
  50. data/lib/Phamlp/haml/tree/HamlNode.php +253 -0
  51. data/lib/Phamlp/haml/tree/HamlNodeExceptions.php +19 -0
  52. data/lib/Phamlp/haml/tree/HamlRootNode.php +58 -0
  53. data/lib/Phamlp/sass/SassException.php +29 -0
  54. data/lib/Phamlp/sass/SassFile.php +164 -0
  55. data/lib/Phamlp/sass/SassParser.php +848 -0
  56. data/lib/Phamlp/sass/extensions/compass/config.php +65 -0
  57. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/_blueprint.scss +47 -0
  58. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +101 -0
  59. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_colors.scss +32 -0
  60. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_debug.scss +11 -0
  61. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +86 -0
  62. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_form.scss +68 -0
  63. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_grid.scss +249 -0
  64. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_ie.scss +109 -0
  65. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +57 -0
  66. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +37 -0
  67. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +147 -0
  68. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_print.scss +93 -0
  69. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_reset.scss +3 -0
  70. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +133 -0
  71. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +54 -0
  72. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_typography.scss +104 -0
  73. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +37 -0
  74. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +58 -0
  75. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/grid.png +0 -0
  76. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/ie.sass +4 -0
  77. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/manifest.rb +30 -0
  78. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/partials/_base.sass +10 -0
  79. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/print.sass +4 -0
  80. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/screen.sass +12 -0
  81. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
  82. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
  83. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
  84. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
  85. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/manifest.rb +17 -0
  86. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
  87. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
  88. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
  89. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
  90. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
  91. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
  92. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
  93. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
  94. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
  95. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/manifest.rb +23 -0
  96. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/grid.png +0 -0
  97. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/ie.sass +16 -0
  98. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/manifest.rb +30 -0
  99. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
  100. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/print.sass +8 -0
  101. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/screen.sass +45 -0
  102. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/grid.png +0 -0
  103. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/ie.sass +16 -0
  104. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/manifest.rb +33 -0
  105. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_base.sass +10 -0
  106. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_form.sass +6 -0
  107. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_page.sass +18 -0
  108. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_two_col.sass +38 -0
  109. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/print.sass +5 -0
  110. data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/screen.sass +14 -0
  111. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/_compass.scss +2 -0
  112. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_css3.scss +15 -0
  113. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_layout.scss +1 -0
  114. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_reset.scss +3 -0
  115. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_utilities.scss +6 -0
  116. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
  117. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
  118. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-size.scss +14 -0
  119. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
  120. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
  121. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
  122. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box.scss +112 -0
  123. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_columns.scss +55 -0
  124. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_font-face.scss +33 -0
  125. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_gradient.scss +82 -0
  126. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
  127. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_opacity.scss +27 -0
  128. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_shared.scss +47 -0
  129. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
  130. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transform.scss +85 -0
  131. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transition.scss +85 -0
  132. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
  133. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/reset/_utilities.scss +133 -0
  134. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_general.scss +6 -0
  135. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_links.scss +3 -0
  136. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_lists.scss +4 -0
  137. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_print.scss +17 -0
  138. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
  139. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_tables.scss +3 -0
  140. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_text.scss +3 -0
  141. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
  142. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
  143. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
  144. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
  145. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
  146. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
  147. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
  148. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
  149. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
  150. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
  151. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
  152. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
  153. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
  154. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
  155. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
  156. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
  157. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
  158. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
  159. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
  160. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
  161. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
  162. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/ellipsis.sass +9 -0
  163. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/manifest.rb +27 -0
  164. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
  165. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/manifest.rb +20 -0
  166. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/stylesheets/main.sass +1 -0
  167. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -0
  168. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/screen.sass +2 -0
  169. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/USAGE.markdown +32 -0
  170. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/ie.sass +6 -0
  171. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/manifest.rb +4 -0
  172. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/print.sass +6 -0
  173. data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/screen.sass +7 -0
  174. data/lib/Phamlp/sass/extensions/compass/functions/colourStops.php +268 -0
  175. data/lib/Phamlp/sass/extensions/compass/functions/constants.php +44 -0
  176. data/lib/Phamlp/sass/extensions/compass/functions/fontFiles.php +30 -0
  177. data/lib/Phamlp/sass/extensions/compass/functions/imageSize.php +39 -0
  178. data/lib/Phamlp/sass/extensions/compass/functions/inlineData.php +84 -0
  179. data/lib/Phamlp/sass/extensions/compass/functions/lists.php +47 -0
  180. data/lib/Phamlp/sass/extensions/compass/functions/selectors.php +128 -0
  181. data/lib/Phamlp/sass/extensions/compass/functions/urls.php +143 -0
  182. data/lib/Phamlp/sass/extensions/compass/stylesheets/_compass.scss +2 -0
  183. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_css3.scss +15 -0
  184. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_layout.scss +1 -0
  185. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_reset.scss +3 -0
  186. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_utilities.scss +6 -0
  187. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
  188. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
  189. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-size.scss +14 -0
  190. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
  191. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
  192. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
  193. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box.scss +112 -0
  194. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_columns.scss +55 -0
  195. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_font-face.scss +33 -0
  196. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_gradient.scss +96 -0
  197. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
  198. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_opacity.scss +27 -0
  199. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_shared.scss +47 -0
  200. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
  201. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transform.scss +85 -0
  202. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transition.scss +85 -0
  203. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
  204. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/reset/_utilities.scss +133 -0
  205. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_general.scss +6 -0
  206. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_links.scss +3 -0
  207. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_lists.scss +4 -0
  208. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_print.scss +17 -0
  209. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
  210. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_tables.scss +3 -0
  211. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_text.scss +3 -0
  212. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
  213. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
  214. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
  215. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
  216. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
  217. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
  218. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
  219. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
  220. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
  221. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
  222. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
  223. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
  224. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
  225. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
  226. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
  227. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
  228. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
  229. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
  230. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
  231. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
  232. data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
  233. data/lib/Phamlp/sass/messages/_i18n.php +122 -0
  234. data/lib/Phamlp/sass/messages/de.php +70 -0
  235. data/lib/Phamlp/sass/messages/fr.php +70 -0
  236. data/lib/Phamlp/sass/renderers/SassCompactRenderer.php +130 -0
  237. data/lib/Phamlp/sass/renderers/SassCompressedRenderer.php +102 -0
  238. data/lib/Phamlp/sass/renderers/SassExpandedRenderer.php +62 -0
  239. data/lib/Phamlp/sass/renderers/SassNestedRenderer.php +61 -0
  240. data/lib/Phamlp/sass/renderers/SassRenderer.php +51 -0
  241. data/lib/Phamlp/sass/script/SassScriptFunction.php +169 -0
  242. data/lib/Phamlp/sass/script/SassScriptFunctions.php +751 -0
  243. data/lib/Phamlp/sass/script/SassScriptLexer.php +114 -0
  244. data/lib/Phamlp/sass/script/SassScriptOperation.php +151 -0
  245. data/lib/Phamlp/sass/script/SassScriptParser.php +192 -0
  246. data/lib/Phamlp/sass/script/SassScriptParserExceptions.php +40 -0
  247. data/lib/Phamlp/sass/script/SassScriptVariable.php +57 -0
  248. data/lib/Phamlp/sass/script/literals/SassBoolean.php +67 -0
  249. data/lib/Phamlp/sass/script/literals/SassColour.php +886 -0
  250. data/lib/Phamlp/sass/script/literals/SassLiteral.php +359 -0
  251. data/lib/Phamlp/sass/script/literals/SassLiteralExceptions.php +47 -0
  252. data/lib/Phamlp/sass/script/literals/SassNumber.php +503 -0
  253. data/lib/Phamlp/sass/script/literals/SassString.php +106 -0
  254. data/lib/Phamlp/sass/tree/SassCommentNode.php +64 -0
  255. data/lib/Phamlp/sass/tree/SassContext.php +120 -0
  256. data/lib/Phamlp/sass/tree/SassDebugNode.php +84 -0
  257. data/lib/Phamlp/sass/tree/SassDirectiveNode.php +76 -0
  258. data/lib/Phamlp/sass/tree/SassElseNode.php +28 -0
  259. data/lib/Phamlp/sass/tree/SassExtendNode.php +47 -0
  260. data/lib/Phamlp/sass/tree/SassForNode.php +99 -0
  261. data/lib/Phamlp/sass/tree/SassIfNode.php +95 -0
  262. data/lib/Phamlp/sass/tree/SassImportNode.php +69 -0
  263. data/lib/Phamlp/sass/tree/SassMixinDefinitionNode.php +88 -0
  264. data/lib/Phamlp/sass/tree/SassMixinNode.php +91 -0
  265. data/lib/Phamlp/sass/tree/SassNode.php +342 -0
  266. data/lib/Phamlp/sass/tree/SassNodeExceptions.php +117 -0
  267. data/lib/Phamlp/sass/tree/SassPropertyNode.php +239 -0
  268. data/lib/Phamlp/sass/tree/SassRootNode.php +100 -0
  269. data/lib/Phamlp/sass/tree/SassRuleNode.php +337 -0
  270. data/lib/Phamlp/sass/tree/SassVariableNode.php +90 -0
  271. data/lib/Phamlp/sass/tree/SassWhileNode.php +64 -0
  272. data/lib/frontsau/assets/rack.rb +12 -0
  273. data/lib/frontsau/assets/sprockets.rb +59 -0
  274. data/lib/frontsau/assets/static_assets_compiler.rb +50 -0
  275. data/lib/frontsau/assets/url_rewriter.rb +22 -0
  276. data/lib/frontsau/assets/watcher.rb +60 -0
  277. data/lib/frontsau/thor_app.rb +118 -0
  278. data/lib/frontsau/version.rb +3 -0
  279. data/lib/frontsau.rb +64 -0
  280. metadata +578 -0
@@ -0,0 +1,120 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassContext.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassContext class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassContext class.
14
+ * Defines the context that the parser is operating in and so allows variables
15
+ * to be scoped.
16
+ * A new context is created for Mixins and imported files.
17
+ * @package PHamlP
18
+ * @subpackage Sass.tree
19
+ */
20
+ class SassContext {
21
+ /**
22
+ * @var SassContext enclosing context
23
+ */
24
+ protected $parent;
25
+ /**
26
+ * @var array mixins defined in this context
27
+ */
28
+ protected $mixins = array();
29
+ /**
30
+ * @var array variables defined in this context
31
+ */
32
+ protected $variables = array();
33
+ /**
34
+ * @var SassNode the node being processed
35
+ */
36
+ public $node;
37
+
38
+ /**
39
+ * SassContext constructor.
40
+ * @param SassContext - the enclosing context
41
+ * @return SassContext
42
+ */
43
+ public function __construct($parent = null) {
44
+ $this->parent = $parent;
45
+ }
46
+
47
+ /**
48
+ * Adds a mixin
49
+ * @param string name of mixin
50
+ * @return SassMixinDefinitionNode the mixin
51
+ */
52
+ public function addMixin($name, $mixin) {
53
+ $this->mixins[$name] = $mixin;
54
+ return $this;
55
+ }
56
+
57
+ /**
58
+ * Returns a mixin
59
+ * @param string name of mixin to return
60
+ * @return SassMixinDefinitionNode the mixin
61
+ * @throws SassContextException if mixin not defined in this context
62
+ */
63
+ public function getMixin($name) {
64
+ if (isset($this->mixins[$name])) {
65
+ return $this->mixins[$name];
66
+ }
67
+ elseif (!empty($this->parent)) {
68
+ return $this->parent->getMixin($name);
69
+ }
70
+ throw new SassContextException('Undefined {what}: {name}', array('{what}'=>'Mixin', '{name}'=>$name), $this->node);
71
+ }
72
+
73
+ /**
74
+ * Returns a variable defined in this context
75
+ * @param string name of variable to return
76
+ * @return string the variable
77
+ * @throws SassContextException if variable not defined in this context
78
+ */
79
+ public function getVariable($name) {
80
+ if (isset($this->variables[$name])) {
81
+ return $this->variables[$name];
82
+ }
83
+ elseif (!empty($this->parent)) {
84
+ return $this->parent->getVariable($name);
85
+ }
86
+ else {
87
+ throw new SassContextException('Undefined {what}: {name}', array('{what}'=>'Variable', '{name}'=>$name), $this->node);
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Returns a value indicating if the variable exists in this context
93
+ * @param string name of variable to test
94
+ * @return boolean true if the variable exists in this context, false if not
95
+ */
96
+ public function hasVariable($name) {
97
+ return isset($this->variables[$name]);
98
+ }
99
+
100
+ /**
101
+ * Sets a variable to the given value
102
+ * @param string name of variable
103
+ * @param sassLiteral value of variable
104
+ */
105
+ public function setVariable($name, $value) {
106
+ $this->variables[$name] = $value;
107
+ return $this;
108
+ }
109
+
110
+ /**
111
+ * Makes variables and mixins from this context available in the parent context.
112
+ * Note that if there are variables or mixins with the same name in the two
113
+ * contexts they will be set to that defined in this context.
114
+ */
115
+ public function merge() {
116
+ $this->parent->variables =
117
+ array_merge($this->parent->variables, $this->variables);
118
+ $this->parent->mixins = array_merge($this->parent->mixins, $this->mixins);
119
+ }
120
+ }
@@ -0,0 +1,84 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassDebugNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
3
+ /**
4
+ * SassDebugNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassDebugNode class.
14
+ * Represents a Sass @debug or @warn directive.
15
+ * @package PHamlP
16
+ * @subpackage Sass.tree
17
+ */
18
+ class SassDebugNode extends SassNode {
19
+ const IDENTIFIER = '@';
20
+ const MATCH = '/^@(?:debug|warn)\s+(.+?)\s*;?$/';
21
+ const MESSAGE = 1;
22
+
23
+ /**
24
+ * @var string the debug/warning message
25
+ */
26
+ private $message;
27
+ /**
28
+ * @var array parameters for the message;
29
+ * only used by internal warning messages
30
+ */
31
+ private $params;
32
+ /**
33
+ * @var boolean true if this is a warning
34
+ */
35
+ private $warning;
36
+
37
+ /**
38
+ * SassDebugNode.
39
+ * @param object source token
40
+ * @param mixed string: an internally generated warning message about the
41
+ * source
42
+ * boolean: the source token is a @debug or @warn directive containing the
43
+ * message; True if this is a @warn directive
44
+ * @param array parameters for the message
45
+ * @return SassDebugNode
46
+ */
47
+ public function __construct($token, $message=false, $params=array()) {
48
+ parent::__construct($token);
49
+ if (is_string($message)) {
50
+ $this->message = $message;
51
+ $this->warning = true;
52
+ }
53
+ else {
54
+ preg_match(self::MATCH, $token->source, $matches);
55
+ $this->message = $matches[self::MESSAGE];
56
+ $this->warning = $message;
57
+ }
58
+ $this->params = $params;
59
+ }
60
+
61
+ /**
62
+ * Parse this node.
63
+ * This raises an error.
64
+ * @return array An empty array
65
+ */
66
+ public function parse($context) {
67
+ if (!$this->warning || ($this->root->parser->quiet === false)) {
68
+ set_error_handler(array($this, 'errorHandler'));
69
+ trigger_error(($this->warning ? $this->interpolate(Phamlp::t('sass', $this->message, $this->params), $context) : $this->evaluate(Phamlp::t('sass', $this->message, $this->params), $context)->toString()));
70
+ restore_error_handler();
71
+ }
72
+
73
+ return array();
74
+ }
75
+
76
+ /**
77
+ * Error handler for degug and warning statements.
78
+ * @param int Error number
79
+ * @param string Message
80
+ */
81
+ public function errorHandler($errno, $message) {
82
+ echo '<div style="background-color:#ce4dd6;border-bottom:1px dashed #88338d;color:white;font:10pt verdana;margin:0;padding:0.5em 2%;width:96%;"><p style="height:auto;margin:0.25em 0;padding:0;width:100%;"><span style="font-weight:bold;">SASS '.($this->warning ? 'WARNING' : 'DEBUG').":</span> $message</p><p style=\"margin:0.1em;padding:0;padding-left:0.5em;width:100%;\">{$this->filename}::{$this->line}</p><p style=\"margin:0.1em;padding:0;padding-left:0.5em;width:100%;\">Source: {$this->source}</p></div>";
83
+ }
84
+ }
@@ -0,0 +1,76 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassDirectiveNode.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassDirectiveNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassDirectiveNode class.
14
+ * Represents a CSS directive.
15
+ * @package PHamlP
16
+ * @subpackage Sass.tree
17
+ */
18
+ class SassDirectiveNode extends SassNode {
19
+ const NODE_IDENTIFIER = '@';
20
+ const MATCH = '/^(@\w+)/';
21
+
22
+ /**
23
+ * SassDirectiveNode.
24
+ * @param object source token
25
+ * @return SassDirectiveNode
26
+ */
27
+ public function __construct($token) {
28
+ parent::__construct($token);
29
+ }
30
+
31
+ protected function getDirective() {
32
+ return self::extractDirective($this->token);
33
+ }
34
+
35
+ /**
36
+ * Parse this node.
37
+ * @param SassContext the context in which this node is parsed
38
+ * @return array the parsed node
39
+ */
40
+ public function parse($context) {
41
+ $this->children = $this->parseChildren($context);
42
+ return array($this);
43
+ }
44
+
45
+ /**
46
+ * Render this node.
47
+ * @return string the rendered node
48
+ */
49
+ public function render() {
50
+ $properties = array();
51
+ foreach ($this->children as $child) {
52
+ $properties[] = $child->render();
53
+ } // foreach
54
+
55
+ return $this->renderer->renderDirective($this, $properties);
56
+ }
57
+
58
+ /**
59
+ * Returns a value indicating if the token represents this type of node.
60
+ * @param object token
61
+ * @return boolean true if the token represents this type of node, false if not
62
+ */
63
+ public static function isa($token) {
64
+ return $token->source[0] === self::NODE_IDENTIFIER;
65
+ }
66
+
67
+ /**
68
+ * Returns the directive
69
+ * @param object token
70
+ * @return string the directive
71
+ */
72
+ public static function extractDirective($token) {
73
+ preg_match(self::MATCH, $token->source, $matches);
74
+ return strtolower($matches[1]);
75
+ }
76
+ }
@@ -0,0 +1,28 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassIfNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
3
+ /**
4
+ * SassElseNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassElseNode class.
14
+ * Represents Sass Else If and Else statements.
15
+ * Else If and Else statement nodes are chained below the If statement node.
16
+ * @package PHamlP
17
+ * @subpackage Sass.tree
18
+ */
19
+ class SassElseNode extends SassIfNode {
20
+ /**
21
+ * SassElseNode constructor.
22
+ * @param object source token
23
+ * @return SassElseNode
24
+ */
25
+ public function __construct($token) {
26
+ parent::__construct($token, false);
27
+ }
28
+ }
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassExtendNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
3
+ /**
4
+ * SassExtendNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassExtendNode class.
14
+ * Represents a Sass @debug or @warn directive.
15
+ * @package PHamlP
16
+ * @subpackage Sass.tree
17
+ */
18
+ class SassExtendNode extends SassNode {
19
+ const IDENTIFIER = '@';
20
+ const MATCH = '/^@extend\s+(.+)/i';
21
+ const VALUE = 1;
22
+
23
+ /**
24
+ * @var string the directive
25
+ */
26
+ private $value;
27
+
28
+ /**
29
+ * SassExtendNode.
30
+ * @param object source token
31
+ * @return SassExtendNode
32
+ */
33
+ public function __construct($token) {
34
+ parent::__construct($token);
35
+ preg_match(self::MATCH, $token->source, $matches);
36
+ $this->value = $matches[self::VALUE];
37
+ }
38
+
39
+ /**
40
+ * Parse this node.
41
+ * @return array An empty array
42
+ */
43
+ public function parse($context) {
44
+ $this->root->extend($this->value, $this->parent->selectors);
45
+ return array();
46
+ }
47
+ }
@@ -0,0 +1,99 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassForNode.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassForNode class file.
5
+ * This is an enhanced version of the standard SassScript @for loop that adds
6
+ * an optional step clause. Step must evaluate to a positive integer.
7
+ * The syntax is:
8
+ * <pre>@for <var> from <start> to|through <end>[ step <step>]</pre>.
9
+ *
10
+ * <start> can be less or greater than <end>.
11
+ * If the step clause is ommitted the <step> = 1.
12
+ * <var> is available to the rest of the script following evaluation
13
+ * and has the value that terminated the loop.
14
+ *
15
+ * @author Chris Yates <chris.l.yates@gmail.com>
16
+ * @copyright Copyright (c) 2010 PBM Web Development
17
+ * @license http://phamlp.googlecode.com/files/license.txt
18
+ * @package PHamlP
19
+ * @subpackage Sass.tree
20
+ */
21
+
22
+ /**
23
+ * SassForNode class.
24
+ * Represents a Sass @for loop.
25
+ * @package PHamlP
26
+ * @subpackage Sass.tree
27
+ */
28
+ class SassForNode extends SassNode {
29
+ const MATCH = '/@for\s+[!\$](\w+)\s+from\s+(.+?)\s+(through|to)\s+(.+?)(?:\s+step\s+(.+))?$/i';
30
+
31
+ const VARIABLE = 1;
32
+ const FROM = 2;
33
+ const INCLUSIVE = 3;
34
+ const TO = 4;
35
+ const STEP = 5;
36
+ const IS_INCLUSIVE = 'through';
37
+
38
+ /**
39
+ * @var string variable name for the loop
40
+ */
41
+ private $variable;
42
+ /**
43
+ * @var string expression that provides the loop start value
44
+ */
45
+ private $from;
46
+ /**
47
+ * @var string expression that provides the loop end value
48
+ */
49
+ private $to;
50
+ /**
51
+ * @var boolean whether the loop end value is inclusive
52
+ */
53
+ private $inclusive;
54
+ /**
55
+ * @var string expression that provides the amount by which the loop variable
56
+ * changes on each iteration
57
+ */
58
+ private $step;
59
+
60
+ /**
61
+ * SassForNode constructor.
62
+ * @param object source token
63
+ * @return SassForNode
64
+ */
65
+ public function __construct($token) {
66
+ parent::__construct($token);
67
+ if (!preg_match(self::MATCH, $token->source, $matches)) {
68
+ throw new SassForNodeException('Invalid {what}', array('{what}'=>'@for directive'), $this);
69
+ }
70
+ $this->variable = $matches[self::VARIABLE];
71
+ $this->from = $matches[self::FROM];
72
+ $this->to = $matches[self::TO];
73
+ $this->inclusive = ($matches[self::INCLUSIVE] === SassForNode::IS_INCLUSIVE);
74
+ $this->step = (empty($matches[self::STEP]) ? 1 : $matches[self::STEP]);
75
+ }
76
+
77
+ /**
78
+ * Parse this node.
79
+ * @param SassContext the context in which this node is parsed
80
+ * @return array parsed child nodes
81
+ */
82
+ public function parse($context) {
83
+ $children = array();
84
+ $from = (float)$this->evaluate($this->from, $context)->value;
85
+ $to = (float)$this->evaluate($this->to, $context)->value;
86
+ $step = (float)$this->evaluate($this->step, $context)->value * ($to > $from ? 1 : -1);
87
+
88
+ if ($this->inclusive) {
89
+ $to += ($from < $to ? 1 : -1);
90
+ }
91
+
92
+ $context = new SassContext($context);
93
+ for ($i = $from; ($from < $to ? $i < $to : $i > $to); $i = $i + $step) {
94
+ $context->setVariable($this->variable, new SassNumber($i));
95
+ $children = array_merge($children, $this->parseChildren($context));
96
+ }
97
+ return $children;
98
+ }
99
+ }
@@ -0,0 +1,95 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassIfNode.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassIfNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassIfNode class.
14
+ * Represents Sass If, Else If and Else statements.
15
+ * Else If and Else statement nodes are chained below the If statement node.
16
+ * @package PHamlP
17
+ * @subpackage Sass.tree
18
+ */
19
+ class SassIfNode extends SassNode {
20
+ const MATCH_IF = '/^@if\s+(.+)$/i';
21
+ const MATCH_ELSE = '/@else(\s+if\s+(.+))?/i';
22
+ const IF_EXPRESSION = 1;
23
+ const ELSE_IF = 1;
24
+ const ELSE_EXPRESSION = 2;
25
+ /**
26
+ * @var SassIfNode the next else node.
27
+ */
28
+ private $else;
29
+ /**
30
+ * @var string expression to evaluate
31
+ */
32
+ private $expression;
33
+
34
+ /**
35
+ * SassIfNode constructor.
36
+ * @param object source token
37
+ * @param boolean true for an "if" node, false for an "else if | else" node
38
+ * @return SassIfNode
39
+ */
40
+ public function __construct($token, $if=true) {
41
+ parent::__construct($token);
42
+ if ($if) {
43
+ preg_match(self::MATCH_IF, $token->source, $matches);
44
+ $this->expression = $matches[SassIfNode::IF_EXPRESSION];
45
+ }
46
+ else {
47
+ preg_match(self::MATCH_ELSE, $token->source, $matches);
48
+ $this->expression = (sizeof($matches)==1 ? null : $matches[SassIfNode::ELSE_EXPRESSION]);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Adds an "else" statement to this node.
54
+ * @param SassIfNode "else" statement node to add
55
+ * @return SassIfNode this node
56
+ */
57
+ public function addElse($node) {
58
+ if (is_null($this->else)) {
59
+ $node->parent = $this->parent;
60
+ $node->root = $this->root;
61
+ $this->else = $node;
62
+ }
63
+ else {
64
+ $this->else->addElse($node);
65
+ }
66
+ return $this;
67
+ }
68
+
69
+ /**
70
+ * Parse this node.
71
+ * @param SassContext the context in which this node is parsed
72
+ * @return array parsed child nodes
73
+ */
74
+ public function parse($context) {
75
+ if ($this->isElse() || $this->evaluate($this->expression, $context)->toBoolean()) {
76
+ $children = $this->parseChildren($context);
77
+ }
78
+ elseif (!empty($this->else)) {
79
+ $children = $this->else->parse($context);
80
+ }
81
+ else {
82
+ $children = array();
83
+ }
84
+ return $children;
85
+ }
86
+
87
+ /**
88
+ * Returns a value indicating if this node is an "else" node.
89
+ * @return true if this node is an "else" node, false if this node is an "if"
90
+ * or "else if" node
91
+ */
92
+ private function isElse() {
93
+ return empty($this->expression);
94
+ }
95
+ }
@@ -0,0 +1,69 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassImportNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
3
+ /**
4
+ * SassImportNode class file.
5
+ * @author Chris Yates <chris.l.yates@gmail.com>
6
+ * @copyright Copyright (c) 2010 PBM Web Development
7
+ * @license http://phamlp.googlecode.com/files/license.txt
8
+ * @package PHamlP
9
+ * @subpackage Sass.tree
10
+ */
11
+
12
+ /**
13
+ * SassImportNode class.
14
+ * Represents a CSS Import.
15
+ * @package PHamlP
16
+ * @subpackage Sass.tree
17
+ */
18
+ class SassImportNode extends SassNode {
19
+ const IDENTIFIER = '@';
20
+ const MATCH = '/^@import\s+(.+)/i';
21
+ const MATCH_CSS = '/^(.+\.css|url\(.+\)|.+" \w+|"http)/im';
22
+ const FILES = 1;
23
+
24
+ /**
25
+ * @var array files to import
26
+ */
27
+ private $files = array();
28
+
29
+ /**
30
+ * SassImportNode.
31
+ * @param object source token
32
+ * @return SassImportNode
33
+ */
34
+ public function __construct($token) {
35
+ parent::__construct($token);
36
+ preg_match(self::MATCH, $token->source, $matches);
37
+ foreach (explode(',', $matches[self::FILES]) as $file) {
38
+ $this->files[] = trim($file);
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Parse this node.
44
+ * If the node is a CSS import return the CSS import rule.
45
+ * Else returns the rendered tree for the file.
46
+ * @param SassContext the context in which this node is parsed
47
+ * @return array the parsed node
48
+ */
49
+ public function parse($context) {
50
+ $imported = array();
51
+ foreach ($this->files as $file) {
52
+ if (preg_match(self::MATCH_CSS, $file)) {
53
+ return "@import {$file}";
54
+ }
55
+ else {
56
+ $file = trim($file, '\'"');
57
+ $tree = SassFile::getTree(
58
+ SassFile::getFile($file, $this->parser), $this->parser);
59
+ if (empty($tree)) {
60
+ throw new SassImportNodeException('Unable to create document tree for {file}', array('{file}'=>$file), $this);
61
+ }
62
+ else {
63
+ $imported = array_merge($imported, $tree->parse($context)->children);
64
+ }
65
+ }
66
+ }
67
+ return $imported;
68
+ }
69
+ }