Skip to content

Commit

Permalink
Compiler: move fixtures, update sirop
Browse files Browse the repository at this point in the history
  • Loading branch information
noteflakes committed May 8, 2024
1 parent eb44226 commit fb808be
Show file tree
Hide file tree
Showing 19 changed files with 8 additions and 38 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PATH
kramdown (~> 2.4.0)
kramdown-parser-gfm (~> 1.1.0)
rouge (~> 4.2.0)
sirop (~> 0.3)
sirop (~> 0.4)

GEM
remote: https://rubygems.org/
Expand All @@ -19,11 +19,11 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
minitest (5.22.3)
prism (0.19.0)
prism (0.27.0)
rexml (3.2.6)
rouge (4.2.1)
sirop (0.3)
prism (~> 0.19.0)
sirop (0.4)
prism (~> 0.27.0)
tilt (2.2.0)

PLATFORMS
Expand Down
30 changes: 0 additions & 30 deletions lib/papercraft/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,6 @@
require 'escape_utils'
require 'sirop'

class Sirop::Sourcifier
# VISIT_PLANS.merge!({
# self: :emit_verbatim
# })

def emit_nothing(node)
# emit nothing
end

def visit_self_node(node)
emit_verbatim(node)
end

def visit_numbered_parameters_node(node)
emit_nothing(node)
end

def visit_hash_node(node)
emit_code(node.opening_loc)
visit_comma_separated_nodes(node.elements)
emit_code(node.closing_loc)
end

def visit_array_node(node)
emit_code(node.opening_loc)
visit_comma_separated_nodes(node.elements)
emit_code(node.closing_loc)
end
end

class Papercraft::Compiler < Sirop::Sourcifier
def initialize
super
Expand Down
2 changes: 1 addition & 1 deletion papercraft.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.required_ruby_version = '>= 3.2'

s.add_runtime_dependency 'sirop', '~>0.3'
s.add_runtime_dependency 'sirop', '~>0.4'
s.add_runtime_dependency 'escape_utils', '~>1.3.0'
s.add_runtime_dependency 'kramdown', '~>2.4.0'
s.add_runtime_dependency 'rouge', '~>4.2.0'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/test_compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
require_relative './helper'

class CompilerTest < Minitest::Test
Dir["#{FIXTURES_PATH}/*_source.rb"].each do |fn|
Dir["#{FIXTURES_PATH}/compiler/*_source.rb"].each do |fn|
basename = File.basename(fn)
test_name = basename.match(/^(.+)_source\.rb$/)[1]
compiled_fn = File.join(FIXTURES_PATH, "#{test_name}_compiled.rb")
html_fn = File.join(FIXTURES_PATH, "#{test_name}.html")
compiled_fn = File.join(FIXTURES_PATH, "compiler/#{test_name}_compiled.rb")
html_fn = File.join(FIXTURES_PATH, "compiler/#{test_name}.html")

original_src = IO.read(fn).chomp
compiled_src = IO.read(compiled_fn).chomp
Expand Down

0 comments on commit fb808be

Please sign in to comment.