Skip to content

Commit

Permalink
Adding a few website features. (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfshaza2 authored Jan 25, 2017
1 parent 214a68b commit ea15f52
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
_site
.sass-cache
build
.firebaserc

# Dart ignores.
.packages
Expand Down
20 changes: 20 additions & 0 deletions _includes/prev-next-nav.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="row">
<div class="row-fluid">

<!-- PREV -->
<div class="col-md-4">
{% if page.prev-page %}
<a href="{{ page.prev-page }}"><i class="fa fa-arrow-left"> </i> {{ page.prev-page-title }}</a>
{% endif %}
</div>

<!-- NEXT -->
<div class="col-md-8">
{% if page.next-page %}
<a href="{{ page.next-page }}" class="pull-right">{{ page.next-page-title }} <i class="fa fa-arrow-right"></i></a>
{% endif %}
</div>
<p>&nbsp;</p>

</div>
</div>
15 changes: 15 additions & 0 deletions _layouts/tutorial.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: page
---

{% if page.points %}
<div class="panel" background-color:"0xEEEEEE">
<h4>What's the point?</h4>
<ul>
{% for point in page.points %}
<li>{{ point }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{{ content }}
58 changes: 58 additions & 0 deletions _plugins/prettify.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

require 'cgi'

module Prettify

# Wraps code with tags for Prettify.
#
# Example usage:
#
# {% prettify dart %}
# // dart code here
# {% endprettify %}
#
# The language name can be ommitted if it is not known.
class Tag < Liquid::Block

Syntax = /\s*(\w+)\s*/o

def initialize(tag_name, markup, tokens)
super
if markup =~ Syntax
@lang = $1
end
end

def render(context)
# out = '<pre class="prettyprint linenums'
out = '<pre class="prettyprint'
unless @lang.nil?
out += ' lang-' + @lang
end
out += '">'

contents = super #.strip
contents = CGI::escapeHTML(contents)

contents.gsub!('[[strike]]', '<code class="nocode strike">')
contents.gsub!('[[/strike]]', '</code>')

contents.gsub!('[[highlight]]', '<code class="nocode highlight">')
contents.gsub!('[[/highlight]]', '</code>')

contents.gsub!('[[note]]', '<code class="nocode note">')
contents.gsub!('[[/note]]', '</code>')

contents.gsub!('[[red]]', '<code class="nocode red">')
contents.gsub!('[[/red]]', '</code>')

out += contents + "</pre>"
end

end
end

Liquid::Template.register_tag('prettify', Prettify::Tag)
8 changes: 7 additions & 1 deletion _sass/_customstyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,12 @@ pre, table code {

pre {
margin: 25px 0px;
/* Added from dartlang to enable highlighting in code blocks. */
/* site-www/src/_assets/stylesheets/main.css */
.highlight {
background: #fffde7 !important;
padding: 2px;
}
}

#json-box-container pre {
Expand Down Expand Up @@ -1032,4 +1038,4 @@ a code {

table th code {
color: white;
}
}

0 comments on commit ea15f52

Please sign in to comment.