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

code_rippa

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

code_rippa - rubygems Package Compare versions

Comparing version
0.0.6
to
0.0.7
lib/code_rippa/render/latex/all_hallows_eve_custom.render

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

+2
-0

@@ -7,1 +7,3 @@ .bundle

.DS_Store
*.gem
out.*
+4
-1

@@ -19,4 +19,7 @@ # -*- encoding: utf-8 -*-

gem.required_ruby_version = '>= 1.9.0'
gem.add_dependency "color"
gem.add_dependency "ansi"
gem.add_dependency "language_sniffer"
gem.add_dependency "ptools", "~> 1.2.1"
gem.add_dependency "rainbow"
gem.add_dependency "ansi"
gem.add_dependency "spox-ultraviolet", "~> 0.10.5"

@@ -23,0 +26,0 @@ gem.add_development_dependency "rake"

@@ -5,314 +5,332 @@ require 'find'

require 'ansi/progressbar'
require 'language_sniffer'
require 'rainbow'
require 'color'
require 'ptools'
include ANSI
YAML::ENGINE.yamler = 'syck'
module CodeRippa
@@supported_syntax = nil
@@supported_ext = nil
# Parses the given file, and writes the output file (out.tex)
# into the current directory.
#
# path - The file path
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
# excluded_exts - An Array of extensions to ignore during parsing.
#
# Examples
#
# rip_dir("~/code/ruby/some_folder/some_file.rb", "space_cadet", "ruby", [])
#
# Returns nothing.
def self.rip_file(path, theme, syntax)
begin
srcfile = File.read(path)
src_ext = File.extname(path)[1..-1]
outfile = File.open('out.tex', 'w')
outfile.write preamble theme
outfile.write "\\textcolor{headingcolor}{\\textbf{\\texttt{#{path.gsub('_','\_').gsub('%','\%')}}}}\\\\\n"
outfile.write "\\textcolor{headingcolor}{\\rule{\\linewidth}{1.0mm}}\\\\\n"
outfile.write Uv.parse(srcfile, 'latex', syntax, true, theme)
outfile.write endtag
msg = "Completed successfully.\n".color(:green)
msg << "Output file written to: "
msg << "#{File.expand_path(outfile)}\n".color(:yellow)
msg << "Now run "
msg << "pdflatex -interaction=batchmode #{File.expand_path(outfile)} ".color(:red)
msg << "** TWICE ** to generate PDF."
puts msg
outfile.close
rescue Exception => e
puts e
end
end
MAX_WIDTH = 120
@@supported_syntax = nil
@@supported_ext = nil
# main entry point:
# Parses the given directory/file, and writes the output file (out.tex)
# into the current directory.
#
# path - The directory path
# theme - The selected theme
#
# Examples
#
# parse("~/code/ruby/some_folder_or_file", "space_cadet")
#
# Returns nothing
def self.parse(path, theme)
# logfile = File.open('code_rippa.log', 'w')
output = ""
if FileTest.file?(path)
output = parse_file(path, theme)
else
pbar = Progressbar.new("Rippin'", Dir["**/*"].length)
counter = 0
# Parses the given directory, and writes the output file (out.tex)
# into the current directory.
#
# dir_path - The directory path
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
# excluded_exts - An Array of extensions to ignore during parsing.
#
# Examples
#
# rip_dir("~/code/ruby/some_folder", "space_cadet", "ruby", [])
#
# Returns nothing.
def self.rip_dir(dir_path, theme, syntax, excluded_exts = [])
pbar = Progressbar.new("Rippin'".color(:blue), Dir["**/*"].length)
counter = 0
outfile = File.open('out.tex', 'w')
outfile.write preamble theme
Find.find dir_path do |path|
depth = path.to_s.count('/')
if File.basename(path)[0] == ?. or File.basename(path) == "out.tex"
Find.prune
else
begin
is_rippable = rippable?(path, syntax, excluded_exts)
if is_rippable
outfile.write "\\textcolor{white}{\\textbf{\\texttt{#{path.gsub('_','\_').gsub('%','\%')}}}}\\\\\n"
outfile.write "\\textcolor{white}{\\rule{\\linewidth}{1.0mm}}\\\\\n"
end
if bookmarkable?(path, syntax, excluded_exts)
outfile.write "\\pdfbookmark[#{depth-2}]{#{File.basename(path).gsub('_','\_').gsub('%','\%')}}{#{counter}}\n"
end
if is_rippable
outfile.write Uv.parse(File.read(path), 'latex', syntax, true, theme)
outfile.write "\\clearpage\n"
end
rescue Exception => e
puts e
end
counter += 1
end
pbar.inc
end
outfile.write endtag
pbar.finish
msg = "Completed successfully.\n".color(:green)
msg << "Output file written to: "
msg << "#{File.expand_path(outfile)}\n".color(:yellow)
msg << "Now run "
msg << "pdflatex -interaction=batchmode #{File.expand_path(outfile)} ".color(:red)
msg << "** TWICE ** to generate PDF."
puts msg
outfile.close
end
private
def self.syntax_path
Uv.syntax_path
end
# Returns an Array of supported syntaxes. This is done by parsing
# all the file names in the syntax folder.
#
# Examples
#
# supported_syntax
# # => ['ruby','prolog']
#
# Returns an Array of supported syntaxes
def self.supported_syntax
if @@supported_syntax
@@supported_syntax
else
@@supported_syntax = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
@@supported_syntax << File.basename(f, '.*')
end
end
@@supported_syntax
end
end
# Returns an Array of supported languages. This is done by parsing
# all the file names in the syntax folder.
#
# Examples
#
# supported_langs
# # => ['Ruby','Prolog']
#
# Returns an Array of supported languages
def self.supported_langs
langs = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
y = YAML.load(File.read "#{syntax_path}/#{f}")
langs << y["name"] if y["name"]
end
end
langs
end
# Returns an Array of file extensions that is supported by code_rippa
#
# Examples
#
# supported_langs
# # => ['rb', 'Gemfile', 'erb']
#
# Returns an Array of supported extensions.
def self.supported_exts
if @@supported_ext
@@supported_ext
else
@@supported_ext = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
y = YAML.load(File.read "#{syntax_path}/#{f}")
@@supported_ext += y["fileTypes"] if y["fileTypes"]
end
end
@@supported_ext
end
end
Find.find path do |p|
# logfile << "Parsing: #{p}\n"
depth = p.to_s.count('/')
# Returns True if path should be bookmarked in the output TEX/PDF document.
#
# path - The file/directory path
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
# excluded_exts - An Array of extensions to ignore during parsing.
#
#
# Examples
#
# bookmarkable?("hello.rb", "ruby", [])
# # => true
#
# bookmarkable?("hello.rb", "ruby", ["rb", "html"])
# # => false
#
# bookmarkable?("hello.klingon", "klingon", [])
# # => false
#
# Returns True if path should be bookmarked.
def self.bookmarkable?(path, syntax, excluded_exts)
if FileTest.directory?(path)
true
else
src_ext = File.extname(path)[1..-1]
if File.basename(path) == "out.tex"
false
elsif excluded_exts.include?(src_ext)
false
elsif supported_exts.include?(src_ext)
true
else
false
end
end
end
# Returns True if path should be ripped as part of the output TEX file.
#
# path - The file. (directories will return false.)
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
# excluded_exts - An Array of extensions to ignore during parsing.
#
#
# Examples
#
# rippable?("hello.rb", "ruby", [])
# # => true
#
# rippable?("~/code/", "ruby", [])
# # => false
#
# rippable?("hello.rb", "ruby", ["rb", "html"])
# # => false
#
# rippable?("hello.klingon", "klingon", [])
# # => false
#
# Returns true if path should be ripped.
def self.rippable?(path, syntax, excluded_exts)
if FileTest.directory?(path)
false
else
src_ext = File.extname(path)[1..-1]
if excluded_exts.include? src_ext
false
elsif supported_exts.include?(src_ext)
true
else
false
end
end
end
if File.basename(p)[0] == ?.
Find.prune
else
output << bookmark(p, depth, counter) if bookmarkable?(p, source_syntax(p))
begin
output << parse_file(p, theme)
rescue Exception => e
# logfile << "* Failed: #{p}\n"
end
end
counter += 1
pbar.inc
end
pbar.finish
end
outfile = File.open('out.tex', 'w')
output = preamble(theme) << output << postscript
outfile.write output
outfile.close
# Run the 'pdflatex' command
puts "=================================================="
if pdflatex_installed?
puts "pdflatex found!. Converting TeX -> PDF".color(:green)
puts "Compiling [1/2]"
`pdflatex -interaction=batchmode #{File.expand_path(outfile)}`
puts "Compiling [2/2]"
`pdflatex -interaction=batchmode #{File.expand_path(outfile)}`
# Returns the hex color code of the page color. This is done by looking at
# the *.render file of the selected theme.
#
# theme - The selected theme.
#
# Examples
#
# page_color('moc')
# # => "E8E8E8"
#
# Returns an String containing the hex color code of the page.
def self.page_color(theme)
f = YAML.load(File.read("#{Uv.render_path}/latex/#{theme}.render"))
/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.match(f['listing']['begin'].split('\\')[3]).to_s
end
# Returns the hex color code of the heading. This is done by looking at
# the *.render file of the selected theme. The heading is present at
# the top of each new document in the output TEX/PDF file.
#
# theme - The selected theme.
#
# Examples
#
# heading_color('moc')
# # => "E8E8E8"
#
# Returns an String containing the hex color code of the heading.
def self.heading_color(theme)
f = YAML.load(File.read("#{Uv.render_path}/latex/#{theme}.render"))
/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.match(f['listing']['begin'].split('\\')[2]).to_s
end
# Cleanup
%w[aux log out tex].each do |ext|
path = File.expand_path(outfile).gsub!('tex', ext)
FileUtils.rm path
end
puts completed_message(path, File.expand_path(outfile))
else
puts install_pdflatex_message "#{File.expand_path(outfile)}"
end
puts "=================================================="
def self.preamble(theme)
preamble = ''
preamble << "\\documentclass[a4paper,landscape]{article}\n"
preamble << "\\pagestyle{empty}\n"
preamble << "\\usepackage{xcolor}\n"
preamble << "\\usepackage{colortbl}\n"
preamble << "\\usepackage{longtable}\n"
preamble << "\\usepackage[left=0cm,top=0.2cm,right=0cm,bottom=0.2cm,nohead,nofoot]{geometry}\n"
preamble << "\\usepackage[T1]{fontenc}\n"
preamble << "\\usepackage[scaled]{beramono}\n"
preamble << "\\usepackage[bookmarksopen,bookmarksdepth=20]{hyperref}\n"
preamble << "\\definecolor{pgcolor}{HTML}{#{page_color(theme)}}\n"
preamble << "\\definecolor{headingcolor}{HTML}{#{heading_color(theme)}}\n"
preamble << "\\pagecolor{pgcolor}\n"
preamble << "\\begin{document}\n"
preamble << "\\setlength\\LTleft\\parindent\n"
preamble << "\\setlength\\LTright\\fill\n"
preamble << "\\setlength{\\LTpre}{-10pt}\n"
preamble
end
def self.endtag
"\\end{document}\n"
end
end
end
# Parses the given file, and writes the output file (out.tex)
# into the current directory.
#
# path - The file path
# theme - The selected theme
#
# Examples
#
# parse_file("~/code/ruby/some_folder/some_file.rb", "space_cadet")
#
# Returns a String of TeX output.
def self.parse_file(path, theme)
content = ""
syntax = source_syntax(path)
if rippable?(path, syntax)
content << heading(path)
output = (max_width(path) <= MAX_WIDTH) ? File.read(path) : wrap_file(path, MAX_WIDTH)
content << Uv.parse(output, 'latex', syntax, true, theme)
content << "\\clearpage\n"
end
content
end
private
# Returns True if path should be bookmarked in the output TEX/PDF document.
#
# path - The file/directory path
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
#
# Examples
#
# bookmarkable?("hello.rb", "ruby")
# # => true
#
# bookmarkable?("hello.klingon", "klingon")
# # => false
#
# Returns True if path should be bookmarked.
def self.bookmarkable?(path, syntax)
if FileTest.directory?(path)
true
else
src_ext = File.extname(path)[1..-1]
if File.basename(path) == "out.tex"
false
elsif supported_exts.include?(src_ext)
true
else
false
end
end
end
# Returns True if path should be ripped as part of the output TEX file.
#
# path - The file. (directories will return false.)
# syntax - The syntax to perform parsing/syntax highlighting.
# Note the the syntax should be supported by code_rippa.
#
# Examples
#
# rippable?("hello.rb", "ruby")
# # => true
#
# rippable?("~/code/", "ruby")
# # => false
#
# rippable?("hello.klingon", "klingon")
# # => false
#
# Returns true if path should be ripped.
def self.rippable?(path, syntax)
if FileTest.directory?(path)
false
else
if supported_exts.include?(File.extname(path)[1..-1])
true
else
false
end
end
end
# Places a PDF bookmark
def self.bookmark(path, depth, counter)
"\\pdfbookmark[#{depth-2}]{#{File.basename(path).gsub('_','\_').gsub('%','\%')}}{#{counter}}\n"
end
# Returns the maximum width (number of characters) in a given file
def self.max_width(path)
IO.readlines(path).collect { |x| x.length }.max
end
# Returns the String of the wrapped text
def self.wrap(text, width)
text.gsub(/(.{1,#{width}})( +|$\n?)|(.{1,#{width}})/, "\\1\\3\n")
end
# Returns the String of the wrapped file
def self.wrap_file(path, width)
wrapped_output = ""
IO.readlines(path).each { |line| wrapped_output << wrap(line, width) }
wrapped_output
end
# Returns the String of the source file. If not found, a blank String is returned.
def self.source_syntax(path)
syntax = ""
language = ""
if FileTest.file?(path) and not File.binary?(path)
begin
language = LanguageSniffer.detect(path).language
syntax = language.name.downcase if language
rescue Exception => e
end
end
syntax
end
def self.syntax_path
Uv.syntax_path
end
# Returns an Array of supported file extensions
def self.supported_exts
if @@supported_ext
@@supported_ext
else
@@supported_ext = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
y = YAML.load(File.read "#{syntax_path}/#{f}")
@@supported_ext += y["fileTypes"] if y["fileTypes"]
end
end
@@supported_ext
end
end
# Returns an Array of supported languages.
def self.supported_langs
langs = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
y = YAML.load(File.read "#{syntax_path}/#{f}")
langs << y["name"] if y["name"]
end
end
langs
end
# Returns an Array of supported syntaxes.
def self.supported_syntax
if @@supported_syntax
@@supported_syntax
else
@@supported_syntax = []
Dir.foreach(syntax_path) do |f|
if File.extname(f) == ".syntax"
@@supported_syntax << File.basename(f, '.*')
end
end
@@supported_syntax
end
end
# Returns a String containing the heading of the parsed file.
def self.heading(path)
"\\textcolor{headingcolor}{\\textbf{\\texttt{#{path.gsub('_','\_').gsub('%','\%')}}}}\\\\\n" +
"\\textcolor{headingcolor}{\\rule{\\linewidth}{1.0mm}}\\\\\n"
end
# Returns the hex color code of the heading, which is the inverse of page color.
def self.heading_color(theme)
c = Color::RGB.from_html(page_color(theme))
Color::RGB.new(255-c.red, 255-c.green, 255- c.blue).html.gsub("#","").upcase
end
# Returns a String containing the hex color code of the page.
def self.page_color(theme)
f = YAML.load(File.read("#{Uv.render_path}/latex/#{theme}.render"))
/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/.match(f['listing']['begin'].split('\\')[3]).to_s
end
def self.preamble(theme)
preamble = ''
preamble << "\\documentclass[a4paper,landscape]{article}\n"
preamble << "\\pagestyle{empty}\n"
preamble << "\\usepackage{xcolor}\n"
preamble << "\\usepackage{colortbl}\n"
preamble << "\\usepackage{longtable}\n"
preamble << "\\usepackage[left=0cm,top=0.2cm,right=0cm,bottom=0.2cm,nohead,nofoot]{geometry}\n"
preamble << "\\usepackage[T1]{fontenc}\n"
preamble << "\\usepackage[scaled]{beramono}\n"
preamble << "\\usepackage[bookmarksopen,bookmarksdepth=20]{hyperref}\n"
preamble << "\\definecolor{pgcolor}{HTML}{#{page_color(theme)}}\n"
preamble << "\\definecolor{headingcolor}{HTML}{#{heading_color(theme)}}\n"
preamble << "\\pagecolor{pgcolor}\n"
preamble << "\\begin{document}\n"
preamble << "\\setlength\\LTleft\\parindent\n"
preamble << "\\setlength\\LTright\\fill\n"
preamble << "\\setlength{\\LTpre}{-10pt}\n"
preamble
end
def self.postscript
"\\end{document}\n"
end
def self.completed_message(in_path, out_path)
msg = "Success!. ".color(:green)
msg << "Output file written to: "
msg << "#{out_path.gsub!('tex', 'pdf')}".color(:green)
end
def self.install_pdflatex_message(out_path)
msg = "You do not have 'pdflatex' installed!\n".color(:red)
msg << "Please install it at "
msg << "http://www.tug.org/texlive'\n".color(:yellow)
msg << "Output TEX file written to: "
msg << "#{out_path}\n".color(:yellow)
end
def self.pdflatex_installed?
cmd = 'pdflatex'
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each do |ext|
exe = "#{path}/#{cmd}#{ext}"
exe if File.executable? exe
return exe
end
end
nil
end
end
# Sanity check
# CodeRippa.parse("/Users/rambo/code/ruby/code_rippa", "succulent")
# CodeRippa.parse("/Users/rambo/code/ruby/code_rippa/lib/code_rippa.rb", "amy")

@@ -11,3 +11,3 @@ require 'uv'

Uv.theme_path = File.join(File.dirname(__FILE__), 'render', 'latex')
Uv.default_style ||= 'moc'
Uv.default_style ||= 'made_of_code'

@@ -14,0 +14,0 @@ def Uv.themes

module CodeRippa
VERSION = "0.0.6"
VERSION = "0.0.7"
end
+35
-32

@@ -5,4 +5,9 @@ # CodeRippa

CodeRippa takes your source code and turns it into a beautiful PDF file. Currently, it supports 150 languages and 15 themes, all of which are available in TextMate. More syntaxes and themes will be available soon.
_CodeRippa_ takes your source code and turns it into a beautiful PDF file. Currently, it supports 150 languages and 84 themes, all of which are available in TextMate.
## Prerequisites
You will definitely need a TeX distribution installed. To check, simply type `pdflatex`.
In case your system doesn't have `pdflatex`, you should install a [LaTeX](http://www.tug.org/texlive/) distribution.
## Installation

@@ -20,7 +25,7 @@

-n, --list-syntax List all available syntax
-s, --syntax SYNTAX Selected syntax
-x, --excluded-exts E1,E2,EN Exclude these extensions when processing
-h, --help Display this screen
### List all available themes
### List all available themes (84 and counting!)
Many of the themes found in CodeRippa can be found [here](http://textmatetheme.com/)

@@ -32,31 +37,21 @@ $ code_rippa -l

amy
moc
made_of_code
twilight
zenburnesque
... more themes omitted
### List all supported syntax
$ code_rippa -n
actionscript
erlang
java
javascript
prolog
ruby
yaml
... more syntaxes omitted
### Producing PDF from a single file
Example:
$ code_rippa -s ruby -t zenburnesque path_to_single_file.rb
Note that the output file is saved as _out.tex_ in the current directory where _code_rippa_ was called from.
Without theme specified (defaults to: _made_of_code_):
$ pdflatex out.tex # Saved as out.pdf
$ code_rippa path_to_single_file.rb
With theme specified:
$ code_rippa -t zenburnesque path_to_single_file.rb
Note that the output file is saved as _out.pdf_ in the current directory where _code_rippa_ was called from.
### Producing PDF from a directory

@@ -66,16 +61,15 @@

$ code_rippa -s java -t moc path_to_directory
Without theme specified (defaults to: _made_of_code_):
$ code_rippa path_to_directory
Note that the output file is saved as _out.tex_ in the current directory where _code_rippa_ was called from.
With theme specified:
Then, you'll need to run _pdflatex_ __twice__. This is because LaTeX needs to generate the bookmarks.
$ code_rippa -t rubyblue path_to_directory
$ pdflatex out.tex # Saved as out.pdf
$ pdflatex out.tex # Remember to run this twice!
Note: In case your system doesn't have `pdflatex`, you can get a [LaTeX](http://www.tug.org/texlive/) distribution.
Note that the output file is saved as _out.pdf_ in the current directory where _code_rippa_ was called from.
## Credits
None of this would be possible without the awesome [ultraviolet](https://github.com/giom/ultraviolet) and [spox-ultraviolet](https://github.com/spox/ultraviolet) gems. Props to [__lwheng__](https://github.com/lwheng) for providing most of the LaTeX help.
None of this would be possible without the awesome [ultraviolet](https://github.com/giom/ultraviolet) [spox-ultraviolet](https://github.com/spox/ultraviolet) and [language_sniffer](https://github.com/grosser/language_sniffer) gems. Props to [__lwheng__](https://github.com/lwheng) for providing most of the LaTeX help.

@@ -88,2 +82,11 @@ ## Contributing

### 0.0.7
- Using [language_sniffer](https://github.com/grosser/language_sniffer) in place of Linguist for automated source code language detection
- Themes! Glorious themes! 84 themes to choose from! Props to [filmgirl](https://github.com/filmgirl/TextMate-Themes), and the rest of the wonderful TM users who submitted their themes.
- Wrap lines of troublesome files such as minified javascript and parser generator outputs.
- Sensible defaults, removed the need for specifying the syntax
- Detects if pdflatex is installed, and automatically runs pdflatex if so
- Proper cleanup after LaTeX successfully completes
### 0.0.6

@@ -90,0 +93,0 @@

@@ -32,31 +32,31 @@ require 'minitest/autorun'

it "should parse a file with an extension that is supported" do
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.rb", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.c", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.cpp", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.m", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.s", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.txt", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.haml", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.json", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.py", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.sh", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.groovy", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.php", 'moc', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.rb", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.c", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.cpp", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.m", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.s", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.txt", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.haml", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.json", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.py", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.sh", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.groovy", 'rubyblue', [])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.php", 'rubyblue', [])
end
it "should not parse a file with an extension that isn't supported" do
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.vark", 'moc', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.psd", 'moc', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.ai", 'moc', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.scala", 'moc', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.vark", 'rubyblue', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.psd", 'rubyblue', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.ai", 'rubyblue', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.scala", 'rubyblue', [])
end
it "should not parse a directory" do
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/", 'moc', [])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/", 'rubyblue', [])
end
it "should not parse a file that has an excluded extension" do
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.rb", 'moc', ['rb'])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.c", 'moc', ['c'])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.cpp", 'moc', ['rb'])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.rb", 'rubyblue', ['rb'])
assert_equal false, CodeRippa.rippable?("#{fixtures_path}/hello.c", 'rubyblue', ['c'])
assert_equal true, CodeRippa.rippable?("#{fixtures_path}/hello.cpp", 'rubyblue', ['rb'])
end

@@ -70,9 +70,9 @@

it "should bookmark a directory" do
assert_equal true, CodeRippa.bookmarkable?("#{fixtures_path}/", 'moc', [])
assert_equal true, CodeRippa.bookmarkable?("#{fixtures_path}/", 'rubyblue', [])
end
it "should not bookmark a file that has an excluded extension" do
assert_equal false, CodeRippa.bookmarkable?("#{fixtures_path}/hello.rb", 'moc', ['rb'])
assert_equal false, CodeRippa.bookmarkable?("#{fixtures_path}/hello.c", 'moc', ['c'])
assert_equal true, CodeRippa.bookmarkable?("#{fixtures_path}/hello.cpp", 'moc', ['rb'])
assert_equal false, CodeRippa.bookmarkable?("#{fixtures_path}/hello.rb", 'rubyblue', ['rb'])
assert_equal false, CodeRippa.bookmarkable?("#{fixtures_path}/hello.c", 'rubyblue', ['c'])
assert_equal true, CodeRippa.bookmarkable?("#{fixtures_path}/hello.cpp", 'rubyblue', ['rb'])
end

@@ -79,0 +79,0 @@

@@ -22,3 +22,3 @@ require 'minitest/autorun'

puts File.expand_path(File.open("."))
CodeRippa.rip_file(File.join("#{File.expand_path(File.open("."))}", "hello.rb"), "moc", "ruby")
CodeRippa.rip_file(File.join("#{File.expand_path(File.open("."))}", "hello.rb"), "rubyblue", "ruby")
f1 = File.open("out.tex")

@@ -32,3 +32,3 @@ f2 = File.open("rip_file.tex")

it "should rip a directory that is supported" do
CodeRippa.rip_dir("ruby_proj/", "moc", "ruby")
CodeRippa.rip_dir("ruby_proj/", "rubyblue", "ruby")
f1 = File.open("out.tex")

@@ -35,0 +35,0 @@ f2 = File.open("rip_dir.tex")

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet