trenni 3.8.0 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/bake/trenni/entities.rb +57 -0
  3. data/bake/trenni/parsers.rb +66 -0
  4. data/ext/tmp/x86_64-linux/lib/trenni/trenni.so +0 -0
  5. data/ext/tmp/x86_64-linux/trenni/2.4.0/Makefile +263 -0
  6. data/ext/tmp/x86_64-linux/trenni/2.4.0/escape.o +0 -0
  7. data/ext/tmp/x86_64-linux/trenni/2.4.0/markup.o +0 -0
  8. data/ext/tmp/x86_64-linux/trenni/2.4.0/mkmf.log +108 -0
  9. data/ext/tmp/x86_64-linux/trenni/2.4.0/tag.o +0 -0
  10. data/ext/tmp/x86_64-linux/trenni/2.4.0/template.o +0 -0
  11. data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.o +0 -0
  12. data/ext/tmp/x86_64-linux/trenni/2.4.0/trenni.so +0 -0
  13. data/ext/tmp/x86_64-linux/trenni/2.7.0/Makefile +266 -0
  14. data/ext/tmp/x86_64-linux/trenni/2.7.0/escape.o +0 -0
  15. data/ext/tmp/x86_64-linux/trenni/2.7.0/markup.o +0 -0
  16. data/ext/tmp/x86_64-linux/trenni/2.7.0/mkmf.log +113 -0
  17. data/ext/tmp/x86_64-linux/trenni/2.7.0/query.o +0 -0
  18. data/ext/tmp/x86_64-linux/trenni/2.7.0/tag.o +0 -0
  19. data/ext/tmp/x86_64-linux/trenni/2.7.0/template.o +0 -0
  20. data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.o +0 -0
  21. data/ext/tmp/x86_64-linux/trenni/2.7.0/trenni.so +0 -0
  22. data/ext/tmp/x86_64-linux/trenni/2.7.1/Makefile +266 -0
  23. data/ext/tmp/x86_64-linux/trenni/2.7.1/escape.o +0 -0
  24. data/ext/tmp/x86_64-linux/trenni/2.7.1/markup.o +0 -0
  25. data/ext/tmp/x86_64-linux/trenni/2.7.1/mkmf.log +113 -0
  26. data/ext/tmp/x86_64-linux/trenni/2.7.1/query.o +0 -0
  27. data/ext/tmp/x86_64-linux/trenni/2.7.1/tag.o +0 -0
  28. data/ext/tmp/x86_64-linux/trenni/2.7.1/template.o +0 -0
  29. data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.o +0 -0
  30. data/ext/tmp/x86_64-linux/trenni/2.7.1/trenni.so +0 -0
  31. data/ext/trenni/markup.c +85 -85
  32. data/ext/trenni/markup.rl +11 -11
  33. data/ext/trenni/query.c +619 -0
  34. data/ext/trenni/query.h +6 -0
  35. data/ext/trenni/query.rl +82 -0
  36. data/ext/trenni/tag.c +8 -6
  37. data/ext/trenni/template.c +57 -57
  38. data/ext/trenni/template.rl +4 -4
  39. data/ext/trenni/trenni.c +9 -1
  40. data/ext/trenni/trenni.h +8 -3
  41. data/lib/trenni.rb +2 -0
  42. data/lib/trenni/builder.rb +79 -15
  43. data/lib/trenni/entities.rb +2082 -2084
  44. data/lib/trenni/entities.trenni +1 -3
  45. data/lib/trenni/{parse_error.rb → error.rb} +4 -1
  46. data/lib/trenni/fallback/markup.rb +1622 -1576
  47. data/lib/trenni/fallback/markup.rl +2 -2
  48. data/lib/trenni/fallback/markup.rl.dot +278 -0
  49. data/lib/trenni/fallback/markup.rl.pdf +0 -0
  50. data/lib/trenni/fallback/query.rb +565 -0
  51. data/lib/trenni/fallback/query.rl +105 -0
  52. data/lib/trenni/fallback/query.rl.dot +54 -0
  53. data/lib/trenni/fallback/query.rl.pdf +0 -0
  54. data/lib/trenni/fallback/template.rb +756 -748
  55. data/lib/trenni/fallback/template.rl +1 -1
  56. data/lib/trenni/fallback/template.rl.dot +270 -0
  57. data/lib/trenni/fallback/template.rl.pdf +0 -0
  58. data/lib/trenni/native.rb +1 -1
  59. data/lib/trenni/parsers.rb +1 -0
  60. data/lib/trenni/query.rb +94 -0
  61. data/lib/trenni/reference.rb +125 -0
  62. data/lib/trenni/strings.rb +15 -4
  63. data/lib/trenni/template.rb +23 -22
  64. data/lib/trenni/trenni.so +0 -0
  65. data/lib/trenni/uri.rb +1 -0
  66. data/lib/trenni/version.rb +1 -1
  67. data/parsers/trenni/query.rl +23 -0
  68. data/spec/trenni/builder_spec.rb +103 -60
  69. data/spec/trenni/markup_performance_spec.rb +14 -2
  70. data/spec/trenni/parsers_performance_spec.rb +31 -0
  71. data/spec/trenni/query_spec.rb +51 -0
  72. data/spec/trenni/reference_spec.rb +87 -0
  73. data/spec/trenni/template_spec/builder.trenni +2 -2
  74. metadata +91 -59
  75. data/.gitignore +0 -19
  76. data/.rspec +0 -5
  77. data/.simplecov +0 -9
  78. data/.travis.yml +0 -23
  79. data/Gemfile +0 -21
  80. data/README.md +0 -312
  81. data/Rakefile +0 -21
  82. data/benchmark/call_vs_yield.rb +0 -52
  83. data/benchmark/interpolation_vs_concat.rb +0 -30
  84. data/benchmark/io_vs_string.rb +0 -91
  85. data/entities.json +0 -2233
  86. data/tasks/entities.rake +0 -34
  87. data/tasks/parsers.rake +0 -44
  88. data/trenni.gemspec +0 -36
@@ -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
@@ -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
@@ -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