trenni 3.8.0 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bake/trenni/entities.rb +57 -0
- data/bake/trenni/parsers.rb +66 -0
- data/ext/tmp/x86_64-linux/lib/trenni/trenni.so +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/Makefile +263 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/escape.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/markup.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/mkmf.log +108 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/tag.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/template.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.so +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/Makefile +266 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/escape.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/markup.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/mkmf.log +113 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/query.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/tag.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/template.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.so +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/Makefile +266 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/escape.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/markup.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/mkmf.log +113 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/query.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/tag.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/template.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.o +0 -0
- data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.so +0 -0
- data/ext/trenni/markup.c +85 -85
- data/ext/trenni/markup.rl +11 -11
- data/ext/trenni/query.c +619 -0
- data/ext/trenni/query.h +6 -0
- data/ext/trenni/query.rl +82 -0
- data/ext/trenni/tag.c +8 -6
- data/ext/trenni/template.c +57 -57
- data/ext/trenni/template.rl +4 -4
- data/ext/trenni/trenni.c +9 -1
- data/ext/trenni/trenni.h +8 -3
- data/lib/trenni.rb +2 -0
- data/lib/trenni/builder.rb +79 -15
- data/lib/trenni/entities.rb +2082 -2084
- data/lib/trenni/entities.trenni +1 -3
- data/lib/trenni/{parse_error.rb → error.rb} +4 -1
- data/lib/trenni/fallback/markup.rb +1622 -1576
- data/lib/trenni/fallback/markup.rl +2 -2
- data/lib/trenni/fallback/markup.rl.dot +278 -0
- data/lib/trenni/fallback/markup.rl.pdf +0 -0
- data/lib/trenni/fallback/query.rb +565 -0
- data/lib/trenni/fallback/query.rl +105 -0
- data/lib/trenni/fallback/query.rl.dot +54 -0
- data/lib/trenni/fallback/query.rl.pdf +0 -0
- data/lib/trenni/fallback/template.rb +756 -748
- data/lib/trenni/fallback/template.rl +1 -1
- data/lib/trenni/fallback/template.rl.dot +270 -0
- data/lib/trenni/fallback/template.rl.pdf +0 -0
- data/lib/trenni/native.rb +1 -1
- data/lib/trenni/parsers.rb +1 -0
- data/lib/trenni/query.rb +94 -0
- data/lib/trenni/reference.rb +125 -0
- data/lib/trenni/strings.rb +15 -4
- data/lib/trenni/template.rb +23 -22
- data/lib/trenni/trenni.so +0 -0
- data/lib/trenni/uri.rb +1 -0
- data/lib/trenni/version.rb +1 -1
- data/parsers/trenni/query.rl +23 -0
- data/spec/trenni/builder_spec.rb +103 -60
- data/spec/trenni/markup_performance_spec.rb +14 -2
- data/spec/trenni/parsers_performance_spec.rb +31 -0
- data/spec/trenni/query_spec.rb +51 -0
- data/spec/trenni/reference_spec.rb +87 -0
- data/spec/trenni/template_spec/builder.trenni +2 -2
- metadata +91 -59
- data/.gitignore +0 -19
- data/.rspec +0 -5
- data/.simplecov +0 -9
- data/.travis.yml +0 -23
- data/Gemfile +0 -21
- data/README.md +0 -312
- data/Rakefile +0 -21
- data/benchmark/call_vs_yield.rb +0 -52
- data/benchmark/interpolation_vs_concat.rb +0 -30
- data/benchmark/io_vs_string.rb +0 -91
- data/entities.json +0 -2233
- data/tasks/entities.rake +0 -34
- data/tasks/parsers.rake +0 -44
- data/trenni.gemspec +0 -36
data/tasks/entities.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
task :fetch_entities do
|
4
|
-
require 'open-uri'
|
5
|
-
require 'json'
|
6
|
-
|
7
|
-
entites_json_path = File.expand_path("entities.json", __dir__)
|
8
|
-
|
9
|
-
unless File.exist? entites_json_path
|
10
|
-
url = "https://www.w3.org/TR/html5/entities.json"
|
11
|
-
File.write(entites_json_path, open(url).read)
|
12
|
-
end
|
13
|
-
|
14
|
-
@entities = JSON.parse(File.read(entites_json_path)).delete_if{|string, _| !string.end_with? ';'}
|
15
|
-
end
|
16
|
-
|
17
|
-
task :update_entities => :fetch_entities do
|
18
|
-
require 'trenni/template'
|
19
|
-
|
20
|
-
paths = {
|
21
|
-
'ext/trenni/entities.rl' => 'ext/trenni/entities.trenni',
|
22
|
-
'lib/trenni/entities.rb' => 'lib/trenni/entities.trenni',
|
23
|
-
}
|
24
|
-
|
25
|
-
paths.each do |output_path, template_path|
|
26
|
-
template = Trenni::Template.load_file(template_path)
|
27
|
-
|
28
|
-
puts template.send(:code)
|
29
|
-
|
30
|
-
#output = template.to_string(@entities)
|
31
|
-
|
32
|
-
#File.write(output_path, output)
|
33
|
-
end
|
34
|
-
end
|
data/tasks/parsers.rake
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
PARSERS_DIRECTORY = File.expand_path("../parsers", __dir__)
|
4
|
-
FALLBACK_DIRECTORY = File.expand_path("../lib/trenni/fallback", __dir__)
|
5
|
-
EXTENSIONS_DIRECTORY = File.expand_path("../ext", __dir__)
|
6
|
-
NATIVE_DIRECTORY = File.expand_path("../ext/trenni", __dir__)
|
7
|
-
|
8
|
-
task :generate_fallback_parsers do
|
9
|
-
Dir.chdir(FALLBACK_DIRECTORY) do
|
10
|
-
Dir.glob("*.rl").each do |parser_path|
|
11
|
-
sh("ragel", "-I", PARSERS_DIRECTORY, "-R", parser_path, "-F1")
|
12
|
-
end
|
13
|
-
|
14
|
-
# sh("ruby-beautify", "--tabs", "--overwrite", *Dir.glob("*.rb"))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
task :generate_native_parsers do
|
19
|
-
Dir.chdir(NATIVE_DIRECTORY) do
|
20
|
-
Dir.glob("*.rl").each do |parser_path|
|
21
|
-
sh("ragel", "-I", PARSERS_DIRECTORY, "-C", parser_path, "-G2")
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
task :compile do
|
27
|
-
system("rake", "compile", chdir: EXTENSIONS_DIRECTORY)
|
28
|
-
end
|
29
|
-
|
30
|
-
task :generate_parsers => [:generate_native_parsers, :generate_fallback_parsers, :compile]
|
31
|
-
|
32
|
-
task :visualize_parsers do
|
33
|
-
Dir.chdir(FALLBACK_DIRECTORY) do
|
34
|
-
Dir.glob("*.rl").each do |parser_path|
|
35
|
-
dot_path = parser_path + ".dot"
|
36
|
-
sh("ragel", "-I", PARSERS_DIRECTORY, "-Vp", parser_path, "-o", dot_path)
|
37
|
-
|
38
|
-
pdf_path = parser_path + ".pdf"
|
39
|
-
sh("dot", "-Tpdf", "-o", pdf_path, dot_path)
|
40
|
-
|
41
|
-
sh("open", pdf_path) rescue nil
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/trenni.gemspec
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/trenni/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "trenni"
|
6
|
-
spec.platform = Gem::Platform::RUBY
|
7
|
-
spec.version = Trenni::VERSION
|
8
|
-
spec.authors = ["Samuel Williams"]
|
9
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
10
|
-
spec.description = <<-EOF
|
11
|
-
Trenni is a templating system built on top of SGML/XML. It uses efficient
|
12
|
-
native parsers where possible and compiles templates into efficient Ruby.
|
13
|
-
|
14
|
-
In addition, Trenni includes an SGML/XML builder to assist with the generation
|
15
|
-
of pleasantly formatted markup which is compatible with the included parsers.
|
16
|
-
EOF
|
17
|
-
|
18
|
-
spec.summary = "A fast native templating system that compiles directly to Ruby code."
|
19
|
-
|
20
|
-
spec.homepage = "https://github.com/ioquatix/trenni"
|
21
|
-
spec.metadata["funding_uri"] = "https://github.com/sponsors/ioquatix"
|
22
|
-
|
23
|
-
spec.files = `git ls-files`.split($/)
|
24
|
-
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
25
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
26
|
-
spec.require_paths = ["lib"]
|
27
|
-
|
28
|
-
spec.required_ruby_version = "~> 2.4"
|
29
|
-
|
30
|
-
spec.extensions = %w[ext/Rakefile]
|
31
|
-
spec.add_dependency "rake-compiler"
|
32
|
-
|
33
|
-
spec.add_development_dependency "bundler"
|
34
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
35
|
-
spec.add_development_dependency "rake"
|
36
|
-
end
|