trenni 3.10.0 → 3.11.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/.DS_Store +0 -0
- data/ext/tmp/.DS_Store +0 -0
- data/ext/tmp/x86_64-darwin16/lib/trenni/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/Makefile +264 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/escape.o +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/markup.o +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/mkmf.log +105 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/tag.o +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/template.o +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin16/trenni/2.4.0/trenni.o +0 -0
- data/ext/tmp/x86_64-darwin18/lib/trenni/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/Makefile +266 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/escape.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/markup.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/mkmf.log +109 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/tag.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/template.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.1/trenni.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/Makefile +266 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/escape.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/markup.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/mkmf.log +109 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/tag.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/template.o +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin18/trenni/2.6.2/trenni.o +0 -0
- data/ext/tmp/x86_64-darwin19/lib/trenni/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/Makefile +267 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/escape.o +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/markup.o +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/mkmf.log +109 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/query.o +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/tag.o +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/template.o +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/trenni.bundle +0 -0
- data/ext/tmp/x86_64-darwin19/trenni/2.7.1/trenni.o +0 -0
- data/ext/trenni/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/trenni/.DS_Store +0 -0
- data/lib/trenni/builder.rb +14 -4
- data/lib/trenni/entities.rb +2082 -2084
- data/lib/trenni/entities.trenni +1 -3
- data/lib/trenni/template.rb +19 -9
- data/lib/trenni/version.rb +1 -1
- data/parsers/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
- data/spec/trenni/builder_spec.rb +1 -1
- data/spec/trenni/template_spec/.DS_Store +0 -0
- metadata +73 -58
- data/.editorconfig +0 -6
- data/.gitignore +0 -19
- data/.rspec +0 -5
- 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 -38
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,38 +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.license = "MIT"
|
8
|
-
spec.version = Trenni::VERSION
|
9
|
-
spec.authors = ["Samuel Williams"]
|
10
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
11
|
-
spec.description = <<-EOF
|
12
|
-
Trenni is a templating system built on top of SGML/XML. It uses efficient
|
13
|
-
native parsers where possible and compiles templates into efficient Ruby.
|
14
|
-
|
15
|
-
In addition, Trenni includes an SGML/XML builder to assist with the generation
|
16
|
-
of pleasantly formatted markup which is compatible with the included parsers.
|
17
|
-
EOF
|
18
|
-
|
19
|
-
spec.summary = "A fast native templating system that compiles directly to Ruby code."
|
20
|
-
|
21
|
-
spec.homepage = "https://github.com/ioquatix/trenni"
|
22
|
-
spec.metadata["funding_uri"] = "https://github.com/sponsors/ioquatix"
|
23
|
-
|
24
|
-
spec.files = `git ls-files`.split($/)
|
25
|
-
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
26
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
-
|
29
|
-
spec.required_ruby_version = "~> 2.4"
|
30
|
-
|
31
|
-
spec.extensions = %w[ext/Rakefile]
|
32
|
-
spec.add_dependency "rake-compiler"
|
33
|
-
|
34
|
-
spec.add_development_dependency "rack"
|
35
|
-
spec.add_development_dependency "bundler"
|
36
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
37
|
-
spec.add_development_dependency "rake"
|
38
|
-
end
|