everzet / jade.php Goto Github PK
View Code? Open in Web Editor NEWHAML-like template engine for PHP 5.3 & Symfony2
Home Page: http://everzet.com/jade.php
License: MIT License
HAML-like template engine for PHP 5.3 & Symfony2
Home Page: http://everzet.com/jade.php
License: MIT License
input:submit.btn.primary(value="てすと")
will be
<input class="btn primary" value="てすと")
so i modified Lexer/Lexer.php like following.
it's seems ok, what do you think?
diff --git a/src/Everzet/Jade/Lexer/Lexer.php b/src/Everzet/Jade/Lexer/Lexer.php
index 16c55ab..6be2d1a 100644
--- a/src/Everzet/Jade/Lexer/Lexer.php
+++ b/src/Everzet/Jade/Lexer/Lexer.php
@@ -426,6 +426,23 @@ class Lexer implements LexerInterface
$dbrac = false;
for ($i = 0, $length = mb_strlen($string); $i < $length; ++$i) {
$c = mb_substr($string,$i,1);
if ('"' === $c) {
$dbrac = !$dbrac;
} elseif ('\'' === $c) {
$sbrac = !$sbrac;
}
if (!$sbrac && !$dbrac && $begin === $c) {
++$nbegin;
} elseif (!$sbrac && !$dbrac && $end === $c) {
if (++$nend === $nbegin) {
$position = $i;
break;
}
}
/*
if ('"' === $string[$i]) {
$dbrac = !$dbrac;
} elseif ('\'' === $string[$i]) {
*/
}
You're Using some symfony components (autoloader), maybe it'll be better to use composer?
Hello.
I guess, you missed colons ":" after switch-instruction start (also as after each case-instruction) in file README.md (in section "Comments->Jade Comments").
Hallo,
great library and what I'm currently tried worked well. I'm currently working on a integration of this library for Zend Framework.
What I noticed is that the content isn't escaped by default. HAML does this and I think this should be the default in this library too, since it makes life easier and secure.
Current:
p <script>
Result:
<p><script></p>
Expected:
<p><script></p>
Also do this when a variable is used:
p= $foobar
And of cause the programmer should be able to forbid escaping:
p!= <script>
and when the escaping is set to off globally:
p&= $foobar
makes it still escape.
(That syntax follows HAMLs)
The link in the project description is broken.
I haven't looked the code yet, but will ASAP.
In the meanwhile, I let here my idea.
The parenthesis could be replaced by a simple comma, for example, this:
a(href: '/login', title: 'View login page') Login
Could be written like this:
a, href: '/login', title: 'View login page' Login
The rationale is simple: is there a comma? then an attribute is comming
JADE
p Donate via
a(href='/paypal') Paypal
|.
or
p Donate via
a(href='/paypal') Paypal
.
OUTPUT
Donate via Paypal .
EXPECTED
Donate via Paypal.
(Look for a space between word and point)
.
Will the partials and inheritance features be included in this project at some point?
when trying to parse a template I get the following error:
Catchable fatal error: Argument 1 passed to Everzet\Jade\Node\BlockNode::addChild() must be an instance of Everzet\Jade\Node\Node, null given, called in /vagrant/lithium/libraries/li3_jade/libraries/jade.php/src/Everzet/Jade/Parser.php on line 59 and defined in /vagrant/lithium/libraries/li3_jade/libraries/jade.php/src/Everzet/Jade/Node/BlockNode.php on line 25
Here is the template contents that I am trying to parse:
h2 The Jade template engine Rocks
p(style='white-space:pre;')
| Jade makes writing HTML EASY and Beautiful
| If you don't know about it
a(href="http://jade-lang.com/") Get on it!
Hello,
the XML declaration should be aware of the encoding:
Code:
!!! xml iso-5589-1
Result
<?xml version="1.0" encoding="iso-5589-1"?>
For example, <meta name="viewport" content="width=device-width, initial-scale=1.0">
is a common practice for mobile-friendly development. When written in jade.php as meta(name="viewport", content="width=device-width, initial-scale=1.0")
, it is rendered as <meta name="viewport" content="width=device-width" initial-scale="1.0" />
. The Javascript version does not currently have this bug.
Hello,
When my server was upgraded to PHP 5.4, 5.5 the following warning was shown.
Warning: preg_match(): Compilation failed: invalid range in character class at offset 8 in Everzet/Jade/Lexer/Lexer.php on line 181
Escaping the dash and changing the regex for '/^(\w[:-\w]*)/' solved the problem for me.
Jade:
!!!
html
head
title= 'title'
// [if IE]
script(type="text/javascript")
window.console = { log: function () {} };
body!= body
Results in HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>title</title><!-- [if IE]<script type="text/javascript">window.console = { log: function () {} };
</script>--></head>
Should result in HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>title</title><!-- [if IE]><script type="text/javascript">window.console = { log: function () {} };
</script><![endif]--></head>
Will this project be continually supported?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.