├── Gemfile ├── lib ├── guides │ ├── version.rb │ ├── templates │ │ ├── source │ │ │ ├── index.html.erb │ │ │ ├── _full_index.html.erb │ │ │ ├── _clickable_index.html.erb │ │ │ ├── credits.html.erb │ │ │ ├── _sections.html.erb │ │ │ ├── contribute.textile │ │ │ └── layout.html.erb │ │ ├── assets │ │ │ ├── images │ │ │ │ ├── bullet.gif │ │ │ │ ├── icons │ │ │ │ │ ├── up.png │ │ │ │ │ ├── home.png │ │ │ │ │ ├── next.png │ │ │ │ │ ├── note.png │ │ │ │ │ ├── prev.png │ │ │ │ │ ├── tip.png │ │ │ │ │ ├── caution.png │ │ │ │ │ ├── example.png │ │ │ │ │ ├── warning.png │ │ │ │ │ ├── important.png │ │ │ │ │ ├── callouts │ │ │ │ │ │ ├── 1.png │ │ │ │ │ │ ├── 10.png │ │ │ │ │ │ ├── 11.png │ │ │ │ │ │ ├── 12.png │ │ │ │ │ │ ├── 13.png │ │ │ │ │ │ ├── 14.png │ │ │ │ │ │ ├── 15.png │ │ │ │ │ │ ├── 2.png │ │ │ │ │ │ ├── 3.png │ │ │ │ │ │ ├── 4.png │ │ │ │ │ │ ├── 5.png │ │ │ │ │ │ ├── 6.png │ │ │ │ │ │ ├── 7.png │ │ │ │ │ │ ├── 8.png │ │ │ │ │ │ └── 9.png │ │ │ │ │ └── README │ │ │ │ ├── tab_grey.gif │ │ │ │ ├── tab_info.gif │ │ │ │ ├── tab_note.gif │ │ │ │ ├── tab_red.gif │ │ │ │ ├── book_icon.gif │ │ │ │ ├── edge_badge.png │ │ │ │ ├── nav_arrow.gif │ │ │ │ ├── tab_yellow.gif │ │ │ │ ├── tab_yellow.png │ │ │ │ ├── chapters_icon.gif │ │ │ │ ├── check_bullet.gif │ │ │ │ ├── construction.png │ │ │ │ ├── feature_tile.gif │ │ │ │ ├── footer_tile.gif │ │ │ │ ├── grey_bullet.gif │ │ │ │ ├── header_tile.gif │ │ │ │ ├── header_backdrop.png │ │ │ │ ├── credits_pic_blank.gif │ │ │ │ └── construction.svg │ │ │ ├── stylesheets │ │ │ │ ├── style.css │ │ │ │ ├── reset.css │ │ │ │ ├── print.css │ │ │ │ └── syntaxhighlighter │ │ │ │ │ ├── shThemeMDUltra.css │ │ │ │ │ ├── shThemeEmacs.css │ │ │ │ │ ├── shThemeRDark.css │ │ │ │ │ ├── shThemeMidnight.css │ │ │ │ │ ├── shThemeDefault.css │ │ │ │ │ ├── shThemeFadeToGrey.css │ │ │ │ │ ├── shThemeDjango.css │ │ │ │ │ ├── shThemeRailsGuides.css │ │ │ │ │ ├── shThemeEclipse.css │ │ │ │ │ ├── shCore.css │ │ │ │ │ └── shCoreEmacs.css │ │ │ └── javascripts │ │ │ │ ├── guides.js │ │ │ │ └── syntaxhighlighter │ │ │ │ ├── shBrushPlain.js │ │ │ │ ├── shBrushDiff.js │ │ │ │ ├── shBrushJScript.js │ │ │ │ ├── shBrushErlang.js │ │ │ │ ├── shBrushScala.js │ │ │ │ ├── shBrushXml.js │ │ │ │ ├── shBrushJava.js │ │ │ │ ├── shBrushRuby.js │ │ │ │ ├── shBrushJavaFX.js │ │ │ │ ├── shBrushVb.js │ │ │ │ ├── shBrushDelphi.js │ │ │ │ ├── shBrushAS3.js │ │ │ │ ├── shBrushPython.js │ │ │ │ ├── shBrushCSharp.js │ │ │ │ ├── shBrushBash.js │ │ │ │ ├── shBrushGroovy.js │ │ │ │ ├── shBrushSql.js │ │ │ │ ├── shBrushPerl.js │ │ │ │ ├── shBrushPowerShell.js │ │ │ │ ├── shBrushPhp.js │ │ │ │ ├── shBrushCpp.js │ │ │ │ ├── shBrushCss.js │ │ │ │ ├── shBrushSass.js │ │ │ │ ├── shBrushAppleScript.js │ │ │ │ └── shBrushColdFusion.js │ │ └── guides.yml.tt │ ├── new.rb │ ├── levenshtein.rb │ ├── cli.rb │ ├── markdown_extensions.rb │ ├── preview.rb │ ├── indexer.rb │ ├── helpers.rb │ ├── w3c_validator.rb │ └── textile_transformer.rb └── guides.rb ├── .gitignore ├── bin └── guides ├── spec ├── fixtures │ ├── source │ │ ├── article_two.md │ │ ├── article_one.textile │ │ ├── article_four.textile │ │ └── article_three.textile │ └── guides.yml ├── new_spec.rb ├── spec_helper.rb ├── preview_spec.rb ├── support │ ├── cli.rb │ └── rack.rb ├── build_spec.rb └── textile_transformer_spec.rb ├── Rakefile ├── guides.gemspec └── README.md /Gemfile: -------------------------------------------------------------------------------- 1 | source "http://rubygems.org" 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /lib/guides/version.rb: -------------------------------------------------------------------------------- 1 | module Guides 2 | VERSION = "0.7.2" 3 | end 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | /tmp 3 | /devbin 4 | /.bundle 5 | *.pmdoc 6 | *.gem 7 | *.pkg 8 | -------------------------------------------------------------------------------- /lib/guides/templates/source/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render "full_index", :guides => all_guides %> 2 | -------------------------------------------------------------------------------- /bin/guides: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "guides" 4 | require "guides/cli" 5 | 6 | Guides::CLI.start 7 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/bullet.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/up.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_grey.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_grey.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_info.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_info.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_note.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_note.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_red.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/book_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/book_icon.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/edge_badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/edge_badge.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/home.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/next.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/note.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/prev.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/tip.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/nav_arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/nav_arrow.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_yellow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_yellow.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/tab_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/tab_yellow.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/chapters_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/chapters_icon.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/check_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/check_bullet.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/construction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/construction.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/feature_tile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/feature_tile.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/footer_tile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/footer_tile.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/grey_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/grey_bullet.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/header_tile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/header_tile.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/caution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/caution.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/example.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/warning.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/header_backdrop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/header_backdrop.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/important.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/credits_pic_blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/credits_pic_blank.gif -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/1.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/10.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/11.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/12.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/13.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/14.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/15.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/2.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/3.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/4.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/5.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/6.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/7.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/8.png -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/callouts/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wycats/guides/HEAD/lib/guides/templates/assets/images/icons/callouts/9.png -------------------------------------------------------------------------------- /spec/fixtures/source/article_two.md: -------------------------------------------------------------------------------- 1 | ## Article Two 2 | 3 | This is where we have the stuff for the second article. 4 | 5 | endprologue. 6 | 7 | 8 | ### What is Article Two? 9 | 10 | Article Two is the second article. 11 | -------------------------------------------------------------------------------- /spec/fixtures/source/article_one.textile: -------------------------------------------------------------------------------- 1 | h2. Article One 2 | 3 | This is where we have the stuff for the first article. 4 | 5 | endprologue. 6 | 7 | 8 | h3. What is Article One? 9 | 10 | Article One is the first article. 11 | -------------------------------------------------------------------------------- /spec/fixtures/source/article_four.textile: -------------------------------------------------------------------------------- 1 | h2. Article Four 2 | 3 | This is where we have the stuff for the fourth article. 4 | 5 | endprologue. 6 | 7 | 8 | h3. What is Article Four? 9 | 10 | Article Four is the fourth article. 11 | -------------------------------------------------------------------------------- /spec/fixtures/source/article_three.textile: -------------------------------------------------------------------------------- 1 | h2. Article Three 2 | 3 | This is where we have the stuff for the third article. 4 | 5 | endprologue. 6 | 7 | 8 | h3. What is Article Three? 9 | 10 | Article Three is the third article. 11 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/icons/README: -------------------------------------------------------------------------------- 1 | Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook 2 | icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency 3 | from the Jimmac icons to get round MS IE and FOP PNG incompatibilies. 4 | 5 | Stuart Rackham 6 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | /* Guides.rubyonrails.org */ 2 | /* Style.css */ 3 | /* Created January 30, 2009 4 | --------------------------------------- */ 5 | 6 | /* 7 | --------------------------------------- 8 | Import advanced style sheet 9 | --------------------------------------- 10 | */ 11 | 12 | @import url("reset.css"); 13 | @import url("main.css"); 14 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/guides.js: -------------------------------------------------------------------------------- 1 | function guideMenu(){ 2 | if (document.getElementById('guides').style.display == "none") { 3 | document.getElementById('guides').style.display = "block"; 4 | document.getElementById('guidesArrow').innerHTML = "▾"; 5 | } else { 6 | document.getElementById('guides').style.display = "none"; 7 | document.getElementById('guidesArrow').innerHTML = "▸"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/guides/templates/source/_full_index.html.erb: -------------------------------------------------------------------------------- 1 | <% guides.each do |name, list| %> 2 |

<%= name %>

3 | 4 |
5 | <% list.each do |guide| %> 6 |
<%= guide_link(guide) %>
7 |
8 | <% if guide["construction"] %> 9 | 10 | <% end %> 11 |

<%= guide["text"] %>

12 |
13 | <% end %> 14 |
15 | <% end %> 16 | 17 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require File.expand_path('../lib/guides/version', __FILE__) 2 | 3 | begin 4 | require 'packager/rake_task' 5 | 6 | Packager::RakeTask.new(:pkg) do |t| 7 | t.version = Guides::VERSION 8 | t.domain = "strobecorp.com" 9 | t.package_name = "Guides" 10 | t.bin_files = ['guides'] 11 | end 12 | rescue LoadError 13 | if Rake.application.options.show_tasks 14 | puts "`gem install packager` for packaging tasks" 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lib/guides/templates/source/_clickable_index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% lgroup.each do |group, guides| %> 3 |
<%= group %>
4 | <% guides.each do |guide| %> 5 |
<%= guide_link(guide) %>
6 | <% end %> 7 | <% end %> 8 |
9 |
10 | <% rgroup.each do |group, guides| %> 11 |
<%= group %>
12 | <% guides.each do |guide| %> 13 |
<%= guide_link(guide) %>
14 | <% end %> 15 | <% end %> 16 |
17 | 18 | -------------------------------------------------------------------------------- /spec/new_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe "guides new" do 4 | before(:each) do 5 | reset_tmp 6 | end 7 | 8 | it "prints an error if new is called with no name" do 9 | guides "new", :track_stderr => true 10 | err.should =~ /"new" was called incorrectly/ 11 | end 12 | 13 | it "generates an app if a name is given" do 14 | guides "new", "sample" 15 | out.should =~ /create.*guides\.yml/ 16 | tmp.join("sample", "guides.yml").read.should =~ /\Atitle: sample/ 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require "fileutils" 2 | require "pathname" 3 | require "support/cli" 4 | require "support/rack" 5 | 6 | RSpec.configure do |config| 7 | include SpecHelpers 8 | 9 | def tmp 10 | @tmp ||= Pathname.new(File.expand_path("../../tmp", __FILE__)) 11 | end 12 | 13 | def reset_tmp 14 | FileUtils.rm_rf(tmp) 15 | FileUtils.mkdir_p(tmp) 16 | Dir.chdir(tmp) 17 | end 18 | 19 | def fixtures 20 | @fixtures ||= Pathname.new(File.expand_path("../fixtures", __FILE__)) 21 | end 22 | 23 | config.before(:suite) do 24 | reset_tmp 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/guides/templates/source/credits.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :page_title do %> 2 | <%= Guides.meta["title"] %>: Credits 3 | <% end %> 4 | 5 | <% content_for :header_section do %> 6 |

Credits

7 | 8 |

We'd like to thank the following people for their tireless contributions to this project.

9 | <% end %> 10 | 11 |

<%= Guides.meta["team_name"] %>

12 | 13 | <% Guides.meta["authors"].each do |group, authors| %> 14 |

<%= group %>

