Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

makeup

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

makeup - rubygems Package Compare versions

Comparing version
0.3.0
to
0.4.0
+2
.gitignore
coverage
test/reports
language: ruby
rvm:
- 1.9.3
- rbx-18mode
- rbx-19mode
- 1.8.7
- ree
# encoding: utf-8
# --
# The MIT License (MIT)
#
# Copyright (C) 2013 Gitorious AS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#++
module Makeup
VERSION = "0.4.0"
end
+4
-0
source "http://rubygems.org"
gemspec
gem "ci_reporter"
gem "rcov", :platforms => :ruby_18
gem "simplecov", :platforms => :ruby_19
PATH
remote: .
specs:
makeup (0.3.0)
makeup (0.4.0)
github-linguist (~> 2.8)
github-markup (~> 0.7)
htmlentities (~> 4.3)
pygments.rb (~> 0.2)
pygments.rb (~> 0.4)

@@ -12,11 +13,28 @@ GEM

specs:
github-markup (0.7.4)
builder (3.2.2)
charlock_holmes (0.6.9.4)
ci_reporter (1.9.0)
builder (>= 2.1.2)
escape_utils (0.3.2)
github-linguist (2.8.5)
charlock_holmes (~> 0.6.6)
escape_utils (~> 0.3.1)
mime-types (~> 1.19)
pygments.rb (~> 0.4.2)
github-markup (0.7.5)
htmlentities (4.3.1)
mime-types (1.23)
minitest (2.12.1)
multi_json (1.7.7)
posix-spawn (0.3.6)
pygments.rb (0.3.2)
pygments.rb (0.4.2)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rake (0.9.2.2)
rcov (1.0.0)
redcarpet (2.2.0)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
yajl-ruby (1.1.0)

@@ -28,5 +46,8 @@

DEPENDENCIES
ci_reporter
makeup!
minitest (~> 2.0)
rake (~> 0.9)
rcov
redcarpet (= 2.2.0)
simplecov
+4
-6
# encoding: utf-8
# --
# The MIT License (MIT)
# Christian Johansen
#
# Copyright (C) 2012 Gitorious AS
# Copyright (C) 2013 Gitorious AS
#

@@ -25,7 +26,4 @@ # Permission is hereby granted, free of charge, to any person obtaining a copy

#++
require "makeup/markup"
require "makeup/version"
require "makeup/syntax_highlighter"
module Makeup
VERSION = "0.3.0"
end
require "makeup/syntax_highlighter"

@@ -27,2 +27,3 @@ # encoding: utf-8

require "htmlentities"
require "linguist"

@@ -40,4 +41,4 @@ module Makeup

lexer = Pygments::Lexer.find(options[:lexer])
CodeBlock.new(lexer && lexer.aliases.first,
Pygments.highlight(code, highlight_options(options)))
code = lexer.nil? ? code : Pygments.highlight(code, highlight_options(options))
CodeBlock.new(lexer && lexer.aliases.first, code)
rescue MentosError => e

@@ -49,33 +50,11 @@ # "MentosError" is what Pyments.rb raises when an unknown lexer is

def lexer(path, code = nil)
self.class.lexer(path.split(".").pop, code)
def lexer(path, code = nil, mode = nil)
self.class.lexer(path, code, mode)
end
def self.lexer(suffix, code = nil)
return @@lexer_aliases[suffix] if @@lexer_aliases[suffix]
lexer = Pygments::Lexer.find_by_extname(".#{suffix}")
return lexer.aliases.first || lexer.name if lexer
shebang_language(shebang(code)) || suffix
def self.lexer(path, code = nil, mode = nil)
lexer = Linguist::Language.detect(path, code, mode)
lexer && (lexer.aliases.first || lexer.name)
end
def self.shebang(code)
first_line = (code || "").split("\n")[0]
first_line =~ /^#!/ ? first_line : nil
end
def self.shebang_language(shebang)
shebang = @@lexer_shebangs.find { |s| (shebang || "") =~ s[:pattern] }
shebang && shebang[:lexer]
end
def self.add_lexer_alias(extension, lexer)
@@lexer_aliases ||= {}
@@lexer_aliases[extension] = lexer
end
def self.add_lexer_shebang(pattern, lexer)
@@lexer_shebangs ||= []
@@lexer_shebangs << { :pattern => pattern, :lexer => lexer }
end
private

@@ -90,9 +69,1 @@ def highlight_options(options = {})

end
Makeup::SyntaxHighlighter.add_lexer_alias("txt", "text")
Makeup::SyntaxHighlighter.add_lexer_alias("ru", "rb")
Makeup::SyntaxHighlighter.add_lexer_alias("Rakefile", "rb")
Makeup::SyntaxHighlighter.add_lexer_alias("Gemfile", "rb")
Makeup::SyntaxHighlighter.add_lexer_alias("Gemfile.lock", "yaml")
Makeup::SyntaxHighlighter.add_lexer_shebang(/\bruby\b/, "rb")
# -*- encoding: utf-8 -*-
dir = File.expand_path(File.dirname(__FILE__))
require File.join(dir, "lib", "makeup")
require File.join(dir, "lib", "makeup/version.rb")

@@ -20,3 +20,4 @@ Gem::Specification.new do |s|

s.add_dependency "pygments.rb", "~>0.2"
s.add_dependency "pygments.rb", "~>0.4"
s.add_dependency "github-linguist", "~>2.8"
s.add_dependency "github-markup", "~> 0.7"

@@ -23,0 +24,0 @@ s.add_dependency "htmlentities", "~> 4.3"

require "rake/testtask"
require "ci/reporter/rake/minitest"
require "bundler/gem_tasks"
Rake::TestTask.new("test") do |test|
test.libs << "lib"
test.libs << "test"

@@ -10,2 +12,11 @@ test.pattern = "test/**/*_test.rb"

if RUBY_VERSION < "1.9"
require "rcov/rcovtask"
Rcov::RcovTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/**/*_test.rb"]
t.rcov_opts += %w{--exclude gems,ruby/1.}
end
end
task :default => :test
# Makeup
<a href="http://travis-ci.org/cjohansen/makeup" class="travis">
<img src="https://secure.travis-ci.org/cjohansen/makeup.png">
</a>
Makeup provides markup rendering and syntax highlighting in one glorious

@@ -4,0 +8,0 @@ package. It can also syntax highlight "fenced code blocks" in markdown files.

@@ -66,3 +66,3 @@ # encoding: utf-8

end
describe "#render" do

@@ -91,3 +91,3 @@ it "should detect end of code blocks properly" do

MD
assert_equal 2, html.scan(/rb/).length

@@ -94,0 +94,0 @@ end

@@ -65,10 +65,2 @@ # encoding: utf-8

it "highlights file with custom suffix" do
Makeup::SyntaxHighlighter.add_lexer_alias("derp", "rb")
html = highlight("file.derp", "class File")
assert_match "<span class=\"k\">class</span>", html
assert_match "<span class=\"nc\">File</span>", html
end
it "skips highlighting if lexer is missing" do

@@ -83,28 +75,5 @@ html = highlight("file.trololol", "Yeah yeah yeah")

it "uses known suffix" do
assert_equal "rb", @highlighter.lexer("file.rb")
assert_equal "ruby", @highlighter.lexer("file.rb")
end
it "uses registered suffix" do
Makeup::SyntaxHighlighter.add_lexer_alias("blarg", "blarg")
assert_equal "blarg", @highlighter.lexer("file.blarg")
end
it "uses registered lexer" do
Makeup::SyntaxHighlighter.add_lexer_alias("bg", "blarg")
assert_equal "blarg", @highlighter.lexer("file.bg")
end
it "uses known shebang" do
assert_equal "rb", @highlighter.lexer("some-binary", "#!/usr/bin/env ruby\n")
end
it "uses registered shebang" do
Makeup::SyntaxHighlighter.add_lexer_shebang(/\bnode\b/, "js")
assert_equal "js", @highlighter.lexer("some-binary", "#!/usr/bin/env node\n")
end
it "uses filename for unknown lexer" do
assert_equal "some-binary", @highlighter.lexer("some-binary", "class Person\nend")
end
end
end

@@ -25,2 +25,7 @@ # encoding: utf-8

#++
if RUBY_VERSION > "1.9"
require "simplecov"
SimpleCov.start
end
require "bundler/setup"

@@ -27,0 +32,0 @@ require "minitest/autorun"