Skip to content

Commit ea15f52

Browse files
authored
Adding a few website features. (#366)
1 parent 214a68b commit ea15f52

File tree

5 files changed

+101
-1
lines changed

5 files changed

+101
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
_site
44
.sass-cache
55
build
6+
.firebaserc
67

78
# Dart ignores.
89
.packages

_includes/prev-next-nav.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class="row">
2+
<div class="row-fluid">
3+
4+
<!-- PREV -->
5+
<div class="col-md-4">
6+
{% if page.prev-page %}
7+
<a href="{{ page.prev-page }}"><i class="fa fa-arrow-left"> </i> {{ page.prev-page-title }}</a>
8+
{% endif %}
9+
</div>
10+
11+
<!-- NEXT -->
12+
<div class="col-md-8">
13+
{% if page.next-page %}
14+
<a href="{{ page.next-page }}" class="pull-right">{{ page.next-page-title }} <i class="fa fa-arrow-right"></i></a>
15+
{% endif %}
16+
</div>
17+
<p>&nbsp;</p>
18+
19+
</div>
20+
</div>

_layouts/tutorial.html

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
layout: page
3+
---
4+
5+
{% if page.points %}
6+
<div class="panel" background-color:"0xEEEEEE">
7+
<h4>What's the point?</h4>
8+
<ul>
9+
{% for point in page.points %}
10+
<li>{{ point }}</li>
11+
{% endfor %}
12+
</ul>
13+
</div>
14+
{% endif %}
15+
{{ content }}

_plugins/prettify.rb

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2+
# for details. All rights reserved. Use of this source code is governed by a
3+
# BSD-style license that can be found in the LICENSE file.
4+
5+
require 'cgi'
6+
7+
module Prettify
8+
9+
# Wraps code with tags for Prettify.
10+
#
11+
# Example usage:
12+
#
13+
# {% prettify dart %}
14+
# // dart code here
15+
# {% endprettify %}
16+
#
17+
# The language name can be ommitted if it is not known.
18+
class Tag < Liquid::Block
19+
20+
Syntax = /\s*(\w+)\s*/o
21+
22+
def initialize(tag_name, markup, tokens)
23+
super
24+
if markup =~ Syntax
25+
@lang = $1
26+
end
27+
end
28+
29+
def render(context)
30+
# out = '<pre class="prettyprint linenums'
31+
out = '<pre class="prettyprint'
32+
unless @lang.nil?
33+
out += ' lang-' + @lang
34+
end
35+
out += '">'
36+
37+
contents = super #.strip
38+
contents = CGI::escapeHTML(contents)
39+
40+
contents.gsub!('[[strike]]', '<code class="nocode strike">')
41+
contents.gsub!('[[/strike]]', '</code>')
42+
43+
contents.gsub!('[[highlight]]', '<code class="nocode highlight">')
44+
contents.gsub!('[[/highlight]]', '</code>')
45+
46+
contents.gsub!('[[note]]', '<code class="nocode note">')
47+
contents.gsub!('[[/note]]', '</code>')
48+
49+
contents.gsub!('[[red]]', '<code class="nocode red">')
50+
contents.gsub!('[[/red]]', '</code>')
51+
52+
out += contents + "</pre>"
53+
end
54+
55+
end
56+
end
57+
58+
Liquid::Template.register_tag('prettify', Prettify::Tag)

_sass/_customstyles.scss

+7-1
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,12 @@ pre, table code {
789789

790790
pre {
791791
margin: 25px 0px;
792+
/* Added from dartlang to enable highlighting in code blocks. */
793+
/* site-www/src/_assets/stylesheets/main.css */
794+
.highlight {
795+
background: #fffde7 !important;
796+
padding: 2px;
797+
}
792798
}
793799

794800
#json-box-container pre {
@@ -1032,4 +1038,4 @@ a code {
10321038

10331039
table th code {
10341040
color: white;
1035-
}
1041+
}

0 commit comments

Comments
 (0)