15 | <% authors.each do |author| %> 16 | <%= author(author["name"], author["nick"]) do %> 17 | <%= author["description"].html_safe %> 18 | <% end %> 19 | <% end %> 20 | <% end %> 21 | 22 | -------------------------------------------------------------------------------- /lib/guides/new.rb: -------------------------------------------------------------------------------- 1 | module Guides 2 | class New < Thor 3 | include Thor::Actions 4 | 5 | source_root File.expand_path("../templates", __FILE__) 6 | 7 | desc "copy DEST NAME", "copy stuff" 8 | def copy(destination, name) 9 | self.destination_root = File.expand_path(destination) 10 | self.title = name 11 | 12 | directory "source" 13 | empty_directory "assets/stylesheets" 14 | empty_directory "assets/images" 15 | empty_directory "assets/javascripts" 16 | 17 | template "guides.yml.tt", "guides.yml" 18 | create_file "assets/stylesheets/overrides.style.css" 19 | create_file "assets/stylesheets/overrides.print.css" 20 | end 21 | 22 | no_tasks do 23 | attr_accessor :title 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/guides/levenshtein.rb: -------------------------------------------------------------------------------- 1 | module Guides 2 | module Levenshtein 3 | # Based on the pseudocode in http://en.wikipedia.org/wiki/Levenshtein_distance. 4 | def self.distance(s1, s2) 5 | s = s1.unpack('U*') 6 | t = s2.unpack('U*') 7 | m = s.length 8 | n = t.length 9 | 10 | # matrix initialization 11 | d = [] 12 | 0.upto(m) { |i| d << [i] } 13 | 0.upto(n) { |j| d[0][j] = j } 14 | 15 | # distance computation 16 | 1.upto(m) do |i| 17 | 1.upto(n) do |j| 18 | cost = s[i] == t[j] ? 0 : 1 19 | d[i][j] = [ 20 | d[i-1][j] + 1, # deletion 21 | d[i][j-1] + 1, # insertion 22 | d[i-1][j-1] + cost, # substitution 23 | ].min 24 | end 25 | end 26 | 27 | # all done 28 | return d[m][n] 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushPlain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | }; 25 | 26 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 27 | Brush.aliases = ['text', 'plain']; 28 | 29 | SyntaxHighlighter.brushes.Plain = Brush; 30 | 31 | // CommonJS 32 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 33 | })(); 34 | -------------------------------------------------------------------------------- /lib/guides.rb: -------------------------------------------------------------------------------- 1 | require "action_pack" 2 | require "redcloth" 3 | require "maruku" 4 | 5 | require "guides/textile_transformer" 6 | require "guides/markdown_extensions" 7 | require "guides/generator" 8 | 9 | module Guides 10 | class Error < StandardError 11 | def self.status_code(code = nil) 12 | define_method(:status_code) { code } 13 | end 14 | end 15 | 16 | class FormatError < Error; status_code(2) ; end 17 | 18 | class << self 19 | def root 20 | # TODO: Search for guides.yml 21 | File.expand_path(Dir.pwd) 22 | end 23 | 24 | def meta(reload = false) 25 | @meta = nil if reload 26 | 27 | @meta ||= begin 28 | if File.exist?("#{root}/guides.yml") 29 | YAML.load_file("#{root}/guides.yml") 30 | # TODO: Sanity check the output 31 | else 32 | raise "#{root}/guides.yml was not found" 33 | end 34 | end 35 | end 36 | 37 | def config(reload = false) 38 | meta(reload)['config'] || {} 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/guides/templates/source/_sections.html.erb: -------------------------------------------------------------------------------- 1 | <%# This will replace the element in your page. By default, it uses the title key in your guides.yml %> 2 | <%= content_for :page_title do %><%= Guides.meta["title"] %><% end %> 3 | 4 | <%# This content will go in the top navigation area. Leave it blank if you don't want nav %> 5 | <%= content_for :top_nav do %> 6 | <% end %> 7 | 8 | <%# This content will be used when you mark your guides as belonging to an edge release of your project. It defaults 9 | to showing a diagonal "edge" badge %> 10 | <%= content_for :edge do %> 11 | <div> 12 | <img src="images/edge_badge.png" alt="edge-badge" id="edge-badge" /> 13 | </div> 14 | <% end %> 15 | 16 | <%= content_for :license do %> 17 | <p>This work is licensed under a 18 | <%= link_to "Creative Commons Attribution Share Alike 3.0", "http://creativecommons.org/licenses/by-sa/3.0/" %> 19 | license. 20 | </p> 21 | <p> 22 | <%# Any additional trademark information should be entered here %> 23 | </p> 24 | <% end %> 25 | -------------------------------------------------------------------------------- /spec/fixtures/guides.yml: -------------------------------------------------------------------------------- 1 | title: Guides Test 2 | description: Enter your description here. 3 | It can take up several lines. This description 4 | will appear immediately below the main title in 5 | the outputted guides. 6 | 7 | authors: 8 | Documentation Team: 9 | - name: Yehuda Katz 10 | nick: wycats 11 | description: Yehuda wrote the Rails guides gem. 12 | Designers: 13 | - name: Jason Zimdars 14 | nick: jz 15 | description: Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a> 16 | 17 | index: 18 | Section One: 19 | - title: Article One 20 | url: article_one 21 | text: This is the first article 22 | - title: Article Two 23 | url: article_two 24 | text: This is the second article 25 | Section Two: 26 | - title: Article Three 27 | url: article_three 28 | text: This is the third article 29 | - title: Article Four 30 | url: article_four 31 | text: This is the fourth article 32 | construction: true 33 | 34 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/reset.css: -------------------------------------------------------------------------------- 1 | /* Guides.rubyonrails.org */ 2 | /* Reset.css */ 3 | /* Created January 30, 2009 4 | --------------------------------------- */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, font, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td { 15 | margin: 0; 16 | padding: 0; 17 | border: 0; 18 | outline: 0; 19 | font-size: 100%; 20 | background: transparent; 21 | } 22 | 23 | body {line-height: 1; color: black; background: white;} 24 | a img {border:none;} 25 | ins {text-decoration: none;} 26 | del {text-decoration: line-through;} 27 | 28 | :focus { 29 | -moz-outline:0; 30 | outline:0; 31 | outline-offset:0; 32 | } 33 | 34 | /* tables still need 'cellspacing="0"' in the markup */ 35 | table {border-collapse: collapse; border-spacing: 0;} 36 | caption, th, td {text-align: left; font-weight: normal;} 37 | 38 | blockquote, q {quotes: none;} 39 | blockquote:before, blockquote:after, 40 | q:before, q:after { 41 | content: ''; 42 | content: none; 43 | } 44 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushDiff.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | this.regexList = [ 25 | { regex: /^\+\+\+.*$/gm, css: 'color2' }, 26 | { regex: /^\-\-\-.*$/gm, css: 'color2' }, 27 | { regex: /^\s.*$/gm, css: 'color1' }, 28 | { regex: /^@@.*@@$/gm, css: 'variable' }, 29 | { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, 30 | { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } 31 | ]; 32 | }; 33 | 34 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 35 | Brush.aliases = ['diff', 'patch']; 36 | 37 | SyntaxHighlighter.brushes.Diff = Brush; 38 | 39 | // CommonJS 40 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 41 | })(); 42 | -------------------------------------------------------------------------------- /lib/guides/templates/source/contribute.textile: -------------------------------------------------------------------------------- 1 | h2. Contribute 2 | 3 | Replace this with some introductory material on contributing 4 | 5 | endprologue. 6 | 7 | h3. How to Contribute? 8 | 9 | * Make a list 10 | * of useful information 11 | * on contributing 12 | 13 | h3. What to Contribute? 14 | 15 | * We need authors, editors, proofreaders, and translators. Adding a single paragraph of quality content to a guide is a good way to get started. 16 | * The easiest way to start is by improving an existing guide: 17 | ** Improve the structure to make it more coherent. 18 | ** Add missing information. 19 | ** Correct any factual errors. 20 | ** Fix typos or improve style. 21 | ** Bring it up to date with the latest Edge Rails. 22 | * We're also open to suggestions for entire new guides: 23 | ** Contact REPLACE_THIS to get your idea approved. See the Contact section below. 24 | 25 | h3. How is the process? 26 | 27 | * Describe the process 28 | * you will use 29 | * in this section 30 | 31 | h3. Rules 32 | 33 | * Guides are licensed under a Creative Commons Attribution-Share Alike 3.0 License. 34 | * If you're not sure whether a guide is actively being worked on, stop by IRC and ask. 35 | * Set up additional rules here 36 | 37 | TODO: Set up some conventions for authors to follow. https://github.com/lifo/docrails/wiki/rails-guides-conventions Is a good starting poing 38 | 39 | h3. Mailing List 40 | 41 | TODO: Specify the mailing list where people can ask about the efforts 42 | 43 | h3. Contact 44 | 45 | * IRC : TODO 46 | * Twitter: TODO 47 | * Email : TODO 48 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/print.css: -------------------------------------------------------------------------------- 1 | /* Guides.rubyonrails.org */ 2 | /* Print.css */ 3 | /* Created January 30, 2009 */ 4 | /* Modified January 31, 2009 5 | --------------------------------------- */ 6 | 7 | body, .wrapper, .note, .info, code, #topNav, .L, .R, #frame, #container, #header, #navigation, #footer, #feature, #mainCol, #subCol, #extraCol, .content {position: static; text-align: left; text-indent: 0; background: White; color: Black; border-color: Black; width: auto; height: auto; display: block; float: none; min-height: 0; margin: 0; padding: 0;} 8 | 9 | body { 10 | background: #FFF; 11 | font-size: 10pt !important; 12 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 13 | line-height: 1.5; 14 | color: #000; 15 | padding: 0 3%; 16 | } 17 | 18 | .hide, .nav { 19 | display: none !important; 20 | } 21 | 22 | a:link, a:visited { 23 | background: transparent; 24 | font-weight: bold; 25 | text-decoration: underline; 26 | } 27 | 28 | hr { 29 | background:#ccc; 30 | color:#ccc; 31 | width:100%; 32 | height:2px; 33 | margin:2em 0; 34 | padding:0; 35 | border:none; 36 | } 37 | 38 | h1,h2,h3,h4,h5,h6 { font-family: "Helvetica Neue", Arial, "Lucida Grande", sans-serif; } 39 | code { display: inline; font:.9em "Courier New", Monaco, Courier, monospace; } 40 | 41 | img { float:left; margin:1.5em 1.5em 1.5em 0; } 42 | a img { border:none; } 43 | 44 | blockquote { 45 | margin:1.5em; 46 | padding:1em; 47 | font-style:italic; 48 | font-size:.9em; 49 | } 50 | 51 | .small { font-size: .9em; } 52 | .large { font-size: 1.1em; } 53 | -------------------------------------------------------------------------------- /guides.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | lib = File.expand_path('../lib/', __FILE__) 3 | $:.unshift lib unless $:.include?(lib) 4 | 5 | require 'guides/version' 6 | 7 | os = Gem::Platform.local.os 8 | is_mingw = (os == "mingw32") 9 | 10 | Gem::Specification.new do |s| 11 | s.name = "guides" 12 | s.version = Guides::VERSION 13 | s.platform = Gem::Platform::RUBY 14 | s.authors = ["Yehuda Katz"] 15 | s.email = ["wycats@gmail.com"] 16 | s.homepage = "http://yehudakatz.com" 17 | s.summary = %q{Extracting the Rails Guides framework for the rest of us} 18 | s.description = %q{A tool for creating version controlled guides for open source projects, based on the Rails Guides framework} 19 | 20 | s.required_rubygems_version = ">= 1.3.6" 21 | s.rubyforge_project = "guides" 22 | 23 | s.add_dependency "actionpack", "~> 3.0.0" 24 | s.add_dependency "activesupport", "~> 3.0.0" 25 | s.add_dependency "rack", "~> 1.2.1" 26 | s.add_dependency "RedCloth", "~> 4.2.7" 27 | s.add_dependency "maruku", "~> 0.6.0" 28 | s.add_dependency "thor", "~> 0.14.6" 29 | s.add_dependency "thin", "~> 1.2.7" 30 | s.add_dependency 'eventmachine', '~> 1.0.0.beta.4' 31 | 32 | s.add_development_dependency 'rspec', '~> 2.0' 33 | s.add_development_dependency "faraday", "~> 0.5.0" 34 | s.add_development_dependency 'packager' 35 | 36 | s.files = `git ls-files`.split("\n") 37 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 38 | s.executables = %w(guides) 39 | s.require_paths = ["lib"] 40 | end 41 | 42 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'break case catch continue ' + 25 | 'default delete do else false ' + 26 | 'for function if in instanceof ' + 27 | 'new null return super switch ' + 28 | 'this throw true try typeof var while with' 29 | ; 30 | 31 | var r = SyntaxHighlighter.regexLib; 32 | 33 | this.regexList = [ 34 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 35 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 36 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 37 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 38 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 40 | ]; 41 | 42 | this.forHtmlScript(r.scriptScriptTags); 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['js', 'jscript', 'javascript']; 47 | 48 | SyntaxHighlighter.brushes.JScript = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushErlang.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Jean-Lou Dupont 25 | // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html 26 | 27 | // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 28 | var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+ 29 | 'case catch cond div end fun if let not of or orelse '+ 30 | 'query receive rem try when xor'+ 31 | // additional 32 | ' module export import define'; 33 | 34 | this.regexList = [ 35 | { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' }, 36 | { regex: new RegExp("\\%.+", 'gm'), css: 'comments' }, 37 | { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' }, 38 | { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' }, 39 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 40 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 42 | ]; 43 | }; 44 | 45 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 46 | Brush.aliases = ['erl', 'erlang']; 47 | 48 | SyntaxHighlighter.brushes.Erland = Brush; 49 | 50 | // CommonJS 51 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 52 | })(); 53 | -------------------------------------------------------------------------------- /lib/guides/templates/guides.yml.tt: -------------------------------------------------------------------------------- 1 | title: <%= title %> 2 | description: Enter your description here. 3 | It can take up several lines. This description 4 | will appear immediately below the main title in 5 | the outputted guides. 6 | 7 | authors: 8 | Documentation Team: 9 | - name: Yehuda Katz 10 | nick: wycats 11 | description: Yehuda wrote the Rails guides gem. 12 | - name: Peter Wagenet 13 | nick: pwagenet 14 | description: Peter has been a regular contributor and co-maintainer for the guides gem. 15 | Designers: 16 | - name: Jason Zimdars 17 | nick: jz 18 | description: Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a> 19 | 20 | index: 21 | Start Here: 22 | - title: Getting Started 23 | url: getting_started 24 | text: Everything you need to know to install Rails and create your first application 25 | Models: 26 | - title: Rails Database Migrations 27 | url: migrations 28 | text: This guide covers how you can use Active Record migrations to alter your database in a structured and organized manner. 29 | - title: Active Record Validations and Callbacks 30 | url: validations 31 | text: This guide covers how you can use Active Record validations and callbacks. 32 | Controllers: 33 | - title: Action Controller Overview 34 | url: controllers 35 | text: This guide covers how controllers work and how they fit into the request cycle in your application. It includes sessions, filters, and cookies, data streaming, and dealing with exceptions raised by a request, among other topics. 36 | - title: Rails Routing from the Outside In 37 | url: routing 38 | text: This guide covers the user-facing features of Rails routing. If you want to understand how to use routing in your own Rails applications, start here. 39 | -------------------------------------------------------------------------------- /lib/guides/cli.rb: -------------------------------------------------------------------------------- 1 | require "thor" 2 | require "guides/new" 3 | require "guides/preview" 4 | require "guides/version" 5 | 6 | module Guides 7 | class CLI < Thor 8 | ASSETS_ROOT = File.expand_path("../assets", __FILE__) 9 | SOURCE_ROOT = File.expand_path("../source", __FILE__) 10 | 11 | def self.basename 12 | "guides" 13 | end 14 | 15 | desc "new NAME", "create a new directory of guides" 16 | method_option "name", :type => :string 17 | def new(name) 18 | invoke "guides:new:copy", [name, options[:name] || name] 19 | end 20 | 21 | desc "build", "build the guides output" 22 | method_option "only", :type => :array 23 | method_option "clean", :type => :boolean 24 | method_option "edge", :type => :boolean, :default => false 25 | method_option "production", :type => :boolean, :default => true, :banner => "use production mode", :aliases => "-p" 26 | def build 27 | if options[:clean] 28 | FileUtils.rm_rf(File.join(Guides.root, options[:production] ? 'output' : 'staging')) 29 | end 30 | 31 | require "guides/generator" 32 | 33 | opts = options.dup 34 | 35 | opts[:only] ||= [] 36 | 37 | generator = Guides::Generator.new(opts) 38 | generator.generate 39 | end 40 | 41 | map "-v" => "version" 42 | map "--version" => "version" 43 | 44 | desc "version", "print the current version" 45 | def version 46 | shell.say "Guides #{Guides::VERSION}", :green 47 | end 48 | 49 | desc "preview", "preview the guides as you work" 50 | method_option "production", :type => :boolean, :banner => "use production mode", :aliases => "-p" 51 | method_option "port", :type => :string, :default => "9292" 52 | def preview 53 | Preview.start(options) 54 | end 55 | 56 | #desc "update", "when running from the pkg, updates the gem" 57 | #def update 58 | #Update.start 59 | #end 60 | 61 | no_tasks do 62 | def invoke_task(*) 63 | super 64 | rescue Guides::Error => e 65 | shell.say e.message, :red 66 | exit e.status_code 67 | end 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushScala.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Yegor Jbanov and David Bernard. 25 | 26 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + 27 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' + 28 | 'else do if return protected private this package false'; 29 | 30 | var keyops = '[_:=><%#@]+'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 35 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings 36 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers 39 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 40 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword 41 | ]; 42 | } 43 | 44 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 45 | Brush.aliases = ['scala']; 46 | 47 | SyntaxHighlighter.brushes.Scala = Brush; 48 | 49 | // CommonJS 50 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 51 | })(); 52 | -------------------------------------------------------------------------------- /spec/preview_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe "guides preview" do 4 | before(:all) do 5 | reset_tmp 6 | guides "new", "sample" and wait 7 | copy_fixtures 8 | Dir.chdir tmp.join("sample") 9 | end 10 | 11 | after(:all) do 12 | Dir.chdir(tmp) 13 | end 14 | 15 | describe "without arguments" do 16 | 17 | before(:each) do 18 | host! :preview 19 | guides "preview" 20 | end 21 | 22 | after(:each) do 23 | kill! 24 | end 25 | 26 | it "downloads the index at /" do 27 | get "/" 28 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h3>Section One<\/h3>/m 29 | end 30 | 31 | it "downloads the index at /index.html" do 32 | get "/" 33 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h3>Section One<\/h3>/m 34 | end 35 | 36 | it "downloads contribute at /contribute.html" do 37 | get "/contribute.html" 38 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h2>Contribute<\/h2>/m 39 | end 40 | 41 | it "downloads a normal page" do 42 | get "/article_one.html" 43 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h2>Article One<\/h2>/m 44 | end 45 | 46 | it "downloads a markdown page" do 47 | get "/article_two.html" 48 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h2[^>]*>Article Two<\/h2>/m 49 | end 50 | 51 | it "downloads an under-construction page" do 52 | get "/article_four.html" 53 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h2>Article Four<\/h2>/m 54 | end 55 | 56 | end 57 | 58 | describe "production" do 59 | 60 | before(:each) do 61 | host! :preview 62 | guides "preview", "--production" 63 | end 64 | 65 | after(:each) do 66 | kill! 67 | end 68 | 69 | it "downloads a normal page" do 70 | get "/article_one.html" 71 | should_respond_with 200, /<!DOCTYPE html PUBLIC.*>.*<h2>Article One<\/h2>/m 72 | end 73 | 74 | it "does not download an under-construction page" do 75 | get "/article_four.html" 76 | should_respond_with 404, "article_four is under construction and not available in production" 77 | end 78 | 79 | end 80 | 81 | end 82 | -------------------------------------------------------------------------------- /lib/guides/markdown_extensions.rb: -------------------------------------------------------------------------------- 1 | # Hack for buggy method that thinks NOTE is an email header 2 | class MaRuKu::MDDocument 3 | def parse_email_headers(s) 4 | { :data => s} 5 | end 6 | end 7 | 8 | 9 | OpenCodeRegexp = /<(yaml|shell|ruby|erb|html|sql|plain|javascript|css)>/ 10 | CloseCodeRegexp = lambda{|type| /<\/#{type}>/ } 11 | 12 | NoteRegexp = /^(IMPORTANT|CAUTION|WARNING|NOTE|INFO|TIP)[.:](.*)/ 13 | 14 | Maruku::In::Markdown.register_block_extension( 15 | :regexp => OpenCodeRegexp, 16 | :handler => lambda{|doc, src, context| 17 | # Double check first line to get type 18 | type = src.shift_line.match(OpenCodeRegexp)[1] 19 | 20 | # Get all intermediate lines 21 | body = "" 22 | while src.cur_line && src.cur_line !~ CloseCodeRegexp.call(type) 23 | body << src.shift_line + "\n" 24 | end 25 | 26 | # Throw away last line 27 | src.shift_line 28 | 29 | 30 | brush = case type 31 | when 'ruby', 'sql', 'javascript', 'css', 'plain' 32 | type 33 | when 'erb' 34 | 'ruby; html-script: true' 35 | when 'html' 36 | 'xml' # html is understood, but there are .xml rules in the CSS 37 | else 38 | 'plain' 39 | end 40 | 41 | context.push doc.md_html(<<HTML 42 | <div class="code_container"> 43 | <pre class="brush: #{brush}; gutter: false; toolbar: false"> 44 | #{ERB::Util.h(body.strip)} 45 | </pre> 46 | </div> 47 | HTML 48 | ) 49 | true 50 | } 51 | ) 52 | 53 | 54 | Maruku::In::Markdown.register_block_extension( 55 | :regexp => NoteRegexp, 56 | :handler => lambda{|doc, src, context| 57 | # Double check first line to get type and starting text 58 | type, body = src.shift_line.match(NoteRegexp).captures 59 | 60 | # Get all intermediate lines 61 | while src.cur_line && src.cur_line.strip.length > 0 62 | body << " #{src.shift_line}" 63 | end 64 | 65 | css_class = type.downcase 66 | css_class = 'warning' if ['caution', 'important'].include?(css_class) 67 | css_class = 'info' if css_class == 'tip' 68 | 69 | result = "<div class='#{css_class}'><p>" 70 | result << body.strip 71 | result << '</p></div>' 72 | 73 | context.push doc.md_html(result) 74 | true 75 | } 76 | ) 77 | 78 | -------------------------------------------------------------------------------- /lib/guides/preview.rb: -------------------------------------------------------------------------------- 1 | require "rack" 2 | 3 | module Guides 4 | class App 5 | def initialize(options = {}) 6 | @production = !!options[:production] 7 | @local = Rack::File.new(local_assets) 8 | @source = Rack::File.new(source_assets) 9 | @output = Rack::File.new(File.join(Guides.root, @production ? "output" : "staging")) 10 | end 11 | 12 | def local_assets 13 | File.expand_path("../templates/assets", __FILE__) 14 | end 15 | 16 | def source_assets 17 | File.join(Guides.root, "assets") 18 | end 19 | 20 | def source_templates 21 | File.join(Guides.root, "source") 22 | end 23 | 24 | def call(env) 25 | path = env["PATH_INFO"] 26 | 27 | case path 28 | when "/" 29 | env["PATH_INFO"] = "/index.html" 30 | return call(env) 31 | when /\/(.*)\.html$/ 32 | name = $1 33 | generator = Guides::Generator.new({ :production => @production }) 34 | 35 | source_file = Dir["#{source_templates}/#{name}.{#{Guides::Generator::EXTENSIONS.join(",")}}"].first 36 | 37 | unless source_file 38 | return [404, {"Content-Type" => "text/html"}, ["#{name} not found in #{source_templates}: #{Guides.root}"]] 39 | end 40 | 41 | source_base = File.basename(source_file) 42 | 43 | if generator.construction?(source_base) && @production 44 | return [404, {"Content-Type" => "text/html"}, ["#{name} is under construction and not available in production"]] 45 | end 46 | 47 | generator.send(:generate_guide, source_base, "#{name}.html") 48 | return @output.call(env) 49 | else 50 | source = @source.call(env) 51 | return source if source.first == 200 52 | return @local.call(env) 53 | end 54 | end 55 | end 56 | 57 | class Preview < Rack::Server 58 | def self.start(options = {}) 59 | options = options.dup 60 | options[:Port] = options.delete(:port) || '9292' 61 | options.merge!(:host => '0.0.0.0', :server => "thin") 62 | super options 63 | end 64 | 65 | def initialize(options = {}) 66 | @production = !!options[:production] 67 | super(options) 68 | end 69 | 70 | def app 71 | @app ||= App.new(:production => @production) 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushXml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function process(match, regexInfo) 25 | { 26 | var constructor = SyntaxHighlighter.Match, 27 | code = match[0], 28 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code), 29 | result = [] 30 | ; 31 | 32 | if (match.attributes != null) 33 | { 34 | var attributes, 35 | regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' + 36 | '\\s*=\\s*' + 37 | '(?<value> ".*?"|\'.*?\'|\\w+)', 38 | 'xg'); 39 | 40 | while ((attributes = regex.exec(code)) != null) 41 | { 42 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 43 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 44 | } 45 | } 46 | 47 | if (tag != null) 48 | result.push( 49 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 50 | ); 51 | 52 | return result; 53 | } 54 | 55 | this.regexList = [ 56 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]> 57 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... --> 58 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 59 | ]; 60 | }; 61 | 62 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 63 | Brush.aliases = ['xml', 'xhtml', 'xslt', 'html']; 64 | 65 | SyntaxHighlighter.brushes.Xml = Brush; 66 | 67 | // CommonJS 68 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 69 | })(); 70 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 25 | 'continue default do double else enum extends ' + 26 | 'false final finally float for goto if implements import ' + 27 | 'instanceof int interface long native new null ' + 28 | 'package private protected public return ' + 29 | 'short static strictfp super switch synchronized this throw throws true ' + 30 | 'transient try void volatile while'; 31 | 32 | this.regexList = [ 33 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 34 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 35 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 38 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 39 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 40 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 42 | ]; 43 | 44 | this.forHtmlScript({ 45 | left : /(<|<)%[@!=]?/g, 46 | right : /%(>|>)/g 47 | }); 48 | }; 49 | 50 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 51 | Brush.aliases = ['java']; 52 | 53 | SyntaxHighlighter.brushes.Java = Brush; 54 | 55 | // CommonJS 56 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 57 | })(); 58 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushRuby.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Erik Peterson. 25 | 26 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 27 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 28 | 'self super then throw true undef unless until when while yield'; 29 | 30 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 31 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 32 | 'ThreadGroup Thread Time TrueClass'; 33 | 34 | this.regexList = [ 35 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 36 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 37 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 38 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants 39 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols 40 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables 41 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 42 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins 43 | ]; 44 | 45 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['ruby', 'rails', 'ror', 'rb']; 50 | 51 | SyntaxHighlighter.brushes.Ruby = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Patrick Webster 25 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html 26 | var datatypes = 'Boolean Byte Character Double Duration ' 27 | + 'Float Integer Long Number Short String Void' 28 | ; 29 | 30 | var keywords = 'abstract after and as assert at before bind bound break catch class ' 31 | + 'continue def delete else exclusive extends false finally first for from ' 32 | + 'function if import in indexof init insert instanceof into inverse last ' 33 | + 'lazy mixin mod nativearray new not null on or override package postinit ' 34 | + 'protected public public-init public-read replace return reverse sizeof ' 35 | + 'step super then this throw true try tween typeof var where while with ' 36 | + 'attribute let private readonly static trigger' 37 | ; 38 | 39 | this.regexList = [ 40 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, 41 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, 42 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 43 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 44 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers 45 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes 46 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 47 | ]; 48 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 49 | }; 50 | 51 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 52 | Brush.aliases = ['jfx', 'javafx']; 53 | 54 | SyntaxHighlighter.brushes.JavaFX = Brush; 55 | 56 | // CommonJS 57 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 58 | })(); 59 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushVb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + 25 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + 26 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + 27 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + 28 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + 29 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + 30 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + 31 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + 32 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + 33 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + 34 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + 35 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + 36 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + 37 | 'Variant When While With WithEvents WriteOnly Xor'; 38 | 39 | this.regexList = [ 40 | { regex: /'.*$/gm, css: 'comments' }, // one line comments 41 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 42 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 43 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword 44 | ]; 45 | 46 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 47 | }; 48 | 49 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 50 | Brush.aliases = ['vb', 'vbnet']; 51 | 52 | SyntaxHighlighter.brushes.Vb = Brush; 53 | 54 | // CommonJS 55 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 56 | })(); 57 | -------------------------------------------------------------------------------- /lib/guides/indexer.rb: -------------------------------------------------------------------------------- 1 | require 'active_support/core_ext/object/blank' 2 | require 'active_support/ordered_hash' 3 | require 'active_support/core_ext/string/inflections' 4 | 5 | module Guides 6 | class Indexer 7 | attr_reader :body, :result, :warnings, :level_hash 8 | 9 | def initialize(body, warnings, production = false) 10 | @body = body 11 | @result = @body.dup 12 | @warnings = warnings 13 | @production = production 14 | end 15 | 16 | def index 17 | @level_hash = process(body) 18 | end 19 | 20 | private 21 | 22 | def process(string, current_level=3, counters=[1]) 23 | if @production 24 | # Ignore anything in construction tags 25 | string = string.gsub(%r{<construction>.*?</construction>}m, '') 26 | end 27 | 28 | s = StringScanner.new(string) 29 | 30 | level_hash = ActiveSupport::OrderedHash.new 31 | 32 | while s.scan_until(%r{^h(\d)(?:\((#.*?)\))?\s*\.\s*(.*)$}) 33 | level, element_id, title = s[1].to_i, s[2], s[3].strip 34 | 35 | if level < current_level 36 | # This is needed. Go figure. 37 | return level_hash 38 | elsif level == current_level 39 | index = counters.dup 40 | if format = Guides.config['index_format'] 41 | index[0] = sprintf(format, index[0]) 42 | end 43 | index = index.join('.') 44 | 45 | element_id ||= '#' + title_to_element_id(title) 46 | 47 | header_html = Guides.config['index_header'] || "{{index}} {{title}}" 48 | values = { 'index' => index, 'title' => title } 49 | header = header_html.gsub(/{{(.*?)}}/){ values[$1].to_str } 50 | 51 | raise "Parsing Fail" unless @result.sub!(s.matched, "h#{level}(#{element_id}). #{header}") 52 | 53 | key = { 54 | :title => title, 55 | :id => element_id 56 | } 57 | # Recurse 58 | counters << 1 59 | level_hash[key] = process(s.post_match, current_level + 1, counters) 60 | counters.pop 61 | 62 | # Increment the current level 63 | last = counters.pop 64 | counters << last + 1 65 | end 66 | end 67 | level_hash 68 | end 69 | 70 | def title_to_element_id(title) 71 | element_id = title.strip.parameterize.sub(/^\d+/, '') 72 | if warnings && element_id.blank? 73 | puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" 74 | end 75 | element_id 76 | end 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /lib/guides/helpers.rb: -------------------------------------------------------------------------------- 1 | module Guides 2 | module Helpers 3 | def clickable_index 4 | total_guides = all_guides.inject(0) do |sum, (name, guides)| 5 | sum + guides.size 6 | end 7 | 8 | lgroup, rgroup, counted_guides = {}, {}, 0 9 | 10 | all_guides.each do |name, guides| 11 | if counted_guides > (total_guides / 2.0) 12 | rgroup[name] = guides 13 | else 14 | lgroup[name] = guides 15 | end 16 | 17 | counted_guides += guides.size 18 | end 19 | 20 | render "clickable_index", :lgroup => lgroup, :rgroup => rgroup 21 | end 22 | 23 | def is_production? 24 | assigns[:production] 25 | end 26 | 27 | def all_guides 28 | Guides.meta["index"].inject({}) do |ret, (section, items)| 29 | items = items.reject{|item| item['construction'] } if is_production? 30 | ret[section] = items unless items.empty? 31 | ret 32 | end 33 | end 34 | 35 | def guide(name, url, options = {}, &block) 36 | link = content_tag(:a, :href => url) { name } 37 | result = content_tag(:dt, link) 38 | 39 | if options[:work_in_progress] 40 | result << content_tag(:dd, 'Work in progress', :class => 'work-in-progress') 41 | end 42 | 43 | result << content_tag(:dd, capture(&block)) 44 | result 45 | end 46 | 47 | def author(name, nick, image = 'credits_pic_blank.gif', &block) 48 | image = "images/#{image}" unless image =~ /^http/ 49 | 50 | result = content_tag(:img, nil, :src => image, :class => 'left pic', :alt => name) 51 | result << content_tag(:h3, name) 52 | result << content_tag(:p, capture(&block)) 53 | content_tag(:div, result, :class => 'author clearfix', :id => nick) 54 | end 55 | 56 | def code(&block) 57 | c = capture(&block) 58 | content_tag(:code, c) 59 | end 60 | 61 | def guide_exists?(guide) 62 | # Might be able to use build in view_paths methods but I couldn't figure them out - PW 63 | view_paths.any? do |p| 64 | Guides::Generator::EXTENSIONS.any?{|e| File.exist? "#{p}/#{guide["url"]}.#{e}" } 65 | end 66 | end 67 | 68 | def guide_link(guide) 69 | if guide_exists?(guide) 70 | link_to guide["title"], "#{guide["url"]}.html" 71 | else 72 | guide["title"] 73 | end 74 | end 75 | 76 | def guide_chapter_link(guide, chapter) 77 | if guide_exists?(guide) 78 | anchor = chapter.gsub(/\s/, '-').downcase 79 | link_to(chapter, "#{guide["url"]}.html##{anchor}") 80 | else 81 | chapter 82 | end 83 | end 84 | end 85 | end 86 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushDelphi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + 25 | 'case char class comp const constructor currency destructor div do double ' + 26 | 'downto else end except exports extended false file finalization finally ' + 27 | 'for function goto if implementation in inherited int64 initialization ' + 28 | 'integer interface is label library longint longword mod nil not object ' + 29 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + 30 | 'pint64 pointer private procedure program property pshortstring pstring ' + 31 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' + 32 | 'record repeat set shl shortint shortstring shr single smallint string then ' + 33 | 'threadvar to true try type unit until uses val var varirnt while widechar ' + 34 | 'widestring with word write writeln xor'; 35 | 36 | this.regexList = [ 37 | { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) 38 | { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } 39 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line 40 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 41 | { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags 42 | { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 43 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 44 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 45 | ]; 46 | }; 47 | 48 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 49 | Brush.aliases = ['delphi', 'pascal', 'pas']; 50 | 51 | SyntaxHighlighter.brushes.Delphi = Brush; 52 | 53 | // CommonJS 54 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 55 | })(); 56 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushAS3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Created by Peter Atoria @ http://iAtoria.com 25 | 26 | var inits = 'class interface function package'; 27 | 28 | var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + 29 | 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + 30 | 'extends false final finally flash_proxy for get if implements import in include Infinity ' + 31 | 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + 32 | 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + 33 | 'return set static String super switch this throw true try typeof uint undefined unescape ' + 34 | 'use void while with' 35 | ; 36 | 37 | this.regexList = [ 38 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 39 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 40 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 41 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 42 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 43 | { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations 44 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 45 | { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable 46 | { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace 47 | ]; 48 | 49 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); 50 | }; 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['actionscript3', 'as3']; 54 | 55 | SyntaxHighlighter.brushes.AS3 = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushPython.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Gheorghe Milas and Ahmad Sherif 25 | 26 | var keywords = 'and assert break class continue def del elif else ' + 27 | 'except exec finally for from global if import in is ' + 28 | 'lambda not or pass print raise return try yield while'; 29 | 30 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + 31 | 'chr classmethod cmp coerce compile complex delattr dict dir ' + 32 | 'divmod enumerate eval execfile file filter float format frozenset ' + 33 | 'getattr globals hasattr hash help hex id input int intern ' + 34 | 'isinstance issubclass iter len list locals long map max min next ' + 35 | 'object oct open ord pow print property range raw_input reduce ' + 36 | 'reload repr reversed round set setattr slice sorted staticmethod ' + 37 | 'str sum super tuple type type unichr unicode vars xrange zip'; 38 | 39 | var special = 'None True False self cls class_'; 40 | 41 | this.regexList = [ 42 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, 43 | { regex: /^\s*@\w+/gm, css: 'decorator' }, 44 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, 45 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, 46 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, 47 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, 48 | { regex: /\b\d+\.?\w*/g, css: 'value' }, 49 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 50 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 51 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['py', 'python']; 59 | 60 | SyntaxHighlighter.brushes.Python = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | -------------------------------------------------------------------------------- /spec/support/cli.rb: -------------------------------------------------------------------------------- 1 | require "guides" 2 | require "guides/cli" 3 | 4 | module SpecHelpers 5 | attr_reader :stdin, :stdout, :stderr 6 | 7 | def env 8 | @env ||= {} 9 | end 10 | 11 | def guides(*argv) 12 | opts = Hash === argv.last ? argv.pop : {} 13 | 14 | kill! 15 | create_pipes 16 | 17 | @pid = Process.fork do 18 | Dir.chdir opts[:chdir] if opts[:chdir] 19 | 20 | @stdout.close 21 | @stdin.close 22 | @stderr.close 23 | 24 | STDOUT.reopen @stdout_child 25 | STDIN.reopen @stdin_child 26 | 27 | if opts[:track_stderr] || argv.first == 'preview' 28 | STDERR.reopen @stderr_child 29 | end 30 | 31 | env.each do |key, val| 32 | ENV[key] = val 33 | end 34 | 35 | Guides::CLI.start(argv) 36 | end 37 | 38 | 39 | @stdout_child.close 40 | @stdin_child.close 41 | @stderr_child.close 42 | 43 | if argv.first == 'preview' 44 | wait_for_preview_server 45 | end 46 | 47 | @pid 48 | end 49 | 50 | def copy_fixtures 51 | FileUtils.cp fixtures.join("guides.yml"), tmp.join("sample") 52 | FileUtils.cp_r fixtures.join("source"), tmp.join("sample") 53 | end 54 | 55 | def wait_for_preview_server 56 | s = TCPSocket.new('0.0.0.0', 9292) 57 | rescue Errno::ECONNREFUSED, Errno::ECONNRESET 58 | sleep 0.2 59 | raise "server not found" if (tries = (tries || 0) + 1) > 5 60 | retry 61 | rescue Exception => e 62 | puts [e.class, e.message] 63 | ensure 64 | s.close 65 | end 66 | 67 | def out_until_block(io = stdout) 68 | # read 1 first so we wait until the process is done processing the last write 69 | chars = nil 70 | 71 | IO.select( [ io ] ) 72 | 73 | chars = io.read(1) 74 | sleep 0.05 75 | 76 | loop do 77 | chars << io.read_nonblock(1000) 78 | sleep 0.05 79 | end 80 | rescue Errno::EAGAIN, EOFError => e 81 | chars || "" 82 | end 83 | 84 | def input(line, opts = {}) 85 | if on = opts[:on] 86 | should_block_on on 87 | end 88 | stdin << "#{line}\n" 89 | end 90 | 91 | def wait 92 | return unless @pid 93 | 94 | pid, status = Process.wait2(@pid, 0) 95 | 96 | @exit_status = status 97 | @pid = nil 98 | end 99 | 100 | def exit_status 101 | wait 102 | @exit_status 103 | end 104 | 105 | def kill! 106 | Process.kill(9, @pid) if @pid 107 | end 108 | 109 | def out 110 | stdout.read 111 | end 112 | 113 | def err 114 | stderr.read 115 | end 116 | 117 | def create_pipes 118 | @stdout, @stdout_child = IO.pipe 119 | @stdin_child, @stdin = IO.pipe 120 | @stderr, @stderr_child = IO.pipe 121 | end 122 | end 123 | 124 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushCSharp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'abstract as base bool break byte case catch char checked class const ' + 25 | 'continue decimal default delegate do double else enum event explicit ' + 26 | 'extern false finally fixed float for foreach get goto if implicit in int ' + 27 | 'interface internal is lock long namespace new null object operator out ' + 28 | 'override params private protected public readonly ref return sbyte sealed set ' + 29 | 'short sizeof stackalloc static string struct switch this throw true try ' + 30 | 'typeof uint ulong unchecked unsafe ushort using virtual void while'; 31 | 32 | function fixComments(match, regexInfo) 33 | { 34 | var css = (match[0].indexOf("///") == 0) 35 | ? 'color1' 36 | : 'comments' 37 | ; 38 | 39 | return [new SyntaxHighlighter.Match(match[0], match.index, css)]; 40 | } 41 | 42 | this.regexList = [ 43 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments 44 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 45 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings 46 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 47 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 48 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword 50 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' 51 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 58 | Brush.aliases = ['c#', 'c-sharp', 'csharp']; 59 | 60 | SyntaxHighlighter.brushes.CSharp = Brush; 61 | 62 | // CommonJS 63 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 64 | })(); 65 | 66 | -------------------------------------------------------------------------------- /lib/guides/w3c_validator.rb: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------------------- 2 | # 3 | # This script validates the generated guides against the W3C Validator. 4 | # 5 | # Guides are taken from the output directory, from where all .html files are 6 | # submitted to the validator. 7 | # 8 | # This script is prepared to be launched from the railties directory as a rake task: 9 | # 10 | # rake validate_guides 11 | # 12 | # If nothing is specified, all files will be validated, but you can check just 13 | # some of them using this environment variable: 14 | # 15 | # ONLY 16 | # Use ONLY if you want to validate only one or a set of guides. Prefixes are 17 | # enough: 18 | # 19 | # # validates only association_basics.html 20 | # ONLY=assoc rake validate_guides 21 | # 22 | # Separate many using commas: 23 | # 24 | # # validates only association_basics.html and migrations.html 25 | # ONLY=assoc,migrations rake validate_guides 26 | # 27 | # --------------------------------------------------------------------------- 28 | 29 | # TODO: Libraryify 30 | include W3CValidators 31 | 32 | module Guides 33 | class Validator 34 | 35 | def validate 36 | validator = MarkupValidator.new 37 | STDOUT.sync = true 38 | errors_on_guides = {} 39 | 40 | guides_to_validate.each do |f| 41 | results = validator.validate_file(f) 42 | 43 | if results.validity 44 | print "." 45 | else 46 | print "E" 47 | errors_on_guides[f] = results.errors 48 | end 49 | end 50 | 51 | show_results(errors_on_guides) 52 | end 53 | 54 | private 55 | def guides_to_validate 56 | guides = Dir["./guides/output/*.html"] 57 | guides.delete("./guides/output/layout.html") 58 | ENV.key?('ONLY') ? select_only(guides) : guides 59 | end 60 | 61 | def select_only(guides) 62 | prefixes = ENV['ONLY'].split(",").map(&:strip) 63 | guides.select do |guide| 64 | prefixes.any? {|p| guide.start_with?("./guides/output/#{p}")} 65 | end 66 | end 67 | 68 | def show_results(error_list) 69 | if error_list.size == 0 70 | puts "\n\nAll checked guides validate OK!" 71 | else 72 | error_summary = error_detail = "" 73 | 74 | error_list.each_pair do |name, errors| 75 | error_summary += "\n #{name}" 76 | error_detail += "\n\n #{name} has #{errors.size} validation error(s):\n" 77 | errors.each do |error| 78 | error_detail += "\n "+error.to_s.gsub("\n", "") 79 | end 80 | end 81 | 82 | puts "\n\nThere are #{error_list.size} guides with validation errors:\n" + error_summary 83 | puts "\nHere are the detailed errors for each guide:" + error_detail 84 | end 85 | end 86 | 87 | end 88 | end 89 | 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | guides 2 | ====== 3 | 4 | This gem provides a clean a simple way to generate and maintain a collection _guides_ or how-to documents for your project. 5 | 6 | *guides* is inspired in the Ruby on Rails Guides site (http://guides.rubyonrails.org). Some of the documentation sites that have been built using *guides* include: 7 | 8 | * http://guides.sproutcore.com/ 9 | * http://guides.dradisframework.org/ 10 | 11 | 12 | Installation 13 | ------------ 14 | 15 | ``` 16 | $ gem install guides 17 | ``` 18 | 19 | Usage 20 | ----- 21 | 22 | First create a new working directory. 23 | 24 | ``` 25 | $ cd /tmp/ 26 | $ guides new projectguides 27 | $ cd projectguides/ 28 | $ guides preview 29 | ``` 30 | 31 | Then open a browser and point it to http://localhost:9292. You will see your new documentation site up and running. 32 | 33 | From this point on, it is up to you to customize the site and add additional guides. 34 | 35 | Once you are happy with the results, you can generate the final site by running: 36 | 37 | ``` 38 | $ guides build 39 | ``` 40 | 41 | Adding a new guide 42 | ------------------ 43 | 44 | There are two steps required to add a new guide: 45 | 46 | * First you need to edit `guides.yml` to add information about the new guide. Pay special attention to the `url` field you choose. 47 | * Then you need to provide the guide's contents by creating a new file under ./source/<url>.textile 48 | 49 | 50 | Guide authors and contributors 51 | ------------------------------ 52 | 53 | As you will see, the `guides.yml` file also contains a section that lets you define guide authors and contributors. The contents of this section will be rendered to the Credits page (http://localhost:9292/credits.html). 54 | 55 | You can include an image field to provide an avatar for each of the contributors. For example: 56 | 57 | ``` 58 | authors: 59 | Documentation Team: 60 | - name: John Doe 61 | nick: johndoe 62 | image: credits/johndoe.png 63 | description: Brief bio of J.D. 64 | ``` 65 | 66 | As long as you place your avatar files under `./assets/images/credits/`, *guides* will find it and display it in the Credits page. 67 | 68 | 69 | Contributing to guides 70 | ---------------------- 71 | 72 | * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet 73 | * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it 74 | * Fork the project 75 | * Start a feature/bugfix branch 76 | * Commit and push until you are happy with your contribution 77 | * Make sure to add tests for it. This is important so we don't break it in a future version unintentionally. 78 | * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so we can cherry-pick around it. 79 | 80 | 81 | -------------------------------------------------------------------------------- /lib/guides/textile_transformer.rb: -------------------------------------------------------------------------------- 1 | require "strscan" 2 | require "cgi" 3 | 4 | module Guides 5 | module HTMLFormatter 6 | include RedCloth::Formatters::HTML 7 | 8 | def br(opts) 9 | " " 10 | end 11 | end 12 | 13 | class TextileTransformer 14 | LANGUAGES = { "ruby" => "ruby", "sql" => "sql", "javascript" => "javascript", 15 | "css" => "css", "plain" => "plain", "erb" => "ruby; html-script: true", 16 | "html" => "xml", "xml" => "xml", "shell" => "plain", "yaml" => "yaml" } 17 | 18 | NOTES = { "CAUTION" => "warning", "IMPORTANT" => "warning", "WARNING" => "warning", 19 | "INFO" => "info", "TIP" => "info", "NOTE" => "note" } 20 | 21 | def initialize(production=false) 22 | @production = production 23 | end 24 | 25 | def transform(string) 26 | @string = string.dup 27 | 28 | @output = "" 29 | @pending_textile = "" 30 | 31 | until @string.empty? 32 | notes = NOTES.keys.map {|note| "#{note}" }.join("|") 33 | languages = LANGUAGES.keys.join("|") 34 | 35 | match = scan_until /(\+(\S.*?\S?)\+|<(#{languages})(?: filename=["']([^"']*)["'])?>|(#{notes}): |<(construction)>|\z)/m 36 | 37 | @pending_textile << match.pre_match 38 | 39 | if match[2] # +foo+ 40 | @pending_textile << "<notextile><tt>#{CGI.escapeHTML(match[2])}</tt></notextile>" if match[2] 41 | elsif match[3] # <language> 42 | flush_textile 43 | generate_brushes match[3], LANGUAGES[match[3]], match[4] 44 | elsif match[5] # NOTE: 45 | flush_textile 46 | consume_note NOTES[match[5]] 47 | elsif match[6] # <construction> 48 | consume_construction 49 | end 50 | end 51 | 52 | flush_textile 53 | 54 | @output 55 | end 56 | 57 | def generate_brushes(tag, replace, filename) 58 | match = scan_until %r{</#{tag}>} 59 | @output << %{<div class="code_container">\n} 60 | @output << %{<div class="filename">#{filename}</div>\n} if filename 61 | @output << %{<pre class="brush: #{replace}; gutter: false; toolbar: false">\n} << 62 | CGI.escapeHTML(match.pre_match) << %{</pre></div>} 63 | end 64 | 65 | def scan_until(regex) 66 | match = @string.match(regex) 67 | @string = match.post_match 68 | match 69 | end 70 | 71 | def consume_note(css_class) 72 | match = scan_until /(\r?\n){2,}/ # We need at least 2 line breaks but we want to match as many as exist 73 | note = match.pre_match.gsub(/\n\s*/, " ") 74 | note = RedCloth.new(note, [:lite_mode]).to_html 75 | @output << %{<div class="#{css_class}"><p>#{note}</p></div>\n} 76 | end 77 | 78 | def consume_construction 79 | match = scan_until(%r{</construction>}) 80 | unless @production 81 | @string = match.pre_match + @string 82 | end 83 | end 84 | 85 | def flush_textile 86 | @output << RedCloth.new(@pending_textile).to(HTMLFormatter) << "\n" 87 | @pending_textile = "" 88 | end 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushBash.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne ge le'; 25 | var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + 26 | 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + 27 | 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 28 | 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 29 | 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + 30 | 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 31 | 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 32 | 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + 33 | 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 34 | 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 35 | 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + 36 | 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 37 | 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 38 | 'vi watch wc whereis which who whoami Wget xargs yes' 39 | ; 40 | 41 | this.regexList = [ 42 | { regex: /^#!.*$/gm, css: 'preprocessor bold' }, 43 | { regex: /\/[\w-\/]+/gm, css: 'plain' }, 44 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 45 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 46 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 47 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 48 | { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands 49 | ]; 50 | } 51 | 52 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 53 | Brush.aliases = ['bash', 'shell']; 54 | 55 | SyntaxHighlighter.brushes.Bash = Brush; 56 | 57 | // CommonJS 58 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 59 | })(); 60 | -------------------------------------------------------------------------------- /spec/support/rack.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'faraday' 3 | require 'rack' 4 | require 'webrick' 5 | require 'socket' 6 | 7 | Thread.abort_on_exception = true 8 | 9 | module SpecHelpers 10 | RACK_ENV_KEYS = [ 'PATH_INFO', 'REQUEST_METHOD', 'QUERY_STRING', 'rack.input', 11 | 'HTTP_X_ZOMG' ] 12 | 13 | def self.launch_test_server 14 | @test_server ||= begin 15 | app = lambda do |env| 16 | ret = env.slice(*RACK_ENV_KEYS) 17 | ret['rack.input'] = ret['rack.input'].read if ret['rack.input'] 18 | [ 200, { 'Content-Type' => 'text/plain' }, ret.inspect ] 19 | end 20 | 21 | t = Thread.new do 22 | logger = WEBrick::Log.new(nil, WEBrick::BasicLog::WARN) 23 | Rack::Handler::WEBrick.run(app, :Host => '0.0.0.0', :Port => 9293, 24 | :Logger => logger, :AccessLog => []) 25 | end 26 | 27 | begin 28 | s = TCPSocket.new('0.0.0.0', 9293) 29 | rescue Errno::ECONNREFUSED 30 | sleep 0.2 31 | retry 32 | end 33 | 34 | s.close 35 | t 36 | end 37 | end 38 | 39 | def launch_test_server 40 | SpecHelpers.launch_test_server 41 | end 42 | 43 | %w( get post put delete head ).each do |method| 44 | class_eval <<-RUBY 45 | def #{method}(uri, *args) 46 | request(:#{method}, uri, *args) 47 | end 48 | RUBY 49 | end 50 | 51 | attr_reader :response 52 | attr_reader :host 53 | 54 | def host!(host) 55 | @host = host 56 | end 57 | 58 | def request(method, uri, *args) 59 | uri = URI(uri) 60 | host = uri.host || @host 61 | scheme = uri.scheme || 'http' 62 | headers = Hash === args.last ? args.pop : {} 63 | 64 | if host == :preview 65 | ip = host = 'http://localhost:9292' 66 | else 67 | ip = ENV['GUIDES_URL'] 68 | end 69 | 70 | headers['Host'] = host 71 | headers['Authorization'] = 'basic x:x' # hac to bypass varnish 72 | 73 | conn = Faraday::Connection.new(:url => ip) do |c| 74 | c.use Faraday::Adapter::NetHttp 75 | c.headers.merge! headers 76 | end 77 | 78 | path = uri.path 79 | path = "#{path}?#{uri.query}" if uri.query 80 | 81 | begin 82 | @response = conn.run_request(method, path, args.first, {}) 83 | rescue StandardError => e 84 | sleep 0.5 85 | raise e if (tries = (tries || 0) + 1) > 5 86 | retry 87 | end 88 | end 89 | 90 | def should_respond_with(status, body = nil, hdrs = {}) 91 | @response.status.should == status 92 | 93 | if body.is_a?(Regexp) 94 | @response.body.should =~ body 95 | elsif body 96 | @response.body.should == body 97 | end 98 | 99 | hdrs.each do |hdr, val| 100 | @response.headers[hdr].should == val 101 | end 102 | end 103 | 104 | def should_have_env(env) 105 | @response.status.should == 200 106 | empty = RACK_ENV_KEYS - env.keys 107 | actual = eval(@response.body) 108 | 109 | env.each do |key, val| 110 | actual[key].should == val 111 | end 112 | 113 | empty.each do |key| 114 | actual[key].should be_blank 115 | end 116 | end 117 | end 118 | 119 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushGroovy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Andres Almiray 25 | // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 26 | 27 | var keywords = 'as assert break case catch class continue def default do else extends finally ' + 28 | 'if in implements import instanceof interface new package property return switch ' + 29 | 'throw throws try while public protected private static'; 30 | var types = 'void boolean byte char short int long float double'; 31 | var constants = 'null'; 32 | var methods = 'allProperties count get size '+ 33 | 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 34 | 'findIndexOf grep inject max min reverseEach sort ' + 35 | 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 36 | 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 37 | 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 38 | 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 39 | 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 40 | 'withStreams withWriter withWriterAppend write writeLine '+ 41 | 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 42 | 'getText'; 43 | 44 | this.regexList = [ 45 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 46 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 47 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 48 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 49 | { regex: /""".*"""/g, css: 'string' }, // GStrings 50 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 51 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 52 | { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 53 | { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 54 | { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 55 | ]; 56 | 57 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 58 | } 59 | 60 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 61 | Brush.aliases = ['groovy']; 62 | 63 | SyntaxHighlighter.brushes.Groovy = Brush; 64 | 65 | // CommonJS 66 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 67 | })(); 68 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushSql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + 25 | 'current_user day isnull left lower month nullif replace right ' + 26 | 'session_user space substring sum system_user upper user year'; 27 | 28 | var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + 29 | 'binary bit by cascade char character check checkpoint close collate ' + 30 | 'column commit committed connect connection constraint contains continue ' + 31 | 'create cube current current_date current_time cursor database date ' + 32 | 'deallocate dec decimal declare default delete desc distinct double drop ' + 33 | 'dynamic else end end-exec escape except exec execute false fetch first ' + 34 | 'float for force foreign forward free from full function global goto grant ' + 35 | 'group grouping having hour ignore index inner insensitive insert instead ' + 36 | 'int integer intersect into is isolation key last level load local max min ' + 37 | 'minute modify move name national nchar next no numeric of off on only ' + 38 | 'open option order out output partial password precision prepare primary ' + 39 | 'prior privileges procedure public read real references relative repeatable ' + 40 | 'restrict return returns revoke rollback rollup rows rule schema scroll ' + 41 | 'second section select sequence serializable set size smallint static ' + 42 | 'statistics table temp temporary then time timestamp to top transaction ' + 43 | 'translation trigger true truncate uncommitted union unique update values ' + 44 | 'varchar varying view when where with work'; 45 | 46 | var operators = 'all and any between cross in join like not null or outer some'; 47 | 48 | this.regexList = [ 49 | { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments 50 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 51 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 52 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions 53 | { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such 54 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 55 | ]; 56 | }; 57 | 58 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 59 | Brush.aliases = ['sql']; 60 | 61 | SyntaxHighlighter.brushes.Sql = Brush; 62 | 63 | // CommonJS 64 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 65 | })(); 66 | 67 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: #222222 !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: #222222 !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: #222222 !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #253e5a !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: lime !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #38566f !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #435a5f !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #435a5f !important; 43 | color: #222222 !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #428bdd !important; 53 | background: black !important; 54 | border: 1px solid #435a5f !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #428bdd !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: lime !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: #aaaaff !important; 64 | background: #435a5f !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: #aaaaff !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #9ccff4 !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: lime !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #428bdd !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: lime !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #aaaaff !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #8aa6c1 !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: aqua !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #f7e741 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff8000 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: yellow !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #aaaaff !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: red !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: yellow !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #ffaa3e !important; 113 | } 114 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: black !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: black !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: black !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #2a3133 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: #d3d3d3 !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #d3d3d3 !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #990000 !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #990000 !important; 43 | color: black !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #ebdb8d !important; 53 | background: black !important; 54 | border: 1px solid #990000 !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #ebdb8d !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #ff7d27 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #990000 !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #9ccff4 !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: #d3d3d3 !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #ff7d27 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #ff9e7b !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: aqua !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #aec4de !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #ffaa3e !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #81cef9 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #ff9e7b !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: aqua !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: #ebdb8d !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff7d27 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #aec4de !important; 113 | } 114 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeRDark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: #1b2426 !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: #1b2426 !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: #1b2426 !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #323e41 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: #b9bdb6 !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: #b9bdb6 !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #afafaf !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #435a5f !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #435a5f !important; 43 | color: #1b2426 !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #5ba1cf !important; 53 | background: black !important; 54 | border: 1px solid #435a5f !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #5ba1cf !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #5ce638 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #435a5f !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #e0e8ff !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: #b9bdb6 !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #878a85 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #5ce638 !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #5ba1cf !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #435a5f !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #ffaa3e !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ffaa3e !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #e0e8ff !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #5ba1cf !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: #e0e8ff !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: white !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #ffaa3e !important; 113 | } 114 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushPerl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by David Simmons-Duffin and Marty Kube 25 | 26 | var funcs = 27 | 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + 28 | 'chroot close closedir connect cos crypt defined delete each endgrent ' + 29 | 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + 30 | 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + 31 | 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + 32 | 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + 33 | 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + 34 | 'getservbyname getservbyport getservent getsockname getsockopt glob ' + 35 | 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + 36 | 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + 37 | 'oct open opendir ord pack pipe pop pos print printf prototype push ' + 38 | 'quotemeta rand read readdir readline readlink readpipe recv rename ' + 39 | 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + 40 | 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + 41 | 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + 42 | 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + 43 | 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + 44 | 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + 45 | 'undef unlink unpack unshift utime values vec wait waitpid warn write'; 46 | 47 | var keywords = 48 | 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + 49 | 'for foreach goto if import last local my next no our package redo ref ' + 50 | 'require return sub tie tied unless untie until use wantarray while'; 51 | 52 | this.regexList = [ 53 | { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' }, 54 | { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang 55 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 56 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 57 | { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' }, 58 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 59 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 60 | ]; 61 | 62 | this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); 63 | } 64 | 65 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 66 | Brush.aliases = ['perl', 'Perl', 'pl']; 67 | 68 | SyntaxHighlighter.brushes.Perl = Brush; 69 | 70 | // CommonJS 71 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 72 | })(); 73 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: #0f192a !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: #0f192a !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: #0f192a !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #253e5a !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: #38566f !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: #d1edff !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #afafaf !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #435a5f !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #435a5f !important; 43 | color: #0f192a !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #428bdd !important; 53 | background: black !important; 54 | border: 1px solid #435a5f !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #428bdd !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #1dc116 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: #d1edff !important; 64 | background: #435a5f !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: #d1edff !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #8aa6c1 !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: #d1edff !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #428bdd !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #1dc116 !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #b43d3d !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #8aa6c1 !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #ffaa3e !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #f7e741 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ffaa3e !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #e0e8ff !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #b43d3d !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: #f8bb00 !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: white !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #ffaa3e !important; 113 | } 114 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeDefault.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: white !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: white !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: white !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #e0e0e0 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: black !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: black !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #afafaf !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #6ce26c !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #6ce26c !important; 43 | color: white !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: blue !important; 53 | background: white !important; 54 | border: 1px solid #6ce26c !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: blue !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: red !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #6ce26c !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: black !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: black !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #008200 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: blue !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #006699 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: gray !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #aa7700 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff1493 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #0066cc !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #006699 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: gray !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff1493 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: red !important; 113 | } 114 | 115 | .syntaxhighlighter .keyword { 116 | font-weight: bold !important; 117 | } 118 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: #121212 !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: #121212 !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: #121212 !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #2c2c29 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: white !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #afafaf !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #3185b9 !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #3185b9 !important; 43 | color: #121212 !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #3185b9 !important; 53 | background: black !important; 54 | border: 1px solid #3185b9 !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #3185b9 !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #d01d33 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #3185b9 !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #96daff !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: white !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #696854 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #e3e658 !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #d01d33 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #435a5f !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #898989 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #aaaaaa !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #96daff !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #d01d33 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: #ffc074 !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #4a8cdb !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #96daff !important; 113 | } 114 | 115 | .syntaxhighlighter .functions { 116 | font-weight: bold !important; 117 | } 118 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeDjango.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: #0a2b1d !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: #0a2b1d !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: #0a2b1d !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #233729 !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: #f8f8f8 !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #497958 !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #41a83e !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #41a83e !important; 43 | color: #0a2b1d !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #96dd3b !important; 53 | background: black !important; 54 | border: 1px solid #41a83e !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #96dd3b !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: white !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: white !important; 64 | background: #41a83e !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: white !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: #ffe862 !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: #f8f8f8 !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #336442 !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #9df39f !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #96dd3b !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #91bb9e !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #ffaa3e !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #f7e741 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ffaa3e !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #e0e8ff !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #96dd3b !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: #eb939a !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #91bb9e !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: #edef7d !important; 113 | } 114 | 115 | .syntaxhighlighter .comments { 116 | font-style: italic !important; 117 | } 118 | .syntaxhighlighter .keyword { 119 | font-weight: bold !important; 120 | } 121 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Theme by fxn, took shThemeEclipse.css as starting point. 3 | */ 4 | .syntaxhighlighter { 5 | background-color: #eee !important; 6 | font-family: "Anonymous Pro", "Inconsolata", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace !important; 7 | overflow-y: hidden !important; 8 | overflow-x: auto !important; 9 | } 10 | .syntaxhighlighter .line.alt1 { 11 | background-color: #eee !important; 12 | } 13 | .syntaxhighlighter .line.alt2 { 14 | background-color: #eee !important; 15 | } 16 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 17 | background-color: #c3defe !important; 18 | } 19 | .syntaxhighlighter .line.highlighted.number { 20 | color: #eee !important; 21 | } 22 | .syntaxhighlighter table caption { 23 | color: #222 !important; 24 | } 25 | .syntaxhighlighter .gutter { 26 | color: #787878 !important; 27 | } 28 | .syntaxhighlighter .gutter .line { 29 | border-right: 3px solid #d4d0c8 !important; 30 | } 31 | .syntaxhighlighter .gutter .line.highlighted { 32 | background-color: #d4d0c8 !important; 33 | color: #eee !important; 34 | } 35 | .syntaxhighlighter.printing .line .content { 36 | border: none !important; 37 | } 38 | .syntaxhighlighter.collapsed { 39 | overflow: visible !important; 40 | } 41 | .syntaxhighlighter.collapsed .toolbar { 42 | color: #3f5fbf !important; 43 | background: #eee !important; 44 | border: 1px solid #d4d0c8 !important; 45 | } 46 | .syntaxhighlighter.collapsed .toolbar a { 47 | color: #3f5fbf !important; 48 | } 49 | .syntaxhighlighter.collapsed .toolbar a:hover { 50 | color: #aa7700 !important; 51 | } 52 | .syntaxhighlighter .toolbar { 53 | color: #a0a0a0 !important; 54 | background: #d4d0c8 !important; 55 | border: none !important; 56 | } 57 | .syntaxhighlighter .toolbar a { 58 | color: #a0a0a0 !important; 59 | } 60 | .syntaxhighlighter .toolbar a:hover { 61 | color: red !important; 62 | } 63 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 64 | color: #222 !important; 65 | } 66 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 67 | color: #708090 !important; 68 | } 69 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 70 | font-style: italic !important; 71 | color: #6588A8 !important; 72 | } 73 | .syntaxhighlighter .keyword { 74 | color: #64434d !important; 75 | } 76 | .syntaxhighlighter .preprocessor { 77 | color: #646464 !important; 78 | } 79 | .syntaxhighlighter .variable { 80 | color: #222 !important; 81 | } 82 | .syntaxhighlighter .value { 83 | color: #009900 !important; 84 | } 85 | .syntaxhighlighter .functions { 86 | color: #ff1493 !important; 87 | } 88 | .syntaxhighlighter .constants { 89 | color: #0066cc !important; 90 | } 91 | .syntaxhighlighter .script { 92 | color: #222 !important; 93 | background-color: none !important; 94 | } 95 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 96 | color: gray !important; 97 | } 98 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 99 | color: #222 !important; 100 | font-weight: bold !important; 101 | } 102 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 103 | color: red !important; 104 | } 105 | 106 | .syntaxhighlighter .xml .keyword { 107 | color: #64434d !important; 108 | font-weight: normal !important; 109 | } 110 | .syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { 111 | color: #7f007f !important; 112 | } 113 | .syntaxhighlighter .xml .string { 114 | font-style: italic !important; 115 | color: #6588A8 !important; 116 | } 117 | -------------------------------------------------------------------------------- /spec/build_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe "guides build" do 4 | 5 | describe "production" do 6 | 7 | before(:all) do 8 | reset_tmp 9 | guides "new", "sample" and wait 10 | copy_fixtures 11 | Dir.chdir tmp.join("sample") 12 | guides "build" and wait 13 | end 14 | 15 | it "generates the app" do 16 | out.should == "Generating article_one.html\nGenerating article_three.html\n" + 17 | "Generating article_two.html\nGenerating contribute.html\nGenerating credits.html\nGenerating index.html\n" 18 | end 19 | 20 | it "generates assets" do 21 | files = Dir["output/*"] 22 | 23 | File.directory?("output/images").should be_true 24 | File.directory?("output/javascripts").should be_true 25 | File.directory?("output/stylesheets").should be_true 26 | File.file?("output/javascripts/guides.js").should be_true 27 | File.file?("output/stylesheets/main.css").should be_true 28 | File.file?("output/stylesheets/overrides.style.css").should be_true 29 | end 30 | 31 | it "does nothing if run twice in a row" do 32 | guides "build" 33 | out.should be_blank 34 | end 35 | 36 | it "re-runs if run with --clean" do 37 | guides "build", "--clean" 38 | out.should == "Generating article_one.html\nGenerating article_three.html\n" + 39 | "Generating article_two.html\nGenerating contribute.html\nGenerating credits.html\nGenerating index.html\n" 40 | end 41 | 42 | it "creates index.html" do 43 | index = File.read("output/index.html") 44 | index.should =~ /<a href="article_one.html">/ 45 | # Test _sections.html.erb with .html.erb templates 46 | index.should =~ /This work is licensed under/ 47 | end 48 | 49 | it "should not show under-construction articles in index" do 50 | File.read("output/index.html").should_not =~ /<a href="article_four.html">/ 51 | end 52 | 53 | it "creates contribute.html" do 54 | contribute = File.read("output/contribute.html") 55 | contribute.should =~ /<h2>Contribute<\/h2>/ 56 | # Test _sections.html.erb with .textile templates 57 | contribute.should =~ /This work is licensed under/ 58 | end 59 | 60 | it "creates normal article" do 61 | article_one = File.read("output/article_one.html") 62 | article_one.should =~ /<h2>Article One<\/h2>/ 63 | end 64 | 65 | it "creates markdown article" do 66 | article_two = File.read("output/article_two.html") 67 | article_two.should =~ /<h2[^>]*>Article Two<\/h2>/ 68 | end 69 | 70 | it "does not create under-construction article" do 71 | File.exist?("output/article_four.html").should be_false 72 | end 73 | 74 | end 75 | 76 | describe "development" do 77 | 78 | before(:all) do 79 | reset_tmp 80 | guides "new", "sample" and wait 81 | copy_fixtures 82 | Dir.chdir tmp.join("sample") 83 | guides "build", "--production=false" and wait 84 | end 85 | 86 | it "generates the app" do 87 | out.should == "Generating article_four.html\nGenerating article_one.html\nGenerating article_three.html\n" + 88 | "Generating article_two.html\nGenerating contribute.html\nGenerating credits.html\nGenerating index.html\n" 89 | end 90 | 91 | it "should show under-construction articles in index" do 92 | File.read("staging/index.html").should =~ /<a href="article_four.html">/ 93 | end 94 | 95 | it "creates under construction article" do 96 | article_four = File.read("staging/article_four.html") 97 | article_four.should =~ /<h2>Article Four<\/h2>/ 98 | end 99 | 100 | end 101 | 102 | end 103 | 104 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter { 18 | background-color: white !important; 19 | } 20 | .syntaxhighlighter .line.alt1 { 21 | background-color: white !important; 22 | } 23 | .syntaxhighlighter .line.alt2 { 24 | background-color: white !important; 25 | } 26 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 27 | background-color: #c3defe !important; 28 | } 29 | .syntaxhighlighter .line.highlighted.number { 30 | color: white !important; 31 | } 32 | .syntaxhighlighter table caption { 33 | color: black !important; 34 | } 35 | .syntaxhighlighter .gutter { 36 | color: #787878 !important; 37 | } 38 | .syntaxhighlighter .gutter .line { 39 | border-right: 3px solid #d4d0c8 !important; 40 | } 41 | .syntaxhighlighter .gutter .line.highlighted { 42 | background-color: #d4d0c8 !important; 43 | color: white !important; 44 | } 45 | .syntaxhighlighter.printing .line .content { 46 | border: none !important; 47 | } 48 | .syntaxhighlighter.collapsed { 49 | overflow: visible !important; 50 | } 51 | .syntaxhighlighter.collapsed .toolbar { 52 | color: #3f5fbf !important; 53 | background: white !important; 54 | border: 1px solid #d4d0c8 !important; 55 | } 56 | .syntaxhighlighter.collapsed .toolbar a { 57 | color: #3f5fbf !important; 58 | } 59 | .syntaxhighlighter.collapsed .toolbar a:hover { 60 | color: #aa7700 !important; 61 | } 62 | .syntaxhighlighter .toolbar { 63 | color: #a0a0a0 !important; 64 | background: #d4d0c8 !important; 65 | border: none !important; 66 | } 67 | .syntaxhighlighter .toolbar a { 68 | color: #a0a0a0 !important; 69 | } 70 | .syntaxhighlighter .toolbar a:hover { 71 | color: red !important; 72 | } 73 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 74 | color: black !important; 75 | } 76 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 77 | color: #3f5fbf !important; 78 | } 79 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 80 | color: #2a00ff !important; 81 | } 82 | .syntaxhighlighter .keyword { 83 | color: #7f0055 !important; 84 | } 85 | .syntaxhighlighter .preprocessor { 86 | color: #646464 !important; 87 | } 88 | .syntaxhighlighter .variable { 89 | color: #aa7700 !important; 90 | } 91 | .syntaxhighlighter .value { 92 | color: #009900 !important; 93 | } 94 | .syntaxhighlighter .functions { 95 | color: #ff1493 !important; 96 | } 97 | .syntaxhighlighter .constants { 98 | color: #0066cc !important; 99 | } 100 | .syntaxhighlighter .script { 101 | font-weight: bold !important; 102 | color: #7f0055 !important; 103 | background-color: none !important; 104 | } 105 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 106 | color: gray !important; 107 | } 108 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 109 | color: #ff1493 !important; 110 | } 111 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 112 | color: red !important; 113 | } 114 | 115 | .syntaxhighlighter .keyword { 116 | font-weight: bold !important; 117 | } 118 | .syntaxhighlighter .xml .keyword { 119 | color: #3f7f7f !important; 120 | font-weight: normal !important; 121 | } 122 | .syntaxhighlighter .xml .color1, .syntaxhighlighter .xml .color1 a { 123 | color: #7f007f !important; 124 | } 125 | .syntaxhighlighter .xml .string { 126 | font-style: italic !important; 127 | color: #2a00ff !important; 128 | } 129 | -------------------------------------------------------------------------------- /lib/guides/templates/source/layout.html.erb: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 | 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 5 | <head> 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 7 | 8 | <title><%= yield(:page_title) %> 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | <% if @edge %> 21 |
22 | edge-badge 23 |
24 | <% end %> 25 |
26 |
27 | <%= yield :top_nav %> 28 |
29 |
30 | 47 |
48 | 49 |
50 |
51 | <% if header_section = yield(:header_section).presence %> 52 | <%= header_section %> 53 | <% else %> 54 |

