frontsau 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/frontsau +15 -0
- data/bin/frontsau-phaml-compiler +35 -0
- data/example/.frontsau +12 -0
- data/example/assets/head.jpg +0 -0
- data/example/assets/script.js +4 -0
- data/example/assets/style.css +6 -0
- data/example/css/includes.sass +2 -0
- data/example/css/style.sass +6 -0
- data/example/image/head.jpg +0 -0
- data/example/index.html +0 -0
- data/example/js/script.coffee +1 -0
- data/frontsau.gemspec +41 -0
- data/lib/Phamlp/Phamlp.php +72 -0
- data/lib/Phamlp/PhamlpException.php +31 -0
- data/lib/Phamlp/haml/HamlException.php +29 -0
- data/lib/Phamlp/haml/HamlHelpers.php +199 -0
- data/lib/Phamlp/haml/HamlParser.php +1250 -0
- data/lib/Phamlp/haml/filters/HamlBaseFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlCdataFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlCssFilter.php +30 -0
- data/lib/Phamlp/haml/filters/HamlEscapedFilter.php +32 -0
- data/lib/Phamlp/haml/filters/HamlJavascriptFilter.php +31 -0
- data/lib/Phamlp/haml/filters/HamlPhpFilter.php +27 -0
- data/lib/Phamlp/haml/filters/HamlPlainFilter.php +28 -0
- data/lib/Phamlp/haml/filters/HamlPreserveFilter.php +29 -0
- data/lib/Phamlp/haml/filters/HamlSassFilter.php +37 -0
- data/lib/Phamlp/haml/filters/HamlScssFilter.php +37 -0
- data/lib/Phamlp/haml/filters/_HamlMarkdownFilter.php +50 -0
- data/lib/Phamlp/haml/filters/_HamlTextileFilter.php +50 -0
- data/lib/Phamlp/haml/messages/_i18n.php +32 -0
- data/lib/Phamlp/haml/messages/de.php +32 -0
- data/lib/Phamlp/haml/messages/fr.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompactRenderer.php +32 -0
- data/lib/Phamlp/haml/renderers/HamlCompressedRenderer.php +48 -0
- data/lib/Phamlp/haml/renderers/HamlExpandedRenderer.php +58 -0
- data/lib/Phamlp/haml/renderers/HamlNestedRenderer.php +77 -0
- data/lib/Phamlp/haml/renderers/HamlRenderer.php +137 -0
- data/lib/Phamlp/haml/tree/HamlCodeBlockNode.php +58 -0
- data/lib/Phamlp/haml/tree/HamlCommentNode.php +41 -0
- data/lib/Phamlp/haml/tree/HamlDoctypeNode.php +27 -0
- data/lib/Phamlp/haml/tree/HamlElementNode.php +52 -0
- data/lib/Phamlp/haml/tree/HamlFilterNode.php +50 -0
- data/lib/Phamlp/haml/tree/HamlHelperNode.php +73 -0
- data/lib/Phamlp/haml/tree/HamlNode.php +253 -0
- data/lib/Phamlp/haml/tree/HamlNodeExceptions.php +19 -0
- data/lib/Phamlp/haml/tree/HamlRootNode.php +58 -0
- data/lib/Phamlp/sass/SassException.php +29 -0
- data/lib/Phamlp/sass/SassFile.php +164 -0
- data/lib/Phamlp/sass/SassParser.php +848 -0
- data/lib/Phamlp/sass/extensions/compass/config.php +65 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/_blueprint.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +101 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_colors.scss +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_debug.scss +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +86 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_form.scss +68 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_grid.scss +249 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_ie.scss +109 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +57 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +147 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_print.scss +93 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +54 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_typography.scss +104 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +37 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +58 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/ie.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/print.sass +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/basic/screen.sass +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/buttons/manifest.rb +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/link_icons/manifest.rb +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/manifest.rb +30 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/print.sass +8 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/project/screen.sass +45 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/ie.sass +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/manifest.rb +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_base.sass +10 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_form.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_page.sass +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/partials/_two_col.sass +38 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/print.sass +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/blueprint/templates/semantic/screen.sass +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_gradient.scss +82 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/ellipsis.sass +9 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/manifest.rb +27 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/manifest.rb +20 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/stylesheets/main.sass +1 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/extension/templates/project/screen.sass +2 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/USAGE.markdown +32 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/ie.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/manifest.rb +4 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/print.sass +6 -0
- data/lib/Phamlp/sass/extensions/compass/frameworks/compass/templates/project/screen.sass +7 -0
- data/lib/Phamlp/sass/extensions/compass/functions/colourStops.php +268 -0
- data/lib/Phamlp/sass/extensions/compass/functions/constants.php +44 -0
- data/lib/Phamlp/sass/extensions/compass/functions/fontFiles.php +30 -0
- data/lib/Phamlp/sass/extensions/compass/functions/imageSize.php +39 -0
- data/lib/Phamlp/sass/extensions/compass/functions/inlineData.php +84 -0
- data/lib/Phamlp/sass/extensions/compass/functions/lists.php +47 -0
- data/lib/Phamlp/sass/extensions/compass/functions/selectors.php +128 -0
- data/lib/Phamlp/sass/extensions/compass/functions/urls.php +143 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/_compass.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_css3.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_layout.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_reset.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/_utilities.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-clip.scss +43 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-origin.scss +42 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_background-size.scss +14 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_border-radius.scss +135 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-shadow.scss +50 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box-sizing.scss +13 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_box.scss +112 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_columns.scss +55 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_font-face.scss +33 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_gradient.scss +96 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_inline-block.scss +12 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_opacity.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_shared.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_text-shadow.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transform.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/css3/_transition.scss +85 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/reset/_utilities.scss +133 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_general.scss +6 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_links.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_lists.scss +4 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_print.scss +17 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_sprites.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_tables.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/_text.scss +3 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_clearfix.scss +31 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_float.scss +15 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_hacks.scss +35 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_min.scss +16 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_reset.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_hover-link.scss +5 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_link-colors.scss +28 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +7 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_bullets.scss +34 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +52 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +47 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/lists/_inline-list.scss +29 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +56 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +20 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_borders.scss +27 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_ellipsis.scss +25 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_nowrap.scss +2 -0
- data/lib/Phamlp/sass/extensions/compass/stylesheets/compass/utilities/text/_replacement.scss +34 -0
- data/lib/Phamlp/sass/messages/_i18n.php +122 -0
- data/lib/Phamlp/sass/messages/de.php +70 -0
- data/lib/Phamlp/sass/messages/fr.php +70 -0
- data/lib/Phamlp/sass/renderers/SassCompactRenderer.php +130 -0
- data/lib/Phamlp/sass/renderers/SassCompressedRenderer.php +102 -0
- data/lib/Phamlp/sass/renderers/SassExpandedRenderer.php +62 -0
- data/lib/Phamlp/sass/renderers/SassNestedRenderer.php +61 -0
- data/lib/Phamlp/sass/renderers/SassRenderer.php +51 -0
- data/lib/Phamlp/sass/script/SassScriptFunction.php +169 -0
- data/lib/Phamlp/sass/script/SassScriptFunctions.php +751 -0
- data/lib/Phamlp/sass/script/SassScriptLexer.php +114 -0
- data/lib/Phamlp/sass/script/SassScriptOperation.php +151 -0
- data/lib/Phamlp/sass/script/SassScriptParser.php +192 -0
- data/lib/Phamlp/sass/script/SassScriptParserExceptions.php +40 -0
- data/lib/Phamlp/sass/script/SassScriptVariable.php +57 -0
- data/lib/Phamlp/sass/script/literals/SassBoolean.php +67 -0
- data/lib/Phamlp/sass/script/literals/SassColour.php +886 -0
- data/lib/Phamlp/sass/script/literals/SassLiteral.php +359 -0
- data/lib/Phamlp/sass/script/literals/SassLiteralExceptions.php +47 -0
- data/lib/Phamlp/sass/script/literals/SassNumber.php +503 -0
- data/lib/Phamlp/sass/script/literals/SassString.php +106 -0
- data/lib/Phamlp/sass/tree/SassCommentNode.php +64 -0
- data/lib/Phamlp/sass/tree/SassContext.php +120 -0
- data/lib/Phamlp/sass/tree/SassDebugNode.php +84 -0
- data/lib/Phamlp/sass/tree/SassDirectiveNode.php +76 -0
- data/lib/Phamlp/sass/tree/SassElseNode.php +28 -0
- data/lib/Phamlp/sass/tree/SassExtendNode.php +47 -0
- data/lib/Phamlp/sass/tree/SassForNode.php +99 -0
- data/lib/Phamlp/sass/tree/SassIfNode.php +95 -0
- data/lib/Phamlp/sass/tree/SassImportNode.php +69 -0
- data/lib/Phamlp/sass/tree/SassMixinDefinitionNode.php +88 -0
- data/lib/Phamlp/sass/tree/SassMixinNode.php +91 -0
- data/lib/Phamlp/sass/tree/SassNode.php +342 -0
- data/lib/Phamlp/sass/tree/SassNodeExceptions.php +117 -0
- data/lib/Phamlp/sass/tree/SassPropertyNode.php +239 -0
- data/lib/Phamlp/sass/tree/SassRootNode.php +100 -0
- data/lib/Phamlp/sass/tree/SassRuleNode.php +337 -0
- data/lib/Phamlp/sass/tree/SassVariableNode.php +90 -0
- data/lib/Phamlp/sass/tree/SassWhileNode.php +64 -0
- data/lib/frontsau/assets/rack.rb +12 -0
- data/lib/frontsau/assets/sprockets.rb +59 -0
- data/lib/frontsau/assets/static_assets_compiler.rb +50 -0
- data/lib/frontsau/assets/url_rewriter.rb +22 -0
- data/lib/frontsau/assets/watcher.rb +60 -0
- data/lib/frontsau/thor_app.rb +118 -0
- data/lib/frontsau/version.rb +3 -0
- data/lib/frontsau.rb +64 -0
- metadata +578 -0
@@ -0,0 +1,239 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: SassPropertyNode.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
3
|
+
/**
|
4
|
+
* SassPropertyNode 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
|
+
* SassPropertyNode class.
|
14
|
+
* Represents a CSS property.
|
15
|
+
* @package PHamlP
|
16
|
+
* @subpackage Sass.tree
|
17
|
+
*/
|
18
|
+
class SassPropertyNode extends SassNode {
|
19
|
+
const MATCH_PROPERTY_NEW = '/^([^\s=:"]+)\s*(?:(= )|:)(.*?)$/';
|
20
|
+
const MATCH_PROPERTY_OLD = '/^:([^\s=:]+)(?:\s*(=)\s*|\s+|$)(.*)/';
|
21
|
+
const MATCH_PSUEDO_SELECTOR = '/^:?\w[-\w]+\(?/i';
|
22
|
+
const MATCH_INTERPOLATION = '/^#\{(.*?)\}/i';
|
23
|
+
const NAME = 1;
|
24
|
+
const SCRIPT = 2;
|
25
|
+
const VALUE = 3;
|
26
|
+
const IS_SCRIPT = '= ';
|
27
|
+
|
28
|
+
private static $psuedoSelectors = array(
|
29
|
+
'root',
|
30
|
+
'nth-child(',
|
31
|
+
'nth-last-child(',
|
32
|
+
'nth-of-type(',
|
33
|
+
'nth-last-of-type(',
|
34
|
+
'first-child',
|
35
|
+
'last-child',
|
36
|
+
'first-of-type',
|
37
|
+
'last-of-type',
|
38
|
+
'only-child',
|
39
|
+
'only-of-type',
|
40
|
+
'empty',
|
41
|
+
'link',
|
42
|
+
'visited',
|
43
|
+
'active',
|
44
|
+
'hover',
|
45
|
+
'focus',
|
46
|
+
'target',
|
47
|
+
'lang(',
|
48
|
+
'enabled',
|
49
|
+
'disabled',
|
50
|
+
'checked',
|
51
|
+
':first-line',
|
52
|
+
':first-letter',
|
53
|
+
':before',
|
54
|
+
':after',
|
55
|
+
// CSS 2.1
|
56
|
+
'first-line',
|
57
|
+
'first-letter',
|
58
|
+
'before',
|
59
|
+
'after'
|
60
|
+
);
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @var string property name
|
64
|
+
*/
|
65
|
+
private $name;
|
66
|
+
/**
|
67
|
+
* @var string property value or expression to evaluate
|
68
|
+
*/
|
69
|
+
private $value;
|
70
|
+
|
71
|
+
/**
|
72
|
+
* SassPropertyNode constructor.
|
73
|
+
* @param object source token
|
74
|
+
* @param string property syntax
|
75
|
+
* @return SassPropertyNode
|
76
|
+
*/
|
77
|
+
public function __construct($token, $syntax = 'new') {
|
78
|
+
parent::__construct($token);
|
79
|
+
$matches = self::match($token, $syntax);
|
80
|
+
$this->name = $matches[self::NAME];
|
81
|
+
$this->value = $matches[self::VALUE];
|
82
|
+
if ($matches[self::SCRIPT] === self::IS_SCRIPT) {
|
83
|
+
$this->addWarning('Setting CSS properties with "=" is deprecated; use "{name}: {value};"',
|
84
|
+
array('{name}'=>$this->name, '{value}'=>$this->value)
|
85
|
+
);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Parse this node.
|
91
|
+
* If the node is a property namespace return all parsed child nodes. If not
|
92
|
+
* return the parsed version of this node.
|
93
|
+
* @param SassContext the context in which this node is parsed
|
94
|
+
* @return array the parsed node
|
95
|
+
*/
|
96
|
+
public function parse($context) {
|
97
|
+
$return = array();
|
98
|
+
if ($this->value) {
|
99
|
+
$node = clone $this;
|
100
|
+
$node->name = ($this->inNamespace() ? "{$this->namespace}-" : '') .
|
101
|
+
$this->interpolate($this->name, $context);
|
102
|
+
$node->value = $this->evaluate($this->interpolate($this->value, $context), $context, SassScriptParser::CSS_PROPERTY)->toString();
|
103
|
+
if (array_key_exists($node->name, $this->vendor_properties)) {
|
104
|
+
foreach ($this->vendor_properties[$node->name] as $vendorProperty) {
|
105
|
+
$_node = clone $node;
|
106
|
+
$_node->name = $vendorProperty;
|
107
|
+
$return[] = $_node;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
$return[] = $node;
|
111
|
+
}
|
112
|
+
if ($this->children) {
|
113
|
+
$return = array_merge($return, $this->parseChildren($context));
|
114
|
+
}
|
115
|
+
return $return;
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Render this node.
|
120
|
+
* @return string the rendered node
|
121
|
+
*/
|
122
|
+
public function render() {
|
123
|
+
return $this->renderer->renderProperty($this);
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Returns a value indicating if this node is in a namespace
|
128
|
+
* @return boolean true if this node is in a property namespace, false if not
|
129
|
+
*/
|
130
|
+
public function inNamespace() {
|
131
|
+
$parent = $this->parent;
|
132
|
+
do {
|
133
|
+
if ($parent instanceof SassPropertyNode) {
|
134
|
+
return true;
|
135
|
+
}
|
136
|
+
$parent = $parent->parent;
|
137
|
+
} while (is_object($parent));
|
138
|
+
return false;
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Returns the namespace for this node
|
143
|
+
* @return string the namespace for this node
|
144
|
+
*/
|
145
|
+
protected function getNamespace() {
|
146
|
+
$namespace = array();
|
147
|
+
$parent = $this->parent;
|
148
|
+
do {
|
149
|
+
if ($parent instanceof SassPropertyNode) {
|
150
|
+
$namespace[] = $parent->name;
|
151
|
+
}
|
152
|
+
$parent = $parent->parent;
|
153
|
+
} while (is_object($parent));
|
154
|
+
return join('-', array_reverse($namespace));
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Returns the name of this property.
|
159
|
+
* If the property is in a namespace the namespace is prepended
|
160
|
+
* @return string the name of this property
|
161
|
+
*/
|
162
|
+
public function getName() {
|
163
|
+
return $this->name;
|
164
|
+
}
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Returns the parsed value of this property.
|
168
|
+
* @return string the parsed value of this property
|
169
|
+
*/
|
170
|
+
public function getValue() {
|
171
|
+
return $this->value;
|
172
|
+
}
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Returns a value indicating if the token represents this type of node.
|
176
|
+
* @param object token
|
177
|
+
* @param string the property syntax being used
|
178
|
+
* @return boolean true if the token represents this type of node, false if not
|
179
|
+
*/
|
180
|
+
public static function isa($token, $syntax) {
|
181
|
+
$matches = self::match($token, $syntax);
|
182
|
+
|
183
|
+
if (!empty($matches)) {
|
184
|
+
if (isset($matches[self::VALUE]) &&
|
185
|
+
self::isPseudoSelector($matches[self::VALUE])) {
|
186
|
+
return false;
|
187
|
+
}
|
188
|
+
if ($token->level === 0) {
|
189
|
+
throw new SassPropertyNodeException('Properties can not be assigned at root level', array(), $this);
|
190
|
+
}
|
191
|
+
else {
|
192
|
+
return true;
|
193
|
+
}
|
194
|
+
}
|
195
|
+
else {
|
196
|
+
return false;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Returns the matches for this type of node.
|
202
|
+
* @param array the line to match
|
203
|
+
* @param string the property syntax being used
|
204
|
+
* @return array matches
|
205
|
+
*/
|
206
|
+
public static function match($token, $syntax) {
|
207
|
+
switch ($syntax) {
|
208
|
+
case 'new':
|
209
|
+
preg_match(self::MATCH_PROPERTY_NEW, $token->source, $matches);
|
210
|
+
break;
|
211
|
+
case 'old':
|
212
|
+
preg_match(self::MATCH_PROPERTY_OLD, $token->source, $matches);
|
213
|
+
break;
|
214
|
+
default:
|
215
|
+
if (preg_match(self::MATCH_PROPERTY_NEW, $token->source, $matches) == 0) {
|
216
|
+
preg_match(self::MATCH_PROPERTY_OLD, $token->source, $matches);
|
217
|
+
}
|
218
|
+
break;
|
219
|
+
}
|
220
|
+
return $matches;
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Returns a value indicating if the string starts with a pseudo selector.
|
225
|
+
* This is used to reject pseudo selectors as property values as, for example,
|
226
|
+
* "a:hover" and "text-decoration:underline" look the same to the property
|
227
|
+
* match regex.
|
228
|
+
* It will also match interpolation to allow for constructs such as
|
229
|
+
* content:#{$pos}
|
230
|
+
* @see isa()
|
231
|
+
* @param string the string to test
|
232
|
+
* @return bool true if the string starts with a pseudo selector, false if not
|
233
|
+
*/
|
234
|
+
private static function isPseudoSelector($string) {
|
235
|
+
preg_match(self::MATCH_PSUEDO_SELECTOR, $string, $matches);
|
236
|
+
return (isset($matches[0]) && in_array($matches[0], self::$psuedoSelectors)) ||
|
237
|
+
preg_match(self::MATCH_INTERPOLATION, $string);
|
238
|
+
}
|
239
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: SassRootNode.php 49 2010-04-04 10:51:24Z chris.l.yates $ */
|
3
|
+
/**
|
4
|
+
* SassRootNode 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
|
+
require_once(dirname(__FILE__).'/../script/SassScriptParser.php');
|
13
|
+
require_once(dirname(__FILE__).'/../renderers/SassRenderer.php');
|
14
|
+
|
15
|
+
/**
|
16
|
+
* SassRootNode class.
|
17
|
+
* Also the root node of a document.
|
18
|
+
* @package PHamlP
|
19
|
+
* @subpackage Sass.tree
|
20
|
+
*/
|
21
|
+
class SassRootNode extends SassNode {
|
22
|
+
/**
|
23
|
+
* @var SassScriptParser SassScript parser
|
24
|
+
*/
|
25
|
+
protected $script;
|
26
|
+
/**
|
27
|
+
* @var SassRenderer the renderer for this node
|
28
|
+
*/
|
29
|
+
protected $renderer;
|
30
|
+
/**
|
31
|
+
* @var SassParser
|
32
|
+
*/
|
33
|
+
protected $parser;
|
34
|
+
/**
|
35
|
+
* @var array extenders for this tree in the form extendee=>extender
|
36
|
+
*/
|
37
|
+
protected $extenders = array();
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Root SassNode constructor.
|
41
|
+
* @param SassParser Sass parser
|
42
|
+
* @return SassNode
|
43
|
+
*/
|
44
|
+
public function __construct($parser) {
|
45
|
+
parent::__construct((object) array(
|
46
|
+
'source' => '',
|
47
|
+
'level' => -1,
|
48
|
+
'filename' => $parser->filename,
|
49
|
+
'line' => 0,
|
50
|
+
));
|
51
|
+
$this->parser = $parser;
|
52
|
+
$this->script = new SassScriptParser();
|
53
|
+
$this->renderer = SassRenderer::getRenderer($parser->style);
|
54
|
+
$this->root = $this;
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Parses this node and its children into the render tree.
|
59
|
+
* Dynamic nodes are evaluated, files imported, etc.
|
60
|
+
* Only static nodes for rendering are in the resulting tree.
|
61
|
+
* @param SassContext the context in which this node is parsed
|
62
|
+
* @return SassNode root node of the render tree
|
63
|
+
*/
|
64
|
+
public function parse($context) {
|
65
|
+
$node = clone $this;
|
66
|
+
$node->children = $this->parseChildren($context);
|
67
|
+
return $node;
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Render this node.
|
72
|
+
* @return string the rendered node
|
73
|
+
*/
|
74
|
+
public function render() {
|
75
|
+
$node = $this->parse(new SassContext());
|
76
|
+
$output = '';
|
77
|
+
foreach ($node->children as $child) {
|
78
|
+
$output .= $child->render();
|
79
|
+
} // foreach
|
80
|
+
return $output;
|
81
|
+
}
|
82
|
+
|
83
|
+
public function extend($extendee, $selectors) {
|
84
|
+
$this->extenders[$extendee] = (isset($this->extenders[$extendee])
|
85
|
+
? array_merge($this->extenders[$extendee], $selectors) : $selectors);
|
86
|
+
}
|
87
|
+
|
88
|
+
public function getExtenders() {
|
89
|
+
return $this->extenders;
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Returns a value indicating if the line represents this type of node.
|
94
|
+
* Child classes must override this method.
|
95
|
+
* @throws SassNodeException if not overriden
|
96
|
+
*/
|
97
|
+
public static function isa($line) {
|
98
|
+
throw new SassNodeException('Child classes must override this method');
|
99
|
+
}
|
100
|
+
}
|
@@ -0,0 +1,337 @@
|
|
1
|
+
<?php
|
2
|
+
/* SVN FILE: $Id: SassRuleNode.php 118 2010-09-21 09:45:11Z chris.l.yates@gmail.com $ */
|
3
|
+
/**
|
4
|
+
* SassRuleNode 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
|
+
* SassRuleNode class.
|
14
|
+
* Represents a CSS rule.
|
15
|
+
* @package PHamlP
|
16
|
+
* @subpackage Sass.tree
|
17
|
+
*/
|
18
|
+
class SassRuleNode extends SassNode {
|
19
|
+
const MATCH = '/^(.+?)(?:\s*\{)?$/';
|
20
|
+
const SELECTOR = 1;
|
21
|
+
const CONTINUED = ',';
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @const string that is replaced with the parent node selector
|
25
|
+
*/
|
26
|
+
const PARENT_REFERENCE = '&';
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @var array selector(s)
|
30
|
+
*/
|
31
|
+
private $selectors = array();
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @var array parent selectors
|
35
|
+
*/
|
36
|
+
private $parentSelectors = array();
|
37
|
+
|
38
|
+
/**
|
39
|
+
* @var array resolved selectors
|
40
|
+
*/
|
41
|
+
private $resolvedSelectors = array();
|
42
|
+
|
43
|
+
/**
|
44
|
+
* @var boolean whether the node expects more selectors
|
45
|
+
*/
|
46
|
+
private $isContinued;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* SassRuleNode constructor.
|
50
|
+
* @param object source token
|
51
|
+
* @param string rule selector
|
52
|
+
* @return SassRuleNode
|
53
|
+
*/
|
54
|
+
public function __construct($token) {
|
55
|
+
parent::__construct($token);
|
56
|
+
preg_match(self::MATCH, $token->source, $matches);
|
57
|
+
$this->addSelectors($matches[SassRuleNode::SELECTOR]);
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Adds selector(s) to the rule.
|
62
|
+
* If the selectors are to continue for the rule the selector must end in a comma
|
63
|
+
* @param string selector
|
64
|
+
*/
|
65
|
+
public function addSelectors($selectors) {
|
66
|
+
$this->isContinued = substr($selectors, -1) === self::CONTINUED;
|
67
|
+
$this->selectors = array_merge($this->selectors, $this->explode($selectors));
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Returns a value indicating if the selectors for this rule are to be continued.
|
72
|
+
* @param boolean true if the selectors for this rule are to be continued,
|
73
|
+
* false if not
|
74
|
+
*/
|
75
|
+
public function getIsContinued() {
|
76
|
+
return $this->isContinued;
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Parse this node and its children into static nodes.
|
81
|
+
* @param SassContext the context in which this node is parsed
|
82
|
+
* @return array the parsed node and its children
|
83
|
+
*/
|
84
|
+
public function parse($context) {
|
85
|
+
$node = clone $this;
|
86
|
+
$node->selectors = $this->resolveSelectors($context);
|
87
|
+
$node->children = $this->parseChildren($context);
|
88
|
+
return array($node);
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Render this node and its children to CSS.
|
93
|
+
* @return string the rendered node
|
94
|
+
*/
|
95
|
+
public function render() {
|
96
|
+
$this->extend();
|
97
|
+
$rules = '';
|
98
|
+
$properties = array();
|
99
|
+
|
100
|
+
foreach ($this->children as $child) {
|
101
|
+
$child->parent = $this;
|
102
|
+
if ($child instanceof SassRuleNode) {
|
103
|
+
$rules .= $child->render();
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
$properties[] = $child->render();
|
107
|
+
}
|
108
|
+
} // foreach
|
109
|
+
|
110
|
+
return $this->renderer->renderRule($this, $properties, $rules);
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Extend this nodes selectors
|
115
|
+
* $extendee is the subject of the @extend directive
|
116
|
+
* $extender is the selector that contains the @extend directive
|
117
|
+
* $selector a selector or selector sequence that is to be extended
|
118
|
+
*/
|
119
|
+
public function extend() {
|
120
|
+
foreach ($this->root->extenders as $extendee=>$extenders) {
|
121
|
+
if ($this->isPsuedo($extendee)) {
|
122
|
+
$extendee = explode(':', $extendee);
|
123
|
+
$pattern = preg_quote($extendee[0]).'((\.[-\w]+)*):'.preg_quote($extendee[1]);
|
124
|
+
}
|
125
|
+
else {
|
126
|
+
$pattern = preg_quote($extendee);
|
127
|
+
}
|
128
|
+
foreach (preg_grep('/'.$pattern.'$/', $this->selectors) as $selector) {
|
129
|
+
foreach ($extenders as $extender) {
|
130
|
+
if (is_array($extendee)) {
|
131
|
+
$this->selectors[] = preg_replace('/(.*?)'.$pattern.'$/', "\\1$extender\\2", $selector);
|
132
|
+
}
|
133
|
+
elseif ($this->isSequence($extender) || $this->isSequence($selector)) {
|
134
|
+
$this->selectors = array_merge($this->selectors, $this->mergeSequence($extender, $selector));
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
$this->selectors[] = str_replace($extendee, $extender, $selector);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Tests whether the selector is a psuedo selector
|
146
|
+
* @param string selector to test
|
147
|
+
* @return boolean true if the selector is a psuedo selector, false if not
|
148
|
+
*/
|
149
|
+
private function isPsuedo($selector) {
|
150
|
+
return strpos($selector, ':') !== false;
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Tests whether the selector is a sequence selector
|
155
|
+
* @param string selector to test
|
156
|
+
* @return boolean true if the selector is a sequence selector, false if not
|
157
|
+
*/
|
158
|
+
private function isSequence($selector) {
|
159
|
+
return strpos($selector, ' ') !== false;
|
160
|
+
}
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Merges selector sequences
|
164
|
+
* @param string the extender selector
|
165
|
+
* @param string selector to extend
|
166
|
+
* @return array the merged sequences
|
167
|
+
*/
|
168
|
+
private function mergeSequence($extender, $selector) {
|
169
|
+
$extender = explode(' ', $extender);
|
170
|
+
$end = ' '.array_pop($extender);
|
171
|
+
$selector = explode(' ', $selector);
|
172
|
+
array_pop($selector);
|
173
|
+
|
174
|
+
$common = array();
|
175
|
+
while($extender[0] === $selector[0]) {
|
176
|
+
$common[] = array_shift($selector);
|
177
|
+
array_shift($extender);
|
178
|
+
}
|
179
|
+
|
180
|
+
$begining = (!empty($common) ? join(' ', $common) . ' ' : '');
|
181
|
+
|
182
|
+
return array(
|
183
|
+
$begining.join(' ', $selector).' '.join(' ', $extender).$end,
|
184
|
+
$begining.join(' ', $extender).' '.join(' ', $selector).$end
|
185
|
+
);
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Returns the selectors
|
190
|
+
* @return array selectors
|
191
|
+
*/
|
192
|
+
public function getSelectors() {
|
193
|
+
return $this->selectors;
|
194
|
+
}
|
195
|
+
|
196
|
+
/**
|
197
|
+
* Resolves selectors.
|
198
|
+
* Interpolates SassScript in selectors and resolves any parent references or
|
199
|
+
* appends the parent selectors.
|
200
|
+
* @param SassContext the context in which this node is parsed
|
201
|
+
*/
|
202
|
+
public function resolveSelectors($context) {
|
203
|
+
$resolvedSelectors = array();
|
204
|
+
$this->parentSelectors = $this->getParentSelectors($context);
|
205
|
+
|
206
|
+
foreach ($this->selectors as $key=>$selector) {
|
207
|
+
$selector = $this->interpolate($selector, $context);
|
208
|
+
//$selector = $this->evaluate($this->interpolate($selector, $context), $context)->toString();
|
209
|
+
if ($this->hasParentReference($selector)) {
|
210
|
+
$resolvedSelectors = array_merge($resolvedSelectors, $this->resolveParentReferences($selector, $context));
|
211
|
+
}
|
212
|
+
elseif ($this->parentSelectors) {
|
213
|
+
foreach ($this->parentSelectors as $parentSelector) {
|
214
|
+
$resolvedSelectors[] = "$parentSelector $selector";
|
215
|
+
} // foreach
|
216
|
+
}
|
217
|
+
else {
|
218
|
+
$resolvedSelectors[] = $selector;
|
219
|
+
}
|
220
|
+
} // foreach
|
221
|
+
sort($resolvedSelectors);
|
222
|
+
return $resolvedSelectors;
|
223
|
+
}
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Returns the parent selector(s) for this node.
|
227
|
+
* This in an empty array if there is no parent selector.
|
228
|
+
* @return array the parent selector for this node
|
229
|
+
*/
|
230
|
+
protected function getParentSelectors($context) {
|
231
|
+
$ancestor = $this->parent;
|
232
|
+
while (!$ancestor instanceof SassRuleNode && $ancestor->hasParent()) {
|
233
|
+
$ancestor = $ancestor->parent;
|
234
|
+
}
|
235
|
+
|
236
|
+
if ($ancestor instanceof SassRuleNode) {
|
237
|
+
return $ancestor->resolveSelectors($context);
|
238
|
+
}
|
239
|
+
return array();
|
240
|
+
}
|
241
|
+
|
242
|
+
/**
|
243
|
+
* Returns the position of the first parent reference in the selector.
|
244
|
+
* If there is no parent reference in the selector this function returns
|
245
|
+
* boolean FALSE.
|
246
|
+
* Note that the return value may be non-Boolean that evaluates to FALSE,
|
247
|
+
* i.e. 0. The return value should be tested using the === operator.
|
248
|
+
* @param string selector to test
|
249
|
+
* @return mixed integer: position of the the first parent reference,
|
250
|
+
* boolean: false if there is no parent reference.
|
251
|
+
*/
|
252
|
+
private function parentReferencePos($selector) {
|
253
|
+
$inString = '';
|
254
|
+
for ($i = 0, $l = strlen($selector); $i < $l; $i++) {
|
255
|
+
$c = $selector[$i];
|
256
|
+
if ($c === self::PARENT_REFERENCE && empty($inString)) {
|
257
|
+
return $i;
|
258
|
+
}
|
259
|
+
elseif (empty($inString) && ($c === '"' || $c === "'")) {
|
260
|
+
$inString = $c;
|
261
|
+
}
|
262
|
+
elseif ($c === $inString) {
|
263
|
+
$inString = '';
|
264
|
+
}
|
265
|
+
}
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Determines if there is a parent reference in the selector
|
271
|
+
* @param string selector
|
272
|
+
* @return boolean true if there is a parent reference in the selector
|
273
|
+
*/
|
274
|
+
private function hasParentReference($selector) {
|
275
|
+
return $this->parentReferencePos($selector) !== false;
|
276
|
+
}
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Resolves parent references in the selector
|
280
|
+
* @param string selector
|
281
|
+
* @return string selector with parent references resolved
|
282
|
+
*/
|
283
|
+
private function resolveParentReferences($selector, $context) {
|
284
|
+
$resolvedReferences = array();
|
285
|
+
if (!count($this->parentSelectors)) {
|
286
|
+
throw new SassRuleNodeException('Can not use parent selector (' .
|
287
|
+
self::PARENT_REFERENCE . ') when no parent selectors', array(), $this);
|
288
|
+
}
|
289
|
+
foreach ($this->getParentSelectors($context) as $parentSelector) {
|
290
|
+
$resolvedReferences[] = str_replace(self::PARENT_REFERENCE, $parentSelector, $selector);
|
291
|
+
}
|
292
|
+
return $resolvedReferences;
|
293
|
+
}
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Explodes a string of selectors into an array.
|
297
|
+
* We can't use PHP::explode as this will potentially explode attribute
|
298
|
+
* matches in the selector, e.g. div[title="some,value"] and interpolations.
|
299
|
+
* @param string selectors
|
300
|
+
* @return array selectors
|
301
|
+
*/
|
302
|
+
private function explode($string) {
|
303
|
+
$selectors = array();
|
304
|
+
$inString = false;
|
305
|
+
$interpolate = false;
|
306
|
+
$selector = '';
|
307
|
+
|
308
|
+
for ($i = 0, $l = strlen($string); $i < $l; $i++) {
|
309
|
+
$c = $string[$i];
|
310
|
+
if ($c === self::CONTINUED && !$inString && !$interpolate) {
|
311
|
+
$selectors[] = trim($selector);
|
312
|
+
$selector = '';
|
313
|
+
}
|
314
|
+
else {
|
315
|
+
$selector .= $c;
|
316
|
+
if ($c === '"' || $c === "'") {
|
317
|
+
do {
|
318
|
+
$_c = $string[++$i];
|
319
|
+
$selector .= $_c;
|
320
|
+
} while ($_c !== $c);
|
321
|
+
}
|
322
|
+
elseif ($c === '#' && $string[$i+1] === '{') {
|
323
|
+
do {
|
324
|
+
$c = $string[++$i];
|
325
|
+
$selector .= $c;
|
326
|
+
} while ($c !== '}');
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
if (!empty($selector)) {
|
332
|
+
$selectors[] = trim($selector);
|
333
|
+
}
|
334
|
+
|
335
|
+
return $selectors;
|
336
|
+
}
|
337
|
+
}
|