Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
slightly better HTML formatting
  • Loading branch information
kraih committed Nov 8, 2011
1 parent f113da8 commit e8aaf31
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 32 deletions.
3 changes: 2 additions & 1 deletion lib/Mojo/HelloWorld.pm
Expand Up @@ -113,7 +113,8 @@ under->any('/*whatever' => {whatever => '', text => 'Your Mojo is working!'});
__DATA__
@@ layouts/default.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<%= content_for 'head' %>
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojo/Template.pm
Expand Up @@ -446,7 +446,8 @@ Mojo::Template - Perl-ish templates!
# Simple
my $output = $mt->render(<<'EOF');
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Simple</title></head>
<body>Time: <%= localtime(time) %></body>
</html>
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -114,7 +114,8 @@ sub welcome {
1;
@@ static
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title>Welcome to the Mojolicious real-time web framework!</title>
</head>
Expand All @@ -139,7 +140,8 @@ my $t = Test::Mojo->new('<%= $class %>');
$t->get_ok('/welcome')->status_is(200)->content_like(qr/Mojolicious/i);
@@ layout
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title><%%= title %></title></head>
<body><%%= content %></body>
</html>
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/Command/generate/lite_app.pm
Expand Up @@ -42,7 +42,8 @@ app->start;
Welcome to Mojolicious!
<% %>@@ layouts/default.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title><%%= title %></title></head>
<body><%%= content %></body>
</html>
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -273,7 +273,8 @@ block for too long.
__DATA__

@@ index.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Echo</title></head>
<body>
<script>
Expand Down Expand Up @@ -353,7 +354,8 @@ infrastructure requirements, since it reuses the HTTP protocol for transport.
__DATA__

@@ index.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>LiveLog</title></head>
<body>
<script>
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -457,7 +457,8 @@ like this.
%= link_to Logout => 'logout'

@@ layouts/default.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Login Manager</title></head>
<body><%= content %></body>
</html>
Expand Down
27 changes: 18 additions & 9 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -37,7 +37,8 @@ or the C<DATA> section of the class C<main>.

__DATA__
@@ time.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Time</title></head>
<body><%= localtime time %></body>
</html>
Expand Down Expand Up @@ -333,7 +334,8 @@ trivial.
Hello World!

@@ layouts/mylayout.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>MyApp</title></head>
<body><%= content %></body>
</html>
Expand All @@ -347,7 +349,8 @@ You can also pass along normal stash values to the C<layout> helper.
Hello World!

@@ layouts/mylayout.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title><%= $title %></title></head>
<body><%= content %></body>
</html>
Expand Down Expand Up @@ -378,7 +381,8 @@ Like most helpers the C<include> helper is just a shortcut to make your life
a little easier.

@@ foo/bar.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
%= include 'header'
<body>Bar</body>
</html>
Expand All @@ -390,7 +394,8 @@ Instead of C<include> you could also just call C<render> with the C<partial>
argument.

@@ foo/bar.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
%= $self->render('header', partial => 1)
<body>Bar</body>
</html>
Expand All @@ -403,7 +408,8 @@ to C<include>, they will get localized automatically and are only available
in the partial template.

@@ foo/bar.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
%= include 'header', title => 'Hello'
<body>Bar</body>
</html>
Expand Down Expand Up @@ -463,7 +469,8 @@ of the template to the layout.
% end

@@ layouts/mylayout.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><%= content_for 'header' %></head>
<body><%= content %></body>
</html>
Expand All @@ -475,7 +482,8 @@ build a skeleton template with named C<content> blocks that child templates
can override.

@@ first.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Hello</title></head>
<body>
%= content header => begin
Expand Down Expand Up @@ -614,7 +622,8 @@ C<exception.$mode.$format.*> or C<not_found.$mode.$format.*> before falling
back to the built-in default templates.

@@ not_found.production.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Page Not Found</title></head>
<body>Page does not seem to exist.</body>
</html>
Expand Down
15 changes: 10 additions & 5 deletions lib/Mojolicious/Lite.pm
Expand Up @@ -252,7 +252,8 @@ Templates can have layouts.
Hello World!
@@ layouts/green.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
Expand All @@ -272,7 +273,8 @@ delimited by the C<begin> and C<end> keywords.
% my ($url, $name) = @_;
Try <%= link_to $url => begin %><%= $name %><% end %>.
% end
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Sebastians frameworks</title></head>
<body>
%= $link->('http://mojolicio.us', 'Mojolicious')
Expand Down Expand Up @@ -304,7 +306,8 @@ content.
% end
@@ layouts/blue.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
%= content_for 'header'
Expand Down Expand Up @@ -462,7 +465,8 @@ Formats can be automatically detected by looking at file extensions.
__DATA__
@@ detected.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Detected</title></head>
<body>HTML was detected.</body>
</html>
Expand Down Expand Up @@ -665,7 +669,8 @@ C<250KB> will be automatically streamed into a temporary file.
__DATA__
@@ upload.html.ep
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Upload</title></head>
<body>
% my @attrs = (method => 'POST', enctype => 'multipart/form-data');
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/templates/exception.development.html.ep
@@ -1,5 +1,6 @@
% my $e = delete $self->stash->{'exception'};
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title>Server Error</title>
<meta http-equiv="Pragma" content="no-cache">
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/templates/exception.html.ep
@@ -1,4 +1,5 @@
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Server Error</title></head>
%= stylesheet begin
body { background-color: #caecf6 }
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/templates/not_found.development.html.ep
@@ -1,4 +1,5 @@
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title>Page Not Found</title>
%= stylesheet '/css/prettify-mojo.css'
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/templates/not_found.html.ep
@@ -1,4 +1,5 @@
<!doctype html><html>
<!DOCTYPE html>
<html>
<head><title>Page Not Found</title></head>
%= stylesheet begin
a img { border: 0 }
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/templates/perldoc.html.ep
@@ -1,4 +1,5 @@
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title><%= $title %></title>
%= stylesheet '/css/prettify-mojo.css'
Expand Down
8 changes: 5 additions & 3 deletions t/mojo/dom.t
Expand Up @@ -1350,7 +1350,8 @@ is $dom->find('html > head > script')->[1]->text,

# More real world JavaScript
$dom = Mojo::DOM->new->parse(<<EOF);
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<script type="text/javascript" src="/js/one.js"></script>
Expand All @@ -1372,7 +1373,8 @@ is $dom->at('html > body')->text, 'Bar', 'right text';

# Even more real world JavaScript
$dom = Mojo::DOM->new->parse(<<EOF);
<!doctype html><html>
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<script type="text/javascript" src="/js/one.js"></script>
Expand Down Expand Up @@ -1579,7 +1581,7 @@ EOF

# A collection of wonderful screwups
$dom = Mojo::DOM->new->parse(<<'EOF');
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head><title>Wonderful Screwups</title></head>
<body id="screw-up">
Expand Down
3 changes: 2 additions & 1 deletion t/mojolicious/templates/layouts/default.html.epl
@@ -1,7 +1,8 @@
%# "I didn’t think it was physically possible, but this both sucks *and*
%# blows."
% my $self = shift;
<!doctype html><html>
<!DOCTYPE html>
<html>
<head></head>
<body>
<%= $self->render_partial(template => '23') %><%= $self->render_content %>
Expand Down
3 changes: 2 additions & 1 deletion t/mojolicious/templates/layouts/green.html.epl
Expand Up @@ -2,7 +2,8 @@
%# And then the battle is not so bad?
%# Oh, right. I forgot about the battle."
% my $self = shift;
<!doctype html><html>
<!DOCTYPE html>
<html>
<head></head>
<body>
Same old in green <%= $self->render_content %>
Expand Down

0 comments on commit e8aaf31

Please sign in to comment.