<%= Guides.meta["title"] %>

55 |

<%= Guides.meta["description"] %>

56 | <% end %> 57 | <% if index_items = yield(:index_items).presence %> 58 |
59 |

Chapters

60 |
    61 | <%= index_items %> 62 |
63 |
64 | <% else %> 65 | <% if sidebar = yield(:sidebar).presence %> 66 |
67 | <%= sidebar %> 68 |
69 | <% end %> 70 | <% end %> 71 |
72 |
73 | 74 |
75 |
76 |
77 | <%= yield %> 78 |
79 |
80 |
81 | 82 |
83 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributes by B.v.Zanten, Getronics 25 | // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro 26 | 27 | var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' + 28 | 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' + 29 | 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' + 30 | 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' + 31 | 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' + 32 | 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' + 33 | 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' + 34 | 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' + 35 | 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' + 36 | 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' + 37 | 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' + 38 | 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' + 39 | 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' + 40 | 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' + 41 | 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' + 42 | 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' + 43 | 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' + 44 | 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' + 45 | 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' + 46 | 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' + 47 | 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning'; 48 | var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' + 49 | 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' + 50 | 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' + 51 | 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' + 52 | 'spps spsv sv tee cat cd cp h history kill lp ls ' + 53 | 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' + 54 | 'erase rd ren type % \\?'; 55 | 56 | this.regexList = [ 57 | { regex: /#.*$/gm, css: 'comments' }, // one line comments 58 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1 59 | { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq 60 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 61 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 62 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' }, 63 | { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' } 64 | ]; 65 | }; 66 | 67 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 68 | Brush.aliases = ['powershell', 'ps']; 69 | 70 | SyntaxHighlighter.brushes.PowerShell = Brush; 71 | 72 | // CommonJS 73 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 74 | })(); 75 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/images/construction.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | image/svg+xml -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushPhp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | var funcs = 'abs acos acosh addcslashes addslashes ' + 25 | 'array_change_key_case array_chunk array_combine array_count_values array_diff '+ 26 | 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+ 27 | 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+ 28 | 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+ 29 | 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+ 30 | 'array_push array_rand array_reduce array_reverse array_search array_shift '+ 31 | 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+ 32 | 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+ 33 | 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+ 34 | 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+ 35 | 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+ 36 | 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+ 37 | 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+ 38 | 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+ 39 | 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+ 40 | 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+ 41 | 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+ 42 | 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+ 43 | 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+ 44 | 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+ 45 | 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+ 46 | 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+ 47 | 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+ 48 | 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+ 49 | 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+ 50 | 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+ 51 | 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+ 52 | 'parse_ini_file parse_str parse_url passthru pathinfo print readlink realpath rewind rewinddir rmdir '+ 53 | 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+ 54 | 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+ 55 | 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+ 56 | 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+ 57 | 'strtoupper strtr strval substr substr_compare'; 58 | 59 | var keywords = 'abstract and array as break case catch cfunction class clone const continue declare default die do ' + 60 | 'else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach ' + 61 | 'function include include_once global goto if implements interface instanceof namespace new ' + 62 | 'old_function or private protected public return require require_once static switch ' + 63 | 'throw try use var while xor '; 64 | 65 | var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__'; 66 | 67 | this.regexList = [ 68 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 69 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 70 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 71 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 72 | { regex: /\$\w+/g, css: 'variable' }, // variables 73 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions 74 | { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants 75 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword 76 | ]; 77 | 78 | this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); 79 | }; 80 | 81 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 82 | Brush.aliases = ['php']; 83 | 84 | SyntaxHighlighter.brushes.Php = Brush; 85 | 86 | // CommonJS 87 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 88 | })(); 89 | -------------------------------------------------------------------------------- /spec/textile_transformer_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe "Transformer" do 4 | before do 5 | @transformer = Guides::TextileTransformer.new(true) 6 | @dev_transformer = Guides::TextileTransformer.new 7 | end 8 | 9 | it "handles regular textile" do 10 | @transformer.transform("h1. foo\n\nbar").should == "

foo

\n

bar

\n" 11 | end 12 | 13 | it "handles " do 14 | result = @transformer.transform("h1. foo\n\n+foo*bar*baz is +") 15 | result.should == "

foo

\nfoo*bar*baz is <bat>\n" 16 | end 17 | 18 | it "handles " do 19 | result = @transformer.transform("h1. foo\n\nHi there.\n\nSC.Object.extend({\n foo: function() {\n return foo < bar && baz\n }\n})") 20 | result.should == %{

foo

\n

Hi there.

\n
\n
\n} +
21 |                      %{SC.Object.extend({\n  foo: function() {\n    return foo < bar && baz\n  }\n})
\n} 22 | end 23 | 24 | it "handles with a filename" do 25 | result = @transformer.transform("h1. foo\n\nHi there.\n\nSC.Object.extend({\n foo: function() {\n return foo < bar && baz\n }\n})") 26 | result.should == %{

foo

\n

Hi there.

\n
\n
fake.js
\n} + 27 | %{
\n} +
28 |                      %{SC.Object.extend({\n  foo: function() {\n    return foo < bar && baz\n  }\n})
\n} 29 | end 30 | 31 | it "handles " do 32 | result = @transformer.transform("h1. foo\n\nHi there.\n\nclass Foo < Bar\n def foo\n bar && baz\n end\nend") 33 | result.should == %{

foo

\n

Hi there.

\n
\n
\n} +
34 |       %{class Foo < Bar\n  def foo\n    bar && baz\n  end\nend
\n} 35 | end 36 | 37 | it "handles " do 38 | result = @transformer.transform("h1. foo\n\nHi there.\n\n
<%= ohai %>
") 39 | result.should == %{

foo

\n

Hi there.

\n
\n
\n} +
40 |       %{<div><%= ohai %></div>
\n} 41 | end 42 | 43 | it "handles " do 44 | result = @transformer.transform("h1. foo\n\nHi there.\n\n$ foo && bar") 45 | result.should == %{

foo

\n

Hi there.

\n
\n
\n} +
46 |       %{$ foo && bar
\n} 47 | end 48 | 49 | it "handles " do 50 | result = @transformer.transform("h1. foo\n\nHi there.\n\nbody { color: red; };\na { color: blue; }") 51 | result.should == %{

foo

\n

Hi there.

\n
\n} + 52 | %{
\n} +
53 |                       %{body { color: red; };\na { color: blue; }
\n} 54 | end 55 | 56 | it "handles NOTE:" do 57 | result = @transformer.transform("h1. foo\n\nHi there.\n\nNOTE: Some note\nmore of *the same* note\n\nAnother paragraph") 58 | result.should == %{

foo

\n

Hi there.

\n

Some note more of the same note

\n} + 59 | %{

Another paragraph

\n} 60 | end 61 | 62 | it "does not convert single line breaks to
" do 63 | @transformer.transform("This\nhas\nbreaks.").should == "

This has breaks.

\n" 64 | @transformer.transform("This\nhas\nbreaks.\n\nAnd\nparagraphs.").should == "

This has breaks.

\n

And paragraphs.

\n" 65 | end 66 | 67 | it "properly handles more than two line breaks" do 68 | result = @transformer.transform("TIP: With \"link\":file.html.\n\n\nh4. Heading") 69 | result.should == %{\n

With link.

\n

Heading

\n} 70 | 71 | result = @transformer.transform("Test\n\n\nh4. Heading") 72 | result.should =="

Test

\n

Heading

\n" 73 | end 74 | 75 | it "handles single line returns outside of paragraphs" do 76 | @transformer.transform("* One\n* Two\n* Three").should == "
    \n\t
  • One
  • \n\t
  • Two
  • \n\t
  • Three
  • \n
\n" 77 | end 78 | 79 | it "handles " do 80 | str = "Testing this out. Write more\nhere later. This is awesome.\n" 81 | @transformer.transform(str).should == "

Testing this out. This is awesome.

\n" 82 | @dev_transformer.transform(str).should == "

Testing this out. Write more here later. This is awesome.

\n" 83 | 84 | str = "Before\n\nBlah\n\nAfter" 85 | @transformer.transform(str).should == "

Before

\n

After

\n" 86 | @dev_transformer.transform(str).should == "

Before

\n

Blah

\n

After

\n" 87 | 88 | @dev_transformer.transform("+Test+").should == "Test\n" 89 | end 90 | 91 | it "handles +" do 92 | @transformer.transform("This +is a+ test.").should == "

This is a test.

\n" 93 | @transformer.transform("This +is+ a +test+.").should == "

This is a test.

\n" 94 | @transformer.transform("This +is a test.").should == "

This +is a test.

\n" 95 | @transformer.transform("This + is + a + test.").should == "

This + is + a + test.

\n" 96 | end 97 | 98 | end 99 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushCpp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Copyright 2006 Shin, YoungJin 25 | 26 | var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' + 27 | 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' + 28 | 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' + 29 | 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' + 30 | 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' + 31 | 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' + 32 | 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' + 33 | 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' + 34 | 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' + 35 | 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' + 36 | 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' + 37 | 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' + 38 | 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' + 39 | 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' + 40 | 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' + 41 | 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' + 42 | 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' + 43 | 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' + 44 | 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' + 45 | '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' + 46 | 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' + 47 | 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' + 48 | 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' + 49 | 'va_list wchar_t wctrans_t wctype_t wint_t signed'; 50 | 51 | var keywords = 'break case catch class const __finally __exception __try ' + 52 | 'const_cast continue private public protected __declspec ' + 53 | 'default delete deprecated dllexport dllimport do dynamic_cast ' + 54 | 'else enum explicit extern if for friend goto inline ' + 55 | 'mutable naked namespace new noinline noreturn nothrow ' + 56 | 'register reinterpret_cast return selectany ' + 57 | 'sizeof static static_cast struct switch template this ' + 58 | 'thread throw true false try typedef typeid typename union ' + 59 | 'using uuid virtual void volatile whcar_t while'; 60 | 61 | var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' + 62 | 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' + 63 | 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' + 64 | 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' + 65 | 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' + 66 | 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' + 67 | 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' + 68 | 'fwrite getc getchar gets perror printf putc putchar puts remove ' + 69 | 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' + 70 | 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' + 71 | 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' + 72 | 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' + 73 | 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' + 74 | 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' + 75 | 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' + 76 | 'clock ctime difftime gmtime localtime mktime strftime time'; 77 | 78 | this.regexList = [ 79 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 80 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 81 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 82 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 83 | { regex: /^ *#.*/gm, css: 'preprocessor' }, 84 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' }, 85 | { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' }, 86 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' } 87 | ]; 88 | }; 89 | 90 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 91 | Brush.aliases = ['cpp', 'c']; 92 | 93 | SyntaxHighlighter.brushes.Cpp = Brush; 94 | 95 | // CommonJS 96 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 97 | })(); 98 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushCss.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function getKeywordsCSS(str) 25 | { 26 | return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; 27 | }; 28 | 29 | function getValuesCSS(str) 30 | { 31 | return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; 32 | }; 33 | 34 | var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + 35 | 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + 36 | 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + 37 | 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + 38 | 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + 39 | 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + 40 | 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + 41 | 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + 42 | 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + 43 | 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + 44 | 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + 45 | 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + 46 | 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + 47 | 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; 48 | 49 | var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ 50 | 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ 51 | 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+ 52 | 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ 53 | 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ 54 | 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ 55 | 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ 56 | 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ 57 | 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ 58 | 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ 59 | 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ 60 | 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ 61 | 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ 62 | 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; 63 | 64 | var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; 65 | 66 | this.regexList = [ 67 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 68 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 69 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 70 | { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors 71 | { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes 72 | { regex: /!important/g, css: 'color3' }, // !important 73 | { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords 74 | { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values 75 | { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts 76 | ]; 77 | 78 | this.forHtmlScript({ 79 | left: /(<|<)\s*style.*?(>|>)/gi, 80 | right: /(<|<)\/\s*style\s*(>|>)/gi 81 | }); 82 | }; 83 | 84 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 85 | Brush.aliases = ['css']; 86 | 87 | SyntaxHighlighter.brushes.CSS = Brush; 88 | 89 | // CommonJS 90 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 91 | })(); 92 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushSass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | function getKeywordsCSS(str) 25 | { 26 | return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b'; 27 | }; 28 | 29 | function getValuesCSS(str) 30 | { 31 | return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b'; 32 | }; 33 | 34 | var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' + 35 | 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' + 36 | 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' + 37 | 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' + 38 | 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' + 39 | 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' + 40 | 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' + 41 | 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' + 42 | 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' + 43 | 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' + 44 | 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' + 45 | 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' + 46 | 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' + 47 | 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index'; 48 | 49 | var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+ 50 | 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+ 51 | 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+ 52 | 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+ 53 | 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+ 54 | 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+ 55 | 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+ 56 | 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+ 57 | 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+ 58 | 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+ 59 | 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+ 60 | 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+ 61 | 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+ 62 | 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow'; 63 | 64 | var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif'; 65 | 66 | var statements = '!important !default'; 67 | var preprocessor = '@import @extend @debug @warn @if @for @while @mixin @include'; 68 | 69 | var r = SyntaxHighlighter.regexLib; 70 | 71 | this.regexList = [ 72 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 73 | { regex: r.singleLineCComments, css: 'comments' }, // singleline comments 74 | { regex: r.doubleQuotedString, css: 'string' }, // double quoted strings 75 | { regex: r.singleQuotedString, css: 'string' }, // single quoted strings 76 | { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors 77 | { regex: /\b(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)\b/g, css: 'value' }, // sizes 78 | { regex: /\$\w+/g, css: 'variable' }, // variables 79 | { regex: new RegExp(this.getKeywords(statements), 'g'), css: 'color3' }, // statements 80 | { regex: new RegExp(this.getKeywords(preprocessor), 'g'), css: 'preprocessor' }, // preprocessor 81 | { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords 82 | { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values 83 | { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts 84 | ]; 85 | }; 86 | 87 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 88 | Brush.aliases = ['sass', 'scss']; 89 | 90 | SyntaxHighlighter.brushes.Sass = Brush; 91 | 92 | // CommonJS 93 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 94 | })(); 95 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shCore.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter a, 18 | .syntaxhighlighter div, 19 | .syntaxhighlighter code, 20 | .syntaxhighlighter table, 21 | .syntaxhighlighter table td, 22 | .syntaxhighlighter table tr, 23 | .syntaxhighlighter table tbody, 24 | .syntaxhighlighter table thead, 25 | .syntaxhighlighter table caption, 26 | .syntaxhighlighter textarea { 27 | -moz-border-radius: 0 0 0 0 !important; 28 | -webkit-border-radius: 0 0 0 0 !important; 29 | background: none !important; 30 | border: 0 !important; 31 | bottom: auto !important; 32 | float: none !important; 33 | height: auto !important; 34 | left: auto !important; 35 | line-height: 1.1em !important; 36 | margin: 0 !important; 37 | outline: 0 !important; 38 | overflow: visible !important; 39 | padding: 0 !important; 40 | position: static !important; 41 | right: auto !important; 42 | text-align: left !important; 43 | top: auto !important; 44 | vertical-align: baseline !important; 45 | width: auto !important; 46 | box-sizing: content-box !important; 47 | font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; 48 | font-weight: normal !important; 49 | font-style: normal !important; 50 | font-size: 1em !important; 51 | min-height: inherit !important; 52 | min-height: auto !important; 53 | } 54 | 55 | .syntaxhighlighter { 56 | width: 100% !important; 57 | margin: 1em 0 1em 0 !important; 58 | position: relative !important; 59 | overflow: auto !important; 60 | font-size: 1em !important; 61 | } 62 | .syntaxhighlighter.source { 63 | overflow: hidden !important; 64 | } 65 | .syntaxhighlighter .bold { 66 | font-weight: bold !important; 67 | } 68 | .syntaxhighlighter .italic { 69 | font-style: italic !important; 70 | } 71 | .syntaxhighlighter .line { 72 | white-space: pre !important; 73 | } 74 | .syntaxhighlighter table { 75 | width: 100% !important; 76 | } 77 | .syntaxhighlighter table caption { 78 | text-align: left !important; 79 | padding: .5em 0 0.5em 1em !important; 80 | } 81 | .syntaxhighlighter table td.code { 82 | width: 100% !important; 83 | } 84 | .syntaxhighlighter table td.code .container { 85 | position: relative !important; 86 | } 87 | .syntaxhighlighter table td.code .container textarea { 88 | box-sizing: border-box !important; 89 | position: absolute !important; 90 | left: 0 !important; 91 | top: 0 !important; 92 | width: 100% !important; 93 | height: 100% !important; 94 | border: none !important; 95 | background: white !important; 96 | padding-left: 1em !important; 97 | overflow: hidden !important; 98 | white-space: pre !important; 99 | } 100 | .syntaxhighlighter table td.gutter .line { 101 | text-align: right !important; 102 | padding: 0 0.5em 0 1em !important; 103 | } 104 | .syntaxhighlighter table td.code .line { 105 | padding: 0 1em !important; 106 | } 107 | .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { 108 | padding-left: 0em !important; 109 | } 110 | .syntaxhighlighter.show { 111 | display: block !important; 112 | } 113 | .syntaxhighlighter.collapsed table { 114 | display: none !important; 115 | } 116 | .syntaxhighlighter.collapsed .toolbar { 117 | padding: 0.1em 0.8em 0em 0.8em !important; 118 | font-size: 1em !important; 119 | position: static !important; 120 | width: auto !important; 121 | height: auto !important; 122 | } 123 | .syntaxhighlighter.collapsed .toolbar span { 124 | display: inline !important; 125 | margin-right: 1em !important; 126 | } 127 | .syntaxhighlighter.collapsed .toolbar span a { 128 | padding: 0 !important; 129 | display: none !important; 130 | } 131 | .syntaxhighlighter.collapsed .toolbar span a.expandSource { 132 | display: inline !important; 133 | } 134 | .syntaxhighlighter .toolbar { 135 | position: absolute !important; 136 | right: 1px !important; 137 | top: 1px !important; 138 | width: 11px !important; 139 | height: 11px !important; 140 | font-size: 10px !important; 141 | z-index: 10 !important; 142 | } 143 | .syntaxhighlighter .toolbar span.title { 144 | display: inline !important; 145 | } 146 | .syntaxhighlighter .toolbar a { 147 | display: block !important; 148 | text-align: center !important; 149 | text-decoration: none !important; 150 | padding-top: 1px !important; 151 | } 152 | .syntaxhighlighter .toolbar a.expandSource { 153 | display: none !important; 154 | } 155 | .syntaxhighlighter.ie { 156 | font-size: .9em !important; 157 | padding: 1px 0 1px 0 !important; 158 | } 159 | .syntaxhighlighter.ie .toolbar { 160 | line-height: 8px !important; 161 | } 162 | .syntaxhighlighter.ie .toolbar a { 163 | padding-top: 0px !important; 164 | } 165 | .syntaxhighlighter.printing .line.alt1 .content, 166 | .syntaxhighlighter.printing .line.alt2 .content, 167 | .syntaxhighlighter.printing .line.highlighted .number, 168 | .syntaxhighlighter.printing .line.highlighted.alt1 .content, 169 | .syntaxhighlighter.printing .line.highlighted.alt2 .content { 170 | background: none !important; 171 | } 172 | .syntaxhighlighter.printing .line .number { 173 | color: #bbbbbb !important; 174 | } 175 | .syntaxhighlighter.printing .line .content { 176 | color: black !important; 177 | } 178 | .syntaxhighlighter.printing .toolbar { 179 | display: none !important; 180 | } 181 | .syntaxhighlighter.printing a { 182 | text-decoration: none !important; 183 | } 184 | .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { 185 | color: black !important; 186 | } 187 | .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { 188 | color: #008200 !important; 189 | } 190 | .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { 191 | color: blue !important; 192 | } 193 | .syntaxhighlighter.printing .keyword { 194 | color: #006699 !important; 195 | font-weight: bold !important; 196 | } 197 | .syntaxhighlighter.printing .preprocessor { 198 | color: gray !important; 199 | } 200 | .syntaxhighlighter.printing .variable { 201 | color: #aa7700 !important; 202 | } 203 | .syntaxhighlighter.printing .value { 204 | color: #009900 !important; 205 | } 206 | .syntaxhighlighter.printing .functions { 207 | color: #ff1493 !important; 208 | } 209 | .syntaxhighlighter.printing .constants { 210 | color: #0066cc !important; 211 | } 212 | .syntaxhighlighter.printing .script { 213 | font-weight: bold !important; 214 | } 215 | .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { 216 | color: gray !important; 217 | } 218 | .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { 219 | color: #ff1493 !important; 220 | } 221 | .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { 222 | color: red !important; 223 | } 224 | .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { 225 | color: black !important; 226 | } 227 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // AppleScript brush by David Chambers 25 | // http://davidchambersdesign.com/ 26 | var keywords = 'after before beginning continue copy each end every from return get global in local named of set some that the then times to where whose with without'; 27 | var ordinals = 'first second third fourth fifth sixth seventh eighth ninth tenth last front back middle'; 28 | var specials = 'activate add alias AppleScript ask attachment boolean class constant delete duplicate empty exists false id integer list make message modal modified new no paragraph pi properties quit real record remove rest result reveal reverse run running save string true word yes'; 29 | 30 | this.regexList = [ 31 | 32 | { regex: /(--|#).*$/gm, 33 | css: 'comments' }, 34 | 35 | { regex: /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/gm, // support nested comments 36 | css: 'comments' }, 37 | 38 | { regex: /"[\s\S]*?"/gm, 39 | css: 'string' }, 40 | 41 | { regex: /(?:,|:|¬|'s\b|\(|\)|\{|\}|«|\b\w*»)/g, 42 | css: 'color1' }, 43 | 44 | { regex: /(-)?(\d)+(\.(\d)?)?(E\+(\d)+)?/g, // numbers 45 | css: 'color1' }, 46 | 47 | { regex: /(?:&(amp;|gt;|lt;)?|=|� |>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^)/g, 48 | css: 'color2' }, 49 | 50 | { regex: /\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/g, 51 | css: 'keyword' }, 52 | 53 | { regex: /\b\d+(st|nd|rd|th)\b/g, // ordinals 54 | css: 'keyword' }, 55 | 56 | { regex: /\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/g, 57 | css: 'color3' }, 58 | 59 | { regex: /\b(?:adding folder items to|after receiving|choose( ((remote )?application|color|folder|from list|URL))?|clipboard info|set the clipboard to|(the )?clipboard|entire contents|display(ing| (alert|dialog|mode))?|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|quoted form|return(ed)?|second(?! item)(s)?|list (disks|folder)|text item(s| delimiters)?|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|using( delimiters)?|starting at|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor)|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|(do( shell)?|load|run|store) script|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|POSIX (file|path)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|group|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/g, 60 | css: 'color3' }, 61 | 62 | { regex: new RegExp(this.getKeywords(specials), 'gm'), css: 'color3' }, 63 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 64 | { regex: new RegExp(this.getKeywords(ordinals), 'gm'), css: 'keyword' } 65 | ]; 66 | }; 67 | 68 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 69 | Brush.aliases = ['applescript']; 70 | 71 | SyntaxHighlighter.brushes.AppleScript = Brush; 72 | 73 | // CommonJS 74 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 75 | })(); 76 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | // Contributed by Jen 25 | // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter-plus 26 | 27 | var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' + 28 | 'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' + 29 | 'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' + 30 | 'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' + 31 | 'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' + 32 | 'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' + 33 | 'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' + 34 | 'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' + 35 | 'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' + 36 | 'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' + 37 | 'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' + 38 | 'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' + 39 | 'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' + 40 | 'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' + 41 | 'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' + 42 | 'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' + 43 | 'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' + 44 | 'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' + 45 | 'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' + 46 | 'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' + 47 | 'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' + 48 | 'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' + 49 | 'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' + 50 | 'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' + 51 | 'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' + 52 | 'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' + 53 | 'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' + 54 | 'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' + 55 | 'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' + 56 | 'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' + 57 | 'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' + 58 | 'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' + 59 | 'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' + 60 | 'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' + 61 | 'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' + 62 | 'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' + 63 | 'XmlValidate Year YesNoFormat'; 64 | 65 | var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' + 66 | 'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' + 67 | 'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' + 68 | 'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' + 69 | 'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' + 70 | 'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' + 71 | 'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' + 72 | 'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' + 73 | 'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' + 74 | 'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' + 75 | 'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' + 76 | 'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' + 77 | 'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' + 78 | 'cfwindow cfxml cfzip cfzipparam'; 79 | 80 | var operators = 'all and any between cross in join like not null or outer some'; 81 | 82 | this.regexList = [ 83 | { regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments 84 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings 85 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 86 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 87 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions 88 | { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such 89 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 90 | ]; 91 | } 92 | 93 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 94 | Brush.aliases = ['coldfusion','cf']; 95 | 96 | SyntaxHighlighter.brushes.ColdFusion = Brush; 97 | 98 | // CommonJS 99 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 100 | })(); 101 | -------------------------------------------------------------------------------- /lib/guides/templates/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | .syntaxhighlighter a, 18 | .syntaxhighlighter div, 19 | .syntaxhighlighter code, 20 | .syntaxhighlighter table, 21 | .syntaxhighlighter table td, 22 | .syntaxhighlighter table tr, 23 | .syntaxhighlighter table tbody, 24 | .syntaxhighlighter table thead, 25 | .syntaxhighlighter table caption, 26 | .syntaxhighlighter textarea { 27 | -moz-border-radius: 0 0 0 0 !important; 28 | -webkit-border-radius: 0 0 0 0 !important; 29 | background: none !important; 30 | border: 0 !important; 31 | bottom: auto !important; 32 | float: none !important; 33 | height: auto !important; 34 | left: auto !important; 35 | line-height: 1.1em !important; 36 | margin: 0 !important; 37 | outline: 0 !important; 38 | overflow: visible !important; 39 | padding: 0 !important; 40 | position: static !important; 41 | right: auto !important; 42 | text-align: left !important; 43 | top: auto !important; 44 | vertical-align: baseline !important; 45 | width: auto !important; 46 | box-sizing: content-box !important; 47 | font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important; 48 | font-weight: normal !important; 49 | font-style: normal !important; 50 | font-size: 1em !important; 51 | min-height: inherit !important; 52 | min-height: auto !important; 53 | } 54 | 55 | .syntaxhighlighter { 56 | width: 100% !important; 57 | margin: 1em 0 1em 0 !important; 58 | position: relative !important; 59 | overflow: auto !important; 60 | font-size: 1em !important; 61 | } 62 | .syntaxhighlighter.source { 63 | overflow: hidden !important; 64 | } 65 | .syntaxhighlighter .bold { 66 | font-weight: bold !important; 67 | } 68 | .syntaxhighlighter .italic { 69 | font-style: italic !important; 70 | } 71 | .syntaxhighlighter .line { 72 | white-space: pre !important; 73 | } 74 | .syntaxhighlighter table { 75 | width: 100% !important; 76 | } 77 | .syntaxhighlighter table caption { 78 | text-align: left !important; 79 | padding: .5em 0 0.5em 1em !important; 80 | } 81 | .syntaxhighlighter table td.code { 82 | width: 100% !important; 83 | } 84 | .syntaxhighlighter table td.code .container { 85 | position: relative !important; 86 | } 87 | .syntaxhighlighter table td.code .container textarea { 88 | box-sizing: border-box !important; 89 | position: absolute !important; 90 | left: 0 !important; 91 | top: 0 !important; 92 | width: 100% !important; 93 | height: 100% !important; 94 | border: none !important; 95 | background: white !important; 96 | padding-left: 1em !important; 97 | overflow: hidden !important; 98 | white-space: pre !important; 99 | } 100 | .syntaxhighlighter table td.gutter .line { 101 | text-align: right !important; 102 | padding: 0 0.5em 0 1em !important; 103 | } 104 | .syntaxhighlighter table td.code .line { 105 | padding: 0 1em !important; 106 | } 107 | .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line { 108 | padding-left: 0em !important; 109 | } 110 | .syntaxhighlighter.show { 111 | display: block !important; 112 | } 113 | .syntaxhighlighter.collapsed table { 114 | display: none !important; 115 | } 116 | .syntaxhighlighter.collapsed .toolbar { 117 | padding: 0.1em 0.8em 0em 0.8em !important; 118 | font-size: 1em !important; 119 | position: static !important; 120 | width: auto !important; 121 | height: auto !important; 122 | } 123 | .syntaxhighlighter.collapsed .toolbar span { 124 | display: inline !important; 125 | margin-right: 1em !important; 126 | } 127 | .syntaxhighlighter.collapsed .toolbar span a { 128 | padding: 0 !important; 129 | display: none !important; 130 | } 131 | .syntaxhighlighter.collapsed .toolbar span a.expandSource { 132 | display: inline !important; 133 | } 134 | .syntaxhighlighter .toolbar { 135 | position: absolute !important; 136 | right: 1px !important; 137 | top: 1px !important; 138 | width: 11px !important; 139 | height: 11px !important; 140 | font-size: 10px !important; 141 | z-index: 10 !important; 142 | } 143 | .syntaxhighlighter .toolbar span.title { 144 | display: inline !important; 145 | } 146 | .syntaxhighlighter .toolbar a { 147 | display: block !important; 148 | text-align: center !important; 149 | text-decoration: none !important; 150 | padding-top: 1px !important; 151 | } 152 | .syntaxhighlighter .toolbar a.expandSource { 153 | display: none !important; 154 | } 155 | .syntaxhighlighter.ie { 156 | font-size: .9em !important; 157 | padding: 1px 0 1px 0 !important; 158 | } 159 | .syntaxhighlighter.ie .toolbar { 160 | line-height: 8px !important; 161 | } 162 | .syntaxhighlighter.ie .toolbar a { 163 | padding-top: 0px !important; 164 | } 165 | .syntaxhighlighter.printing .line.alt1 .content, 166 | .syntaxhighlighter.printing .line.alt2 .content, 167 | .syntaxhighlighter.printing .line.highlighted .number, 168 | .syntaxhighlighter.printing .line.highlighted.alt1 .content, 169 | .syntaxhighlighter.printing .line.highlighted.alt2 .content { 170 | background: none !important; 171 | } 172 | .syntaxhighlighter.printing .line .number { 173 | color: #bbbbbb !important; 174 | } 175 | .syntaxhighlighter.printing .line .content { 176 | color: black !important; 177 | } 178 | .syntaxhighlighter.printing .toolbar { 179 | display: none !important; 180 | } 181 | .syntaxhighlighter.printing a { 182 | text-decoration: none !important; 183 | } 184 | .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a { 185 | color: black !important; 186 | } 187 | .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a { 188 | color: #008200 !important; 189 | } 190 | .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a { 191 | color: blue !important; 192 | } 193 | .syntaxhighlighter.printing .keyword { 194 | color: #006699 !important; 195 | font-weight: bold !important; 196 | } 197 | .syntaxhighlighter.printing .preprocessor { 198 | color: gray !important; 199 | } 200 | .syntaxhighlighter.printing .variable { 201 | color: #aa7700 !important; 202 | } 203 | .syntaxhighlighter.printing .value { 204 | color: #009900 !important; 205 | } 206 | .syntaxhighlighter.printing .functions { 207 | color: #ff1493 !important; 208 | } 209 | .syntaxhighlighter.printing .constants { 210 | color: #0066cc !important; 211 | } 212 | .syntaxhighlighter.printing .script { 213 | font-weight: bold !important; 214 | } 215 | .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a { 216 | color: gray !important; 217 | } 218 | .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a { 219 | color: #ff1493 !important; 220 | } 221 | .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a { 222 | color: red !important; 223 | } 224 | .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a { 225 | color: black !important; 226 | } 227 | 228 | .syntaxhighlighter { 229 | background-color: black !important; 230 | } 231 | .syntaxhighlighter .line.alt1 { 232 | background-color: black !important; 233 | } 234 | .syntaxhighlighter .line.alt2 { 235 | background-color: black !important; 236 | } 237 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 238 | background-color: #2a3133 !important; 239 | } 240 | .syntaxhighlighter .line.highlighted.number { 241 | color: white !important; 242 | } 243 | .syntaxhighlighter table caption { 244 | color: #d3d3d3 !important; 245 | } 246 | .syntaxhighlighter .gutter { 247 | color: #d3d3d3 !important; 248 | } 249 | .syntaxhighlighter .gutter .line { 250 | border-right: 3px solid #990000 !important; 251 | } 252 | .syntaxhighlighter .gutter .line.highlighted { 253 | background-color: #990000 !important; 254 | color: black !important; 255 | } 256 | .syntaxhighlighter.printing .line .content { 257 | border: none !important; 258 | } 259 | .syntaxhighlighter.collapsed { 260 | overflow: visible !important; 261 | } 262 | .syntaxhighlighter.collapsed .toolbar { 263 | color: #ebdb8d !important; 264 | background: black !important; 265 | border: 1px solid #990000 !important; 266 | } 267 | .syntaxhighlighter.collapsed .toolbar a { 268 | color: #ebdb8d !important; 269 | } 270 | .syntaxhighlighter.collapsed .toolbar a:hover { 271 | color: #ff7d27 !important; 272 | } 273 | .syntaxhighlighter .toolbar { 274 | color: white !important; 275 | background: #990000 !important; 276 | border: none !important; 277 | } 278 | .syntaxhighlighter .toolbar a { 279 | color: white !important; 280 | } 281 | .syntaxhighlighter .toolbar a:hover { 282 | color: #9ccff4 !important; 283 | } 284 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 285 | color: #d3d3d3 !important; 286 | } 287 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 288 | color: #ff7d27 !important; 289 | } 290 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 291 | color: #ff9e7b !important; 292 | } 293 | .syntaxhighlighter .keyword { 294 | color: aqua !important; 295 | } 296 | .syntaxhighlighter .preprocessor { 297 | color: #aec4de !important; 298 | } 299 | .syntaxhighlighter .variable { 300 | color: #ffaa3e !important; 301 | } 302 | .syntaxhighlighter .value { 303 | color: #009900 !important; 304 | } 305 | .syntaxhighlighter .functions { 306 | color: #81cef9 !important; 307 | } 308 | .syntaxhighlighter .constants { 309 | color: #ff9e7b !important; 310 | } 311 | .syntaxhighlighter .script { 312 | font-weight: bold !important; 313 | color: aqua !important; 314 | background-color: none !important; 315 | } 316 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 317 | color: #ebdb8d !important; 318 | } 319 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 320 | color: #ff7d27 !important; 321 | } 322 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 323 | color: #aec4de !important; 324 | } 325 | --------------------------------------------------------------------------------