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,503 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassNumber.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassNumber 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.script.literals
10
+ */
11
+
12
+ require_once('SassLiteral.php');
13
+
14
+ /**
15
+ * SassNumber class.
16
+ * Provides operations and type testing for Sass numbers.
17
+ * Units are of the passed value are converted the those of the class value
18
+ * if it has units. e.g. 2cm + 20mm = 4cm while 2 + 20mm = 22mm.
19
+ * @package PHamlP
20
+ * @subpackage Sass.script.literals
21
+ */
22
+ class SassNumber extends SassLiteral {
23
+ /**
24
+ * Regx for matching and extracting numbers
25
+ */
26
+ const MATCH = '/^((?:-)?(?:\d*\.)?\d+)(([a-z%]+)(\s*[\*\/]\s*[a-z%]+)*)?/i';
27
+ const VALUE = 1;
28
+ const UNITS = 2;
29
+ /**
30
+ * The number of decimal digits to round to.
31
+ * If the units are pixels the result is always
32
+ * rounded down to the nearest integer.
33
+ */
34
+ const PRECISION = 4;
35
+
36
+ /**
37
+ * @var array Conversion factors for units using inches as the base unit
38
+ * (only because pt and pc are expressed as fraction of an inch, so makes the
39
+ * numbers easy to understand).
40
+ * Conversions are based on the following
41
+ * in: inches — 1 inch = 2.54 centimeters
42
+ * cm: centimeters
43
+ * mm: millimeters
44
+ * pc: picas — 1 pica = 12 points
45
+ * pt: points — 1 point = 1/72nd of an inch
46
+ */
47
+ static private $unitConversion = array(
48
+ 'in' => 1,
49
+ 'cm' => 2.54,
50
+ 'mm' => 25.4,
51
+ 'pc' => 6,
52
+ 'pt' => 72
53
+ );
54
+
55
+ /**
56
+ * @var array numerator units of this number
57
+ */
58
+ private $numeratorUnits = array();
59
+
60
+ /**
61
+ * @var array denominator units of this number
62
+ */
63
+ private $denominatorUnits = array();
64
+
65
+ /**
66
+ * @var boolean whether this number is in an expression or a literal number
67
+ * Used to determine whether division should take place
68
+ */
69
+ public $inExpression = true;
70
+
71
+ /**
72
+ * class constructor.
73
+ * Sets the value and units of the number.
74
+ * @param string number
75
+ * @return SassNumber
76
+ */
77
+ public function __construct($value) {
78
+ preg_match(self::MATCH, $value, $matches);
79
+ $this->value = $matches[self::VALUE];
80
+ if (!empty($matches[self::UNITS])) {
81
+ $units = explode('/', $matches[self::UNITS]);
82
+ $numeratorUnits = $denominatorUnits = array();
83
+
84
+ foreach (explode('*', $units[0]) as $unit) {
85
+ $numeratorUnits[] = trim($unit);
86
+ }
87
+ if (isset($units[1])) {
88
+ foreach (explode('*', $units[1]) as $unit) {
89
+ $denominatorUnits[] = trim($unit);
90
+ }
91
+ }
92
+ $units = $this->removeCommonUnits($numeratorUnits, $denominatorUnits);
93
+ $this->numeratorUnits = $units[0];
94
+ $this->denominatorUnits = $units[1];
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Adds the value of other to the value of this
100
+ * @param mixed SassNumber|SassColour: value to add
101
+ * @return mixed SassNumber if other is a SassNumber or
102
+ * SassColour if it is a SassColour
103
+ */
104
+ public function op_plus($other) {
105
+ if ($other instanceof SassColour) {
106
+ return $other->op_plus($this);
107
+ }
108
+ elseif (!$other instanceof SassNumber) {
109
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
110
+ }
111
+ else {
112
+ $other = $this->convert($other);
113
+ return new SassNumber(($this->value + $other->value).$this->units);
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Unary + operator
119
+ * @return SassNumber the value of this number
120
+ */
121
+ public function op_unary_plus() {
122
+ return $this;
123
+ }
124
+
125
+ /**
126
+ * Subtracts the value of other from this value
127
+ * @param mixed SassNumber|SassColour: value to subtract
128
+ * @return mixed SassNumber if other is a SassNumber or
129
+ * SassColour if it is a SassColour
130
+ */
131
+ public function op_minus($other) {
132
+ if ($other instanceof SassColour) {
133
+ return $other->op_minus($this);
134
+ }
135
+ elseif (!$other instanceof SassNumber) {
136
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
137
+ }
138
+ else {
139
+ $other = $this->convert($other);
140
+ return new SassNumber(($this->value - $other->value).$this->units);
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Unary - operator
146
+ * @return SassNumber the negative value of this number
147
+ */
148
+ public function op_unary_minus() {
149
+ return new SassNumber(($this->value * -1).$this->units);
150
+ }
151
+
152
+ /**
153
+ * Multiplies this value by the value of other
154
+ * @param mixed SassNumber|SassColour: value to multiply by
155
+ * @return mixed SassNumber if other is a SassNumber or
156
+ * SassColour if it is a SassColour
157
+ */
158
+ public function op_times($other) {
159
+ if ($other instanceof SassColour) {
160
+ return $other->op_times($this);
161
+ }
162
+ elseif (!$other instanceof SassNumber) {
163
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
164
+ }
165
+ else {
166
+ return new SassNumber(($this->value * $other->value).$this->unitString(
167
+ array_merge($this->numeratorUnits, $other->numeratorUnits),
168
+ array_merge($this->denominatorUnits, $other->denominatorUnits)
169
+ ));
170
+ }
171
+ }
172
+
173
+ /**
174
+ * Divides this value by the value of other
175
+ * @param mixed SassNumber|SassColour: value to divide by
176
+ * @return mixed SassNumber if other is a SassNumber or
177
+ * SassColour if it is a SassColour
178
+ */
179
+ public function op_div($other) {
180
+ if ($other instanceof SassColour) {
181
+ return $other->op_div($this);
182
+ }
183
+ elseif (!$other instanceof SassNumber) {
184
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
185
+ }
186
+ elseif ($this->inExpression || $other->inExpression) {
187
+ return new SassNumber(($this->value / $other->value).$this->unitString(
188
+ array_merge($this->numeratorUnits, $other->denominatorUnits),
189
+ array_merge($this->denominatorUnits, $other->numeratorUnits)
190
+ ));
191
+ }
192
+ else {
193
+ return parent::op_div($other);
194
+ }
195
+ }
196
+
197
+ /**
198
+ * The SassScript == operation.
199
+ * @return SassBoolean SassBoolean object with the value true if the values
200
+ * of this and other are equal, false if they are not
201
+ */
202
+ public function op_eq($other) {
203
+ if (!$other instanceof SassNumber) {
204
+ return new SassBoolean(false);
205
+ }
206
+ try {
207
+ return new SassBoolean($this->value == $this->convert($other)->value);
208
+ }
209
+ catch (Exception $e) {
210
+ return new SassBoolean(false);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * The SassScript > operation.
216
+ * @param sassLiteral the value to compare to this
217
+ * @return SassBoolean SassBoolean object with the value true if the values
218
+ * of this is greater than the value of other, false if it is not
219
+ */
220
+ public function op_gt($other) {
221
+ if (!$other instanceof SassNumber) {
222
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
223
+ }
224
+ return new SassBoolean($this->value > $this->convert($other)->value);
225
+ }
226
+
227
+ /**
228
+ * The SassScript >= operation.
229
+ * @param sassLiteral the value to compare to this
230
+ * @return SassBoolean SassBoolean object with the value true if the values
231
+ * of this is greater than or equal to the value of other, false if it is not
232
+ */
233
+ public function op_gte($other) {
234
+ if (!$other instanceof SassNumber) {
235
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
236
+ }
237
+ return new SassBoolean($this->value >= $this->convert($other)->value);
238
+ }
239
+
240
+ /**
241
+ * The SassScript < operation.
242
+ * @param sassLiteral the value to compare to this
243
+ * @return SassBoolean SassBoolean object with the value true if the values
244
+ * of this is less than the value of other, false if it is not
245
+ */
246
+ public function op_lt($other) {
247
+ if (!$other instanceof SassNumber) {
248
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
249
+ }
250
+ return new SassBoolean($this->value < $this->convert($other)->value);
251
+ }
252
+
253
+ /**
254
+ * The SassScript <= operation.
255
+ * @param sassLiteral the value to compare to this
256
+ * @return SassBoolean SassBoolean object with the value true if the values
257
+ * of this is less than or equal to the value of other, false if it is not
258
+ */
259
+ public function op_lte($other) {
260
+ if (!$other instanceof SassNumber) {
261
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'number')), SassScriptParser::$context->node);
262
+ }
263
+ return new SassBoolean($this->value <= $this->convert($other)->value);
264
+ }
265
+
266
+ /**
267
+ * Takes the modulus (remainder) of this value divided by the value of other
268
+ * @param string value to divide by
269
+ * @return mixed SassNumber if other is a SassNumber or
270
+ * SassColour if it is a SassColour
271
+ */
272
+ public function op_modulo($other) {
273
+ if (!$other instanceof SassNumber || !$other->isUnitless()) {
274
+ throw new SassNumberException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Number'), '{type}'=>Phamlp::t('sass', 'unitless number')), SassScriptParser::$context->node);
275
+ }
276
+ $this->value %= $this->convert($other)->value;
277
+ return $this;
278
+ }
279
+
280
+ /**
281
+ * Converts values and units.
282
+ * If this is a unitless numeber it will take the units of other; if not
283
+ * other is coerced to the units of this.
284
+ * @param SassNumber the other number
285
+ * @return SassNumber the other number with its value and units coerced if neccessary
286
+ * @throws SassNumberException if the units are incompatible
287
+ */
288
+ private function convert($other) {
289
+ if ($this->isUnitless()) {
290
+ $this->numeratorUnits = $other->numeratorUnits;
291
+ $this->denominatorUnits = $other->denominatorUnits;
292
+ }
293
+ else {
294
+ $other = $other->coerce($this->numeratorUnits, $this->denominatorUnits);
295
+ }
296
+ return $other;
297
+ }
298
+
299
+ /**
300
+ * Returns the value of this number converted to other units.
301
+ * The conversion takes into account the relationship between e.g. mm and cm,
302
+ * as well as between e.g. in and cm.
303
+ *
304
+ * If this number is unitless, it will simply return itself with the given units.
305
+ * @param array $numeratorUnits
306
+ * @param array $denominatorUnits
307
+ * @return SassNumber
308
+ */
309
+ public function coerce($numeratorUnits, $denominatorUnits) {
310
+ return new SassNumber(($this->isUnitless() ?
311
+ $this->value :
312
+ $this->value *
313
+ $this->coercionFactor($this->numeratorUnits, $numeratorUnits) /
314
+ $this->coercionFactor($this->denominatorUnits, $denominatorUnits)
315
+ ).join(' * ', $numeratorUnits) .
316
+ (!empty($denominatorUnits) ? ' / ' . join(' * ', $denominatorUnits) : ''));
317
+ }
318
+
319
+ /**
320
+ * Calculates the corecion factor to apply to the value
321
+ * @param array units being converted from
322
+ * @param array units being converted to
323
+ * @return float the coercion factor to apply
324
+ */
325
+ private function coercionFactor($fromUnits, $toUnits) {
326
+ $units = $this->removeCommonUnits($fromUnits, $toUnits);
327
+ $fromUnits = $units[0];
328
+ $toUnits = $units[1];
329
+
330
+ if (sizeof($fromUnits) !== sizeof($toUnits) || !$this->areConvertable(array_merge($fromUnits, $toUnits))) {
331
+ throw new SassNumberException("Incompatible units: '{from}' and '{to}'", array('{from}'=>join(' * ', $fromUnits), '{to}'=>join(' * ', $toUnits)), SassScriptParser::$context->node);
332
+ }
333
+
334
+ $coercionFactor = 1;
335
+ foreach ($fromUnits as $i=>$from) {
336
+ if (array_key_exists($from) && array_key_exists($from)) {
337
+ $coercionFactor *=
338
+ self::$unitConversion[$toUnits[$i]] / self::$unitConversion[$from];
339
+ }
340
+ else {
341
+ throw new SassNumberException("Incompatible units: '{from}' and '{to}",
342
+ array('{from}'=>join(' * ', $fromUnits), '{to}'=>join(' * ', $toUnits)),
343
+ SassScriptParser::$context->node);
344
+ }
345
+ }
346
+ return $coercionFactor;
347
+ }
348
+
349
+ /**
350
+ * Returns a value indicating if all the units are capable of being converted
351
+ * @param array units to test
352
+ * @return boolean true if all units can be converted, false if not
353
+ */
354
+ private function areConvertable($units) {
355
+ $convertable = array_keys(self::$unitConversion);
356
+ foreach ($units as $unit) {
357
+ if (!in_array($unit, $convertable))
358
+ return false;
359
+ }
360
+ return true;
361
+ }
362
+
363
+ /**
364
+ * Removes common units from each set.
365
+ * We don't use array_diff because we want (for eaxmple) mm*mm/mm*cm to
366
+ * end up as mm/cm.
367
+ * @param array first set of units
368
+ * @param array second set of units
369
+ * @return array both sets of units with common units removed
370
+ */
371
+ private function removeCommonUnits($u1, $u2) {
372
+ $_u1 = array();
373
+ while (!empty($u1)) {
374
+ $u = array_shift($u1);
375
+ $i = array_search($u, $u2);
376
+ if ($i !== false) {
377
+ unset($u2[$i]);
378
+ }
379
+ else {
380
+ $_u1[] = $u;
381
+ }
382
+ }
383
+ return (array($_u1, $u2));
384
+ }
385
+
386
+ /**
387
+ * Returns a value indicating if this number is unitless.
388
+ * @return boolean true if this number is unitless, false if not
389
+ */
390
+ public function isUnitless() {
391
+ return empty($this->numeratorUnits) && empty($this->denominatorUnits);
392
+ }
393
+
394
+ /**
395
+ * Returns a value indicating if this number has units that can be represented
396
+ * in CSS.
397
+ * @return boolean true if this number has units that can be represented in
398
+ * CSS, false if not
399
+ */
400
+ public function hasLegalUnits() {
401
+ return (empty($this->numeratorUnits) || count($this->numeratorUnits) === 1) &&
402
+ empty($this->denominatorUnits);
403
+ }
404
+
405
+ /**
406
+ * Returns a string representation of the units.
407
+ * @return string the units
408
+ */
409
+ public function unitString($numeratorUnits, $denominatorUnits) {
410
+ return join(' * ', $numeratorUnits) .
411
+ (!empty($denominatorUnits) ? ' / ' . join(' * ', $denominatorUnits) : '');
412
+ }
413
+
414
+ /**
415
+ * Returns the units of this number.
416
+ * @return string the units of this number
417
+ */
418
+ public function getUnits() {
419
+ return $this->unitString($this->numeratorUnits, $this->denominatorUnits);
420
+ }
421
+
422
+ /**
423
+ * Returns the denominator units of this number.
424
+ * @return string the denominator units of this number
425
+ */
426
+ public function getDenominatorUnits() {
427
+ return join(' * ', $this->denominatorUnits);
428
+ }
429
+
430
+ /**
431
+ * Returns the numerator units of this number.
432
+ * @return string the numerator units of this number
433
+ */
434
+ public function getNumeratorUnits() {
435
+ return join(' * ', $this->numeratorUnits);
436
+ }
437
+
438
+ /**
439
+ * Returns a value indicating if this number can be compared to other.
440
+ * @return boolean true if this number can be compared to other, false if not
441
+ */
442
+ public function isComparableTo($other) {
443
+ try {
444
+ $this->op_plus($other);
445
+ return true;
446
+ }
447
+ catch (Exception $e) {
448
+ return false;
449
+ }
450
+ }
451
+
452
+ /**
453
+ * Returns a value indicating if this number is an integer.
454
+ * @return boolean true if this number is an integer, false if not
455
+ */
456
+ public function isInt() {
457
+ return $this->value % 1 === 0;
458
+ }
459
+
460
+ /**
461
+ * Returns the value of this number.
462
+ * @return float the value of this number.
463
+ */
464
+ public function getValue() {
465
+ return $this->value;
466
+ }
467
+
468
+ /**
469
+ * Returns the integer value.
470
+ * @return integer the integer value.
471
+ * @throws SassNumberException if the number is not an integer
472
+ */
473
+ public function toInt() {
474
+ if (!$this->isInt()) {
475
+ throw new SassNumberException('Not an integer: {value}', array('{value}'=>$this->value), SassScriptParser::$context->node);
476
+ }
477
+ return intval($this->value);
478
+ }
479
+
480
+ /**
481
+ * Converts the number to a string with it's units if any.
482
+ * If the units are px the result is rounded down to the nearest integer,
483
+ * otherwise the result is rounded to the specified precision.
484
+ * @return string number as a string with it's units if any
485
+ */
486
+ public function toString() {
487
+ if (!$this->hasLegalUnits()) {
488
+ throw new SassNumberException('Invalid {what}', array('{what}'=>"CSS units ({$this->units})"), SassScriptParser::$context->node);
489
+ }
490
+ return ($this->units == 'px' ? floor($this->value) :
491
+ round($this->value, self::PRECISION)).$this->units;
492
+ }
493
+
494
+ /**
495
+ * Returns a value indicating if a token of this type can be matched at
496
+ * the start of the subject string.
497
+ * @param string the subject string
498
+ * @return mixed match at the start of the string or false if no match
499
+ */
500
+ public static function isa($subject) {
501
+ return (preg_match(self::MATCH, $subject, $matches) ? $matches[0] : false);
502
+ }
503
+ }
@@ -0,0 +1,106 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassString.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
3
+ /**
4
+ * SassString 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.script.literals
10
+ */
11
+
12
+ require_once('SassLiteral.php');
13
+
14
+ /**
15
+ * SassString class.
16
+ * Provides operations and type testing for Sass strings.
17
+ * @package PHamlP
18
+ * @subpackage Sass.script.literals
19
+ */
20
+ class SassString extends SassLiteral {
21
+ const MATCH = '/^(((["\'])(.*)(\3))|(-[a-zA-Z][^\s]*))/i';
22
+ const _MATCH = '/^(["\'])(.*?)(\1)?$/'; // Used to match strings such as "Times New Roman",serif
23
+ const VALUE = 2;
24
+ const QUOTE = 3;
25
+
26
+ /**
27
+ * @var string string quote type; double or single quotes, or unquoted.
28
+ */
29
+ private $quote;
30
+
31
+ /**
32
+ * class constructor
33
+ * @param string string
34
+ * @return SassString
35
+ */
36
+ public function __construct($value) {
37
+ preg_match(self::_MATCH, $value, $matches);
38
+ if ((isset($matches[self::QUOTE]))) {
39
+ $this->quote = $matches[self::QUOTE];
40
+ $this->value = $matches[self::VALUE];
41
+ }
42
+ else {
43
+ $this->quote = '';
44
+ $this->value = $value;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * String addition.
50
+ * Concatenates this and other.
51
+ * The resulting string will be quoted in the same way as this.
52
+ * @param sassString string to add to this
53
+ * @return sassString the string result
54
+ */
55
+ public function op_plus($other) {
56
+ if (!($other instanceof SassString)) {
57
+ throw new SassStringException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Value'), '{type}'=>Phamlp::t('sass', 'string')), SassScriptParser::$context->node);
58
+ }
59
+ $this->value .= $other->value;
60
+ return $this;
61
+ }
62
+
63
+ /**
64
+ * String multiplication.
65
+ * this is repeated other times
66
+ * @param sassNumber the number of times to repeat this
67
+ * @return sassString the string result
68
+ */
69
+ public function op_times($other) {
70
+ if (!($other instanceof SassNumber) || !$other->isUnitless()) {
71
+ throw new SassStringException('{what} must be a {type}', array('{what}'=>Phamlp::t('sass', 'Value'), '{type}'=>Phamlp::t('sass', 'unitless number')), SassScriptParser::$context->node);
72
+ }
73
+ $this->value = str_repeat($this->value, $other->value);
74
+ return $this;
75
+ }
76
+
77
+ /**
78
+ * Returns the value of this string.
79
+ * @return string the string
80
+ */
81
+ public function getValue() {
82
+ return $this->value;
83
+ }
84
+
85
+ /**
86
+ * Returns a string representation of the value.
87
+ * @return string string representation of the value.
88
+ */
89
+ public function toString() {
90
+ return $this->quote.$this->value.$this->quote;
91
+ }
92
+
93
+ public function toVar() {
94
+ return SassScriptParser::$context->getVariable($this->value);
95
+ }
96
+
97
+ /**
98
+ * Returns a value indicating if a token of this type can be matched at
99
+ * the start of the subject string.
100
+ * @param string the subject string
101
+ * @return mixed match at the start of the string or false if no match
102
+ */
103
+ public static function isa($subject) {
104
+ return (preg_match(self::MATCH, $subject, $matches) ? $matches[0] : false);
105
+ }
106
+ }
@@ -0,0 +1,64 @@
1
+ <?php
2
+ /* SVN FILE: $Id: SassCommentNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
3
+ /**
4
+ * SassCommentNode 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
+ * SassCommentNode class.
14
+ * Represents a CSS comment.
15
+ * @package PHamlP
16
+ * @subpackage Sass.tree
17
+ */
18
+ class SassCommentNode extends SassNode {
19
+ const NODE_IDENTIFIER = '/';
20
+ const MATCH = '%^/\*\s*(.*?)\s*(\*/)?$%s';
21
+ const COMMENT = 1;
22
+
23
+ private $value;
24
+
25
+ /**
26
+ * SassCommentNode constructor.
27
+ * @param object source token
28
+ * @return CommentNode
29
+ */
30
+ public function __construct($token) {
31
+ parent::__construct($token);
32
+ preg_match(self::MATCH, $token->source, $matches);
33
+ $this->value = $matches[self::COMMENT];
34
+ }
35
+
36
+ protected function getValue() {
37
+ return $this->value;
38
+ }
39
+
40
+ /**
41
+ * Parse this node.
42
+ * @return array the parsed node - an empty array
43
+ */
44
+ public function parse($context) {
45
+ return array($this);
46
+ }
47
+
48
+ /**
49
+ * Render this node.
50
+ * @return string the rendered node
51
+ */
52
+ public function render() {
53
+ return $this->renderer->renderComment($this);
54
+ }
55
+
56
+ /**
57
+ * Returns a value indicating if the token represents this type of node.
58
+ * @param object token
59
+ * @return boolean true if the token represents this type of node, false if not
60
+ */
61
+ public static function isa($token) {
62
+ return $token->source[0] === self::NODE_IDENTIFIER;
63
+ }
64
+ }