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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16be555ed6591347ba2ba8230a09c03ae2333496
4
+ data.tar.gz: 4edc1772dc8ec82d1436174497bc972a8fa83df4
5
+ SHA512:
6
+ metadata.gz: 9b1d630cc9d4a598b1591aaf843b4bcc71058c14d9add2e4671d8ae5526ec802f380766077c4dcc10adc5ff4ab9fc2decc72d3ff84cd46d80132a5325b8d08f6
7
+ data.tar.gz: b2d9c9e9d51eb22c11363199037f0bd9e7c2f0b57eb4a19ec0e1e2c41fb5d70228ef6f77286ca1714a8f5f4031e835def5da1f8c20676a5174259636e01b24d2
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ /.idea
16
+ frontsau*.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in frontsau.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Frontsau
2
+
3
+ A small web development tool to assist with coffeescript, sass, less, haml, image assets.
4
+
5
+ ## Installation
6
+
7
+ # NOT IMPLEMENTED YET
8
+ $ gem install frontsau
9
+
10
+ And then go to your webapps project root:
11
+
12
+ $ frontsau init
13
+
14
+ ## Usage
15
+
16
+ Frontsau supports the follogin commands:
17
+
18
+ $ frontsau debug
19
+ $ frontsau server
20
+ $ frontsau compile
21
+ $ frontsau watch
22
+
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/[my-github-username]/frontsau/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/frontsau ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'pry'
5
+ require 'yaml'
6
+ require 'active_support'
7
+ require 'active_support/all'
8
+ require 'frontsau'
9
+ require 'frontsau/thor_app'
10
+
11
+
12
+ Frontsau.init File.expand_path('.')
13
+
14
+ Frontsau::ThorApp.start
15
+
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env php
2
+ <?php
3
+
4
+ if(!isset($argv[1])){
5
+ echo "No input file specified!\n";
6
+ exit(1);
7
+ }
8
+
9
+
10
+ $input_file = $argv[1];
11
+ $output_file = preg_replace("/\\.haml/",'.php', $input_file);
12
+
13
+ if(!is_file($input_file)){
14
+ echo "Input file '$input_file' does not exist.";
15
+ exit(1);
16
+ }
17
+
18
+ define('PIMTOOL_ROOT', dirname(dirname(__FILE__)));
19
+
20
+ require PIMTOOL_ROOT.'/lib/Phamlp/Phamlp.php';
21
+ require PIMTOOL_ROOT.'/lib/Phamlp/haml/HamlParser.php';
22
+
23
+ $haml = new HamlParser(array(
24
+ 'style' =>'expanded',
25
+ 'ugly' =>false
26
+ ));
27
+
28
+ $xhtml = $haml->parse($input_file);
29
+
30
+ echo $xhtml;
31
+
32
+
33
+
34
+
35
+
data/example/.frontsau ADDED
@@ -0,0 +1,12 @@
1
+ frontsau:
2
+ assets:
3
+ path: assets
4
+ sources:
5
+ - css
6
+ - js
7
+ - image
8
+ compile:
9
+ - style.css
10
+ - script.js
11
+ - '*.jpg'
12
+ - '*.png'
Binary file
@@ -0,0 +1,4 @@
1
+ (function() {
2
+ alert("Hehe");
3
+
4
+ }).call(this);
@@ -0,0 +1,6 @@
1
+ a {
2
+ color: red; }
3
+
4
+ body {
5
+ background-color: grey;
6
+ background-image: url(/assets/head.jpg); }
@@ -0,0 +1,2 @@
1
+ a
2
+ color: red
@@ -0,0 +1,6 @@
1
+ @import includes
2
+
3
+ body
4
+ background-color: grey
5
+ background-image: url(../image/head.jpg)
6
+
Binary file
File without changes
@@ -0,0 +1 @@
1
+ alert "Hehe"
data/frontsau.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'frontsau/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "frontsau"
8
+ spec.version = Frontsau::VERSION
9
+ spec.authors = ["Benjamin Seibert"]
10
+ spec.email = ["benjamin.seibert@roomthirteen.de"]
11
+ spec.summary = %q{Frontsau, the new kid in frontend dev.}
12
+ spec.description = "Frontsau brings coffeescript, sass, less to any webapplication without big need of modifying it. No matter if your using wordpress, joomla, zend (only for the php ones)... and many more."
13
+ spec.homepage = "http://roomthirteen.de"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "filewatcher", "~> 0.3"
22
+ spec.add_dependency "rb-fsevent", "~> 0.9"
23
+ spec.add_dependency "coffee-script", "~> 2.3"
24
+ spec.add_dependency "sass", "~> 3.4"
25
+ spec.add_dependency "less", "~> 2.6"
26
+ spec.add_dependency "libv8", "~> 3.16"
27
+ spec.add_dependency "therubyracer", "~> 0.12"
28
+ spec.add_dependency "sprockets", "~> 2.12"
29
+ spec.add_dependency "sinatra", "~> 1.4"
30
+ spec.add_dependency "sinatra-contrib", "~> 1.4"
31
+ spec.add_dependency "thor", "~> 0.19.1"
32
+ spec.add_dependency "activesupport", "~> 4.2"
33
+ spec.add_dependency "rack", "~> 1.6"
34
+ spec.add_dependency "rack-cors", "~> 0.3"
35
+ spec.add_dependency "ruby-progressbar", "~> 1.7"
36
+
37
+ spec.add_development_dependency "bundler", "~> 1.7"
38
+ spec.add_development_dependency "rake", "~> 10.0"
39
+ spec.add_development_dependency "pry", "~> 0.10.1"
40
+
41
+ end
@@ -0,0 +1,72 @@
1
+ <?php
2
+ /* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
3
+ /**
4
+ * Phamlp.
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
+ */
10
+ /**
11
+ * Phamlp class.
12
+ * Static support classes.
13
+ * @package PHamlP
14
+ */
15
+ class Phamlp {
16
+ /**
17
+ * @var string Language used to translate messages
18
+ */
19
+ public static $language;
20
+ /**
21
+ * @var array Messages used for translation
22
+ */
23
+ public static $messages;
24
+
25
+ /**
26
+ * Translates a message to the specified language.
27
+ * @param string message category.
28
+ * @param string the original message
29
+ * @param array parameters to be applied to the message using <code>strtr</code>.
30
+ * @return string the translated message
31
+ */
32
+ public static function t($category, $message, $params = array()) {
33
+ if (!empty(self::$language)) {
34
+ $message = self::translate($category, $message);
35
+ }
36
+ return $params!==array() ? strtr($message,$params) : $message;
37
+ }
38
+
39
+ /**
40
+ * Translates a message to the specified language.
41
+ * If the language or the message in the specified language is not defined the
42
+ * original message is returned.
43
+ * @param string message category
44
+ * @param string the original message
45
+ * @return string the translated message
46
+ */
47
+ private static function translate($category, $message) {
48
+ if (empty(self::$messages[$category])) self::loadMessages($category);
49
+ return (empty(self::$messages[$category][$message]) ? $message : self::$messages[$category][$message]);
50
+ }
51
+
52
+ /**
53
+ * Loads the specified language message file for translation.
54
+ * Message files are PHP files in the "category/messages" directory and named
55
+ * "language.php", where category is either haml or sass, and language is the
56
+ * specified language.
57
+ * The message file returns an array of (source, translation) pairs; for example:
58
+ * <pre>
59
+ * return array(
60
+ * 'original message 1' => 'translated message 1',
61
+ * 'original message 2' => 'translated message 2',
62
+ * );
63
+ * </pre>
64
+ * @param string message category
65
+ */
66
+ private static function loadMessages($category) {
67
+ $messageFile = dirname(__FILE__).DIRECTORY_SEPARATOR.$category.DIRECTORY_SEPARATOR.'messages'.DIRECTORY_SEPARATOR.self::$language.'.php';
68
+ if (file_exists($messageFile)) {
69
+ self::$messages[$category] = require_once($messageFile);
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,31 @@
1
+ <?php
2
+ /* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
3
+ /**
4
+ * Phamlp exception.
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
+ */
10
+
11
+ require_once('Phamlp.php');
12
+
13
+ /**
14
+ * Phamlp exception class.
15
+ * Base class for PHamlP::Haml and PHamlP::Sass exceptions.
16
+ * Translates exception messages.
17
+ * @package PHamlP
18
+ */
19
+ class PhamlpException extends Exception {
20
+ /**
21
+ * Phamlp Exception.
22
+ * @param string Category (haml|sass)
23
+ * @param string Exception message
24
+ * @param array parameters to be applied to the message using <code>strtr</code>.
25
+ */
26
+ public function __construct($category, $message, $params, $object) {
27
+ parent::__construct(Phamlp::t($category, $message, $params) .
28
+ (is_object($object) ? ": {$object->filename}::{$object->line}\nSource: {$object->source}" : '')
29
+ );
30
+ }
31
+ }
@@ -0,0 +1,29 @@
1
+ <?php
2
+ /* SVN FILE: $Id: HamlException.php 61 2010-04-16 10:19:59Z chris.l.yates $ */
3
+ /**
4
+ * Haml exception.
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 Haml
10
+ */
11
+
12
+ require_once(dirname(__FILE__).'/../PhamlpException.php');
13
+
14
+ /**
15
+ * Haml exception class.
16
+ * @package PHamlP
17
+ * @subpackage Haml
18
+ */
19
+ class HamlException extends PhamlpException {
20
+ /**
21
+ * Haml Exception.
22
+ * @param string Exception message
23
+ * @param array parameters to be applied to the message using <code>strtr</code>.
24
+ * @param object object with source code and meta data
25
+ */
26
+ public function __construct($message, $params = array(), $object = null) {
27
+ parent::__construct('haml', $message, $params, $object);
28
+ }
29
+ }
@@ -0,0 +1,199 @@
1
+ <?php
2
+ /* SVN FILE: $Id: HamlHelpers.php 92 2010-05-20 17:42:59Z chris.l.yates $ */
3
+ /**
4
+ * HamlHelpers class file.
5
+ *
6
+ * @author Chris Yates <chris.l.yates@gmail.com>
7
+ * @copyright Copyright (c) 2010 PBM Web Development
8
+ * @license http://phamlp.googlecode.com/files/license.txt
9
+ * @package PHamlP
10
+ * @subpackage Haml
11
+ */
12
+
13
+ /**
14
+ * HamlHelpers class.
15
+ * Contains methods to make it easier to do various tasks.
16
+ *
17
+ * The class can be extended to provide user defined helper methods. The
18
+ * signature for user defined helper methods is ($block, $other, $arguments);
19
+ * $block is the string generated by the Haml block being operated on.
20
+ *
21
+ * Tthe path to the extended class is provided to HamlParser in the config
22
+ * array; class name == file name.
23
+ *
24
+ * HamlHelpers and any extended class are automatically included in the context
25
+ * that a Haml template is parsed in, so all the methods are at your disposal
26
+ * from within the template.
27
+ *
28
+ * @package PHamlP
29
+ * @subpackage Haml
30
+ */
31
+ class HamlHelpers {
32
+ const XMLNS = 'http://www.w3.org/1999/xhtml';
33
+
34
+ /**
35
+ * Returns the block with string appended.
36
+ * @see succeed
37
+ * @param string Haml block
38
+ * @param string string to append
39
+ * @return string the block with string appended.
40
+ */
41
+ public static function append($block, $string) {
42
+ return $block.$string;
43
+ }
44
+
45
+ /**
46
+ * Escapes HTML entities in text, but without escaping an ampersand that is
47
+ * already part of an escaped entity.
48
+ * @param string Haml block
49
+ * @return string the block with HTML entities escaped.
50
+ */
51
+ public static function escape_once($block) {
52
+ return htmlentities(html_entity_decode($block));
53
+ }
54
+
55
+ /**
56
+ * Returns an array containing default assignments for the xmlns, lang, and
57
+ * xml:lang attributes of the html element.
58
+ * This helper method is for use in the html element only.
59
+ *
60
+ * Examples:<br/>
61
+ * %html(html_attrs())<br/>
62
+ * produces<br/>
63
+ * <html lang="en-us" xml:lang="en-us" xmlns="http://www.w3.org/1999/xhtml">
64
+ *
65
+ * %html(html_attrs('en-gb'))<br/>
66
+ * produces<br/>
67
+ * <html lang="en-gb" xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
68
+ *
69
+ * %html(html_attrs('en-gb', false))<br/>
70
+ * produces<br/>
71
+ * <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
72
+ *
73
+ * Although handled in HamlParser, the notes below are here for completeness.<br/>
74
+ * Other attributes are defined as normal. e.g.<br/>
75
+ * %html(xmlns:me="http://www.example.com/me" html_attrs('en-gb', false))<br/>
76
+ * produces<br/>
77
+ * <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml" xmlns:me="http://www.example.com/me">
78
+ *
79
+ * PHamlP also allows for the language to be defined using PHP code that can
80
+ * be eval'd; the code must end with a semi-colon (;). e.g.<br/>
81
+ * %html(html_attrs("FW::app()->language);", false))<br/>
82
+ * produces (assuming FW::app()->language returns 'en-gb')<br/>
83
+ * <html xml:lang="en-gb" xmlns="http://www.w3.org/1999/xhtml">
84
+ *
85
+ * @param string document language. Default = en-us
86
+ * @param boolean whether the html element has the lang attribute. Default: true
87
+ * Should be set false for XHTML 1.1 or greater documents
88
+ * @return string the block with string appended.
89
+ */
90
+ public static function html_attrs($language = 'en-us', $lang = true) {
91
+ return ($lang ?
92
+ array('xmlns'=>self::XMLNS, 'xml:lang'=>$language, 'lang'=>$language) :
93
+ array('xmlns'=>self::XMLNS, 'xml:lang'=>$language));
94
+ }
95
+
96
+ /**
97
+ * Returns a copy of text with ampersands, angle brackets and quotes escaped
98
+ * into HTML entities.
99
+ * @param string Haml block
100
+ * @return string the block with HTML entities escaped.
101
+ */
102
+ public static function html_escape($block) {
103
+ return htmlspecialchars($block);
104
+ }
105
+
106
+ /**
107
+ * Iterates an array and using the block to generate a <li> element for each
108
+ * array element.
109
+ * Examples:<br/>
110
+ * = list_of(array('red', 'orange', ...., 'violet'), 'colour')<br/>
111
+ * = colour<br/>
112
+ * Produces:<br/>
113
+ * <li>red</li><br/>
114
+ * <li>orange</li><br/>
115
+ * |<br/>
116
+ * |<br/>
117
+ * <li>violet></li><br/>
118
+ *
119
+ * = list_of(array('Fly Fishing' => 'JR Hartley', 'Lord of the Rings' => 'JRR Tolkien'), 'title', 'author')<br/>
120
+ * %h3= title<br/>
121
+ * %p= author<br/>
122
+ * Produces:<br/>
123
+ * <li><br/>
124
+ * <h3>Fly Fishing</h3><br/>
125
+ * <p>JR Hartley</p><br/>
126
+ * </li><br/>
127
+ * <li><br/>
128
+ * <h3>Lord of the Rings</h3><br/>
129
+ * <p>JRR Tolkien</p><br/>
130
+ * </li><br/>
131
+ *
132
+ * @param string Haml block
133
+ * @param array items
134
+ * @param string string in block to replace with item key or item value
135
+ * @param string string in block to replace with item value
136
+ * @return string list items.
137
+ */
138
+ public static function list_of($block, $items, $key, $value = null) {
139
+ $output = '';
140
+ foreach ($items as $_key=>$_value) {
141
+ $output .= '<li>' . strtr($block, (empty($value) ? array($key=>$_value) :
142
+ array($key=>$_key, $value=>$_value))) . '</li>';
143
+ } // foreach
144
+ return $output;
145
+ }
146
+
147
+ /**
148
+ * Alias for prepend.
149
+ * @see prepend
150
+ * @param string Haml block
151
+ * @param string string to prepend
152
+ * @return string the block with string prepended
153
+ */
154
+ public static function preceed($block, $string) {
155
+ return self::prepend($block, $string);
156
+ }
157
+
158
+ /**
159
+ * Returns the block with string prepended.
160
+ * @param string Haml block
161
+ * @param string string to prepend
162
+ * @return string the block with string prepended
163
+ */
164
+ public static function prepend($block, $string) {
165
+ return $string.$block;
166
+ }
167
+
168
+ /**
169
+ * Converts newlines in the block to HTML entities.
170
+ * @param string Haml block
171
+ * @return string the block with newlines converted to HTML entities
172
+ */
173
+ public static function preserve($block) {
174
+ return str_replace("\n", '&#x0d;&#x0a;', $block);
175
+ }
176
+
177
+ /**
178
+ * Alias for append.
179
+ * @see append
180
+ * @param string Haml block
181
+ * @param string string to apppend
182
+ * @return string the block with string apppended
183
+ */
184
+ public static function succeed($block, $string) {
185
+ return self::append($block, $string);
186
+ }
187
+
188
+ /**
189
+ * Surrounds a block of Haml code with strings.
190
+ * If $back is not given it defaults to $front.
191
+ * @param string Haml block
192
+ * @param string string to prepend
193
+ * @param string string to apppend
194
+ * @return string the block surrounded by the strings
195
+ */
196
+ public static function surround($block, $front, $back=null) {
197
+ return $front.$block.(is_null($back) ? $front : $back);
198
+ }
199
+ }