Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

Math plugin#137

Open
raymondgeerts wants to merge 3 commits intoTurbineCSS:devfrom
raymondgeerts:dev
Open

Math plugin#137
raymondgeerts wants to merge 3 commits intoTurbineCSS:devfrom
raymondgeerts:dev

Conversation

@raymondgeerts
Copy link
Copy Markdown

Security issue in eval() is fixed

@SirPepe
Copy link
Copy Markdown
Contributor

SirPepe commented Nov 25, 2010

Great, this works rather well. One final question: what's the reason for restricting the plugin to certain css properties?

@raymondgeerts
Copy link
Copy Markdown
Author

I did that because those are all the known properties who can have a measurement value. Its easy to extend. If you know of more or need also html 5 properties inside there i can easely add them

@SirPepe
Copy link
Copy Markdown
Contributor

SirPepe commented Nov 26, 2010

I'm less concered about HTML5 oder CSS3, I'm thinking more about people who write their own plugins for Turbine and make up new properties. If there isn't some security problem or something I would like to see this restriction dropped... because if nothing can go wrong, why should we be restricting ourselves?

@raymondgeerts
Copy link
Copy Markdown
Author

as far i know there will not be any problem if i take out the property list and let the script walk trough all properties. Hopeful this week i can find some time on the office or at home to modify the plugin.

@commi
Copy link
Copy Markdown
Contributor

commi commented Feb 21, 2011

it would be great if this could work for colors too. lessphp has some fancy color math, but don't have the skill to port that to turbine.

color are array in turbine, so the eval you use wont work.

i could imagine the following:

  1. detect a color-calculation with fancy regex (there are color-regexes in the Utility-Class, one could use them in a bigger regex)
  2. extract all colors from that string (again the regexes are there) to an array
  3. convert colors in that array to rgba-array (Utility::any2rgba)
  4. for each color-compontent (r, g, b, a) replace the color in the original string with that one component (a float)
  5. eval that string
  6. you get one result for each component, just put those together as an rgba(r,g,b,a) string
  7. let the colormodels-plugin take care of the old browsers

thats my stupid idea, if this sounds doable to you and no one else likes to implement it i might try it.

@anselmh
Copy link
Copy Markdown

anselmh commented May 27, 2011

What about sth. like line-height? Why shouldn't I be able to calculate, too? I wouldn't restrict this to predefined elements as it's more future-proof to allow it for all properties.

I would really like to see this in Turbine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants