Skip to content

Commit

Permalink
utf-8 rampage
Browse files Browse the repository at this point in the history
  • Loading branch information
http://jneen.net/ committed Jul 13, 2014
1 parent e5c1c24 commit c1c1f1d
Show file tree
Hide file tree
Showing 162 changed files with 330 additions and 15 deletions.
2 changes: 2 additions & 0 deletions lib/rouge.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

# stdlib
require 'pathname'

Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/cli.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

# not required by the main lib.
# to use this module, require 'rouge/cli'.

Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/formatter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
# A Formatter takes a token stream and formats it for human viewing.
class Formatter
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/formatters/html.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

# stdlib
require 'cgi'

Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/formatters/null.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Formatters
# A formatter which renders nothing.
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/formatters/terminal256.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Formatters
# A formatter for 256-color terminals
Expand Down
6 changes: 4 additions & 2 deletions lib/rouge/lexer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

# stdlib
require 'strscan'
require 'cgi'
Expand Down Expand Up @@ -83,7 +85,7 @@ def demo_file(arg=:absent)
def demo(arg=:absent)
return @demo = arg unless arg == :absent

@demo = File.read(demo_file)
@demo = File.read(demo_file, encoding: 'utf-8')
end

# @return a list of all lexers.
Expand Down Expand Up @@ -204,7 +206,7 @@ def best_by_source(lexers, source, threshold=0)
when String
source
when ->(s){ s.respond_to? :read }
source.read
source.read(encoding: 'utf-8')
else
raise 'invalid source'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/apple_script.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# encoding: utf-8
# -*- coding: utf-8 -*- #
module Rouge
module Lexers
class AppleScript < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/c.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class C < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/clojure.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Clojure < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/coffeescript.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Coffeescript < RegexLexer
Expand Down
3 changes: 1 addition & 2 deletions lib/rouge/lexers/common_lisp.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# stdlib
require 'set'
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/conf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Conf < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/cpp.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
load_const :C, 'c.rb'
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/csharp.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class CSharp < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/css.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class CSS < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/diff.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Diff < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/elixir.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
# Direct port of pygments Lexer.
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/erb.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class ERB < TemplateLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/erlang.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Erlang < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/factor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Factor < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/go.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Go < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/groovy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Groovy < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/haml.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
# A lexer for the Haml templating system for Ruby.
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/handlebars.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Handlebars < TemplateLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/haskell.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Haskell < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/html.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class HTML < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/http.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class HTTP < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/ini.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class INI < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/io.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class IO < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/java.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Java < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/javascript.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Javascript < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/literate_coffeescript.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class LiterateCoffeescript < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/literate_haskell.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class LiterateHaskell < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/llvm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class LLVM < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/make.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Make < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/markdown.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Markdown < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/matlab.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Matlab < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/nginx.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Nginx < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/objective_c.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
load_const :C, 'c.rb'
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/ocaml.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class OCaml < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/perl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Perl < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/php.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class PHP < TemplateLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/plain_text.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class PlainText < Lexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/prolog.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Prolog < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/properties.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Properties < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/puppet.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Puppet < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/python.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Python < RegexLexer
Expand Down
4 changes: 3 additions & 1 deletion lib/rouge/lexers/qml.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
load_const :Javascript, 'javascript.rb'
Expand All @@ -21,7 +23,7 @@ class Qml < Javascript
push :type_block
end
end

state :type_block do
rule /(id)(\s*)(:)(\s*)(#{id_with_dots})/ do
groups Name::Label, Text, Punctuation, Text, Keyword::Declaration
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/r.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class R < RegexLexer
Expand Down
2 changes: 1 addition & 1 deletion lib/rouge/lexers/racket.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*- #
module Rouge
module Lexers
class Racket < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Ruby < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/rust.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Rust < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/sass.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
load_const :SassCommon, 'sass/common.rb'
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/sass/common.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
# shared states with SCSS
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/scheme.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Scheme < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/scss.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
load_const :SassCommon, 'sass/common.rb'
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/sed.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Sed < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/shell.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Shell < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/smalltalk.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class Smalltalk < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/sml.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class SML < RegexLexer
Expand Down
2 changes: 2 additions & 0 deletions lib/rouge/lexers/sql.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*- #

module Rouge
module Lexers
class SQL < RegexLexer
Expand Down
Loading

0 comments on commit c1c1f1d

Please sign in to comment.