rsyntaxtree 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,7 +4,7 @@ RSyntaxTree is a graphical syntax tree generator written in the Ruby programming
4
4
 
5
5
  While phpSyntaxTree does not accept **multi-byte characters** as those in Chinese, Japanese, and Korean, RSyntaxTree handles text of any language as long as encoded in UTF-8 and fonts have been installed. Additionally, RSyntaxTree can output **symmetrized** tree diagrams, a functionality that is not implemented in phpSyntaxTree.
6
6
 
7
- RSyntaxTree consists of an easy-to-use command-line app and a web-based interfaces made with [Sinatra](http://www.sinatrarb.com) web framework.
7
+ RSyntaxTree consists of an easy-to-use command-line app and a web-based interface made with [Sinatra](http://www.sinatrarb.com) web framework.
8
8
 
9
9
  ### Web Interface
10
10
 
@@ -23,10 +23,10 @@ For the command-line interface, type `$rsyntaxtree -h` after installation. Here'
23
23
  RSyntaxTree, (linguistic) syntax tree generator written in Ruby.
24
24
 
25
25
  Usage:
26
- rsyntaxtree [options] "[NP [N bracket] [NP notation]]]"
26
+ rsyntaxtree [options] "[VP [VP [V set] [NP bracket notation]] [ADV here]]"
27
27
  where [options] are:
28
28
  --outdir, -o <s>: Output directory (default: present working directory) (default: ./)
29
- --format, -f <s>: Output format: png or svg (default: png)
29
+ --format, -f <s>: Output format: png, pdf, or svg (default: png)
30
30
  --leafstyle, -l <s>: visual style of tree leaves: triangle, bar, or nothing (default: triangle)
31
31
  --fontstyle, -n <s>: Font style: sans-serif, serif, jp-gothic, jp-mincho, cjk (default: cjk)
32
32
  --font, -t <s>: Path to a ttf font used to generate tree
@@ -37,6 +37,22 @@ For the command-line interface, type `$rsyntaxtree -h` after installation. Here'
37
37
  --version, -v: Print version and exit
38
38
  --help, -h: Show this message
39
39
 
40
+ ### Tips
41
+
42
+ Every branch or leaf of a tree must belong to a node. To create a node, place a label right next to the opening bracket. Arbitrary number of branches can follow with a preceding space. When a node has one and only one leaf and the leaf contains more than one space characters, the node is treated as a phrase and a triangle (not just a vertical bar) will be between the node label and the leaf).
43
+
44
+ You can put a subscript to any node by putting the _ character between the main label and the subscript. For example, NP_TOP will be rendered as NP<sub>TOP</sub>. Or you can select the &#8220;Auto subscript&#8221; option so that nodes of the same label will be automatically numbered. (e.g. NP<sub>1</sub>, NP<sub>2</sub>)</p>
45
+
46
+ ### Example
47
+
48
+ Bracket notation (auto-subscript-on):
49
+
50
+ [NP [NP [ART a] [N table]] [PP [P near] [NP [ART the] [N door]]]]
51
+
52
+ Resulting PNG
53
+
54
+ ![a table near the door](http://yohasebe.com/img/rsyntaxtree_example.png)
55
+
40
56
  ### Development
41
57
 
42
58
  For the latest updates and downloads please visit http://github.com/yohasebe/rsyntaxtree
data/app.rb CHANGED
@@ -9,6 +9,8 @@ require './lib/rsyntaxtree'
9
9
 
10
10
  include Helpers
11
11
 
12
+ set :public_folder, File.dirname(__FILE__) + '/public'
13
+
12
14
  configure do
13
15
  enable :sessions
14
16
  end
data/bin/rsyntaxtree CHANGED
@@ -16,15 +16,15 @@ Usage:
16
16
  where [options] are:
17
17
  EOS
18
18
 
19
- opt :outdir, "Output directory (default: present working directory)",
19
+ opt :outdir, "Output directory",
20
20
  :default => "./"
21
21
  opt :format, "Output format: png, pdf, or svg",
22
22
  :default => "png"
23
23
  opt :leafstyle, "visual style of tree leaves: triangle, bar, or nothing",
24
24
  :default => "triangle"
25
- opt :fontstyle, "Font style: sans-serif, serif, jp-gothic, jp-mincho, cjk",
25
+ opt :fontstyle, "Font style (available when ttf font is specified): sans-serif, serif, jp-gothic, jp-mincho, cjk",
26
26
  :default => "cjk"
27
- opt :font, "Path to a ttf font used to generate tree", :type => String
27
+ opt :font, "Path to a ttf font used to generate tree (optional)", :type => String
28
28
  opt :fontsize, "Font size: 8-20",
29
29
  :default => 16
30
30
  opt :color, "Color text and bars: on or off",
@@ -1,4 +1,4 @@
1
1
  module RSyntaxTree
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
4
4
 
@@ -19,7 +19,7 @@ $(function(){
19
19
  function draw_graph(data){
20
20
  $("#result").html("<img id='tree_image'>");
21
21
  $.ajax({
22
- url: '/draw_png',
22
+ url: 'draw_png',
23
23
  type: 'POST',
24
24
  data: make_params(data),
25
25
  success: function (png) {
@@ -28,15 +28,6 @@ $(function(){
28
28
  });
29
29
  }
30
30
 
31
- // function draw_graph(data){
32
- // $("#result").html("<img id='tree_image' src='/draw_png?" + make_params(data) + "'>");
33
- // }
34
-
35
- function download_svg(data){
36
- var params = make_params(data)
37
- $.post('/svg', params);
38
- }
39
-
40
31
  function escape_chrs(data){
41
32
  data = data.replace(/\&/g, "-AMP-").replace(/\'/g, "-PRIME-").replace(/\;/g, "-SCOLON");
42
33
  data = $('<div/>').text(data).html();
@@ -44,7 +35,7 @@ $(function(){
44
35
  }
45
36
 
46
37
  function postForm(data, format){
47
- $('<form/>', {action: '/download_' + format, method: 'POST'})
38
+ $('<form/>', {action: 'download_' + format, method: 'POST'})
48
39
  .append($('<input/>', {type: 'hidden', name: 'data', value: data}))
49
40
  .append($('<input/>', {type: 'hidden', name: 'format', value: $("select[name=format]").val()}))
50
41
  .append($('<input/>', {type: 'hidden', name: 'leafstyle', value: $("select[name=leafstyle]").val()}))
@@ -63,7 +54,7 @@ $(function(){
63
54
  data = escape_chrs(data);
64
55
  $.ajax({
65
56
  type: "POST",
66
- url:"/check",
57
+ url:"check",
67
58
  data:"data=" + data,
68
59
  success: function(msg){
69
60
  if(msg != "true"){
@@ -81,7 +72,7 @@ $(function(){
81
72
  data = escape_chrs(data);
82
73
  $.ajax({
83
74
  type: "POST",
84
- url:"/check",
75
+ url:"check",
85
76
  data:"data=" + data,
86
77
  success: function(msg){
87
78
  if(msg != "true"){
@@ -100,7 +91,7 @@ $(function(){
100
91
  data = escape_chrs(data);
101
92
  $.ajax({
102
93
  type: "POST",
103
- url:"/check",
94
+ url:"check",
104
95
  data:"data=" + data,
105
96
  success: function(msg){
106
97
  if(msg != "true"){
@@ -116,7 +107,7 @@ $(function(){
116
107
  $("#check").click(function(){
117
108
  $.ajax({
118
109
  type: "POST",
119
- url:"/check",
110
+ url:"check",
120
111
  data:"data=" + escape_chrs($("#data").val()),
121
112
  success: function(msg){
122
113
  if(msg == "true"){
data/rsyntaxtree.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = RSyntaxTree::VERSION
9
9
  s.authors = ["Yoichiro Hasebe"]
10
10
  s.email = ["yohasebe@gmail.com"]
11
- s.homepage = ""
11
+ s.homepage = "http://github.com/yohasebe/rsyntaxtree"
12
12
  s.summary = %q{RSyntaxTree is a graphical syntax tree generator written in Ruby}
13
13
  s.description = %q{Yet another syntax tree generator made with Ruby and RMagick}
14
14
 
data/views/index.haml CHANGED
@@ -20,7 +20,7 @@
20
20
  %option{:value => "bar"}Bar
21
21
  %option{:value => "nothing"}Nothing
22
22
  .span2
23
- %h4 Fontstyle
23
+ %h4 Font-style
24
24
  %select{:name => "fontstyle", :style => "width:110px;"}
25
25
  %option{:value => "sans-serif"}San-Serif
26
26
  %option{:value => "serif"}Serif
@@ -28,7 +28,7 @@
28
28
  %option{:value => "jp-mincho"}JP-Mincho
29
29
  %option{:value => "cjk"}CJK
30
30
  .span2
31
- %h4 Fontsize
31
+ %h4 Font-size
32
32
  %select{:name => "fontsize", :style => "width:60px;"}
33
33
  %option{:value => "8"}8
34
34
  %option{:value => "10"}10
@@ -93,7 +93,7 @@
93
93
  %a{:href =>'http://github.com/yohasebe/rsyntaxtree'}http://github.com/yohasebe/rsyntaxtree .
94
94
  %p
95
95
  RSyntaxTree is distributed under
96
- %a{:href => 'http://www.gnu.org/copyleft/gpl.html'}the GNU Public License.
96
+ %a{:href => 'http://www.opensource.org/licenses/mit-license.php'}the MIT License.
97
97
 
98
98
  .span6
99
99
  %h2
@@ -117,13 +117,12 @@
117
117
  label will be automatically numbered. (e.g. NP<sub>1</sub>, NP<sub>2</sub>)</p>
118
118
 
119
119
  %p
120
- RSyntaxTree is capable of generating PNG and SVG files. The latter is very convenient
120
+ RSyntaxTree is not capable of generating PNG, PDF and SVG files. SVG is very convenient
121
121
  for those who want to modify output images on third party vector graphic software
122
- (such as Adobe Illustrator and Microsoft Visio). Just click on the link that appears
123
- below the (non SVG) syntax tree image.
122
+ (such as Adobe Illustrator and Microsoft Visio).
124
123
 
125
124
  %p
126
- Options &#8220;Font&#8221;, &#8220;Fontsize&#8221;, and &#8220;Color&#8221; would be
125
+ Options &#8220;Font-style&#8221;, &#8220;Font-size&#8221;, and &#8220;Color&#8221; would be
127
126
  self-explanatory. You can change the appearance of the resulting image to suit your purpose.
128
127
 
129
128
  %hr
data/views/layout.haml CHANGED
@@ -6,7 +6,7 @@
6
6
  %meta{:name => "description", :content => ""}
7
7
  %meta{:name => "author", :content => ""}
8
8
 
9
- %link{ :href => "/bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
9
+ %link{ :href => "bootstrap/css/bootstrap.css", :type => "text/css", :rel => "stylesheet" }
10
10
 
11
11
  :plain
12
12
  <style type="text/css">
@@ -16,8 +16,8 @@
16
16
  }
17
17
  </style>
18
18
 
19
- %link{ :href => "/bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
20
- %link{ :href => "/css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
19
+ %link{ :href => "bootstrap/css/bootstrap-responsive.css", :type => "text/css", :rel => "stylesheet" }
20
+ %link{ :href => "css/rsyntaxtree.css", :type => "text/css", :rel => "stylesheet" }
21
21
 
22
22
  :plain
23
23
  <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
@@ -26,17 +26,16 @@
26
26
  <![endif]-->
27
27
 
28
28
  / Le fav and touch icons
29
- %link{ rel: "apple-touch-icon", href: "/bootstrap/images/apple-touch-icon.png"}
30
- %link{ rel: "shortcut icon", href: "/bootstrap/images/favicon.ico"}
31
- %link{ rel: "apple-touch-icon", sizes: "72x72", href: "/bootstrap/images/apple-touch-icon-72x72.png"}
32
- %link{ rel: "apple-touch-icon", sizes: "114x114", href: "/bootstrap/images/apple-touch-icon-114x114.png"}
29
+ %link{ rel: "apple-touch-icon", href: "bootstrap/images/apple-touch-icon.png"}
30
+ %link{ rel: "shortcut icon", href: "bootstrap/images/favicon.ico"}
31
+ %link{ rel: "apple-touch-icon", sizes: "72x72", href: "bootstrap/images/apple-touch-icon-72x72.png"}
32
+ %link{ rel: "apple-touch-icon", sizes: "114x114", href: "bootstrap/images/apple-touch-icon-114x114.png"}
33
33
 
34
34
  %body
35
35
  %div= haml :navbar
36
36
  %div= yield
37
37
 
38
38
  / Placed at the end of the document so the pages load faster
39
- %script{ :type => "text/javascript", :src =>"/bootstrap/js/jquery.js"}
40
- %script{ :type => "text/javascript", :src =>"/bootstrap/js/bootstrap.js"}
41
- %script{ :type => "text/javascript", :src =>"/js/rsyntaxtree.js"}
42
-
39
+ %script{ :type => "text/javascript", :src =>"bootstrap/js/jquery.js"}
40
+ %script{ :type => "text/javascript", :src =>"bootstrap/js/bootstrap.js"}
41
+ %script{ :type => "text/javascript", :src =>"js/rsyntaxtree.js"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsyntaxtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-06 00:00:00.000000000 Z
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &70327959540840 !ruby/object:Gem::Requirement
16
+ requirement: &70171855522580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70327959540840
24
+ version_requirements: *70171855522580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &70327959539320 !ruby/object:Gem::Requirement
27
+ requirement: &70171855521840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70327959539320
35
+ version_requirements: *70171855521840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: haml
38
- requirement: &70327959538420 !ruby/object:Gem::Requirement
38
+ requirement: &70171855521120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70327959538420
46
+ version_requirements: *70171855521120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: shotgun
49
- requirement: &70327959537800 !ruby/object:Gem::Requirement
49
+ requirement: &70171855520620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70327959537800
57
+ version_requirements: *70171855520620
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: trollop
60
- requirement: &70327959536820 !ruby/object:Gem::Requirement
60
+ requirement: &70171855520160 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70327959536820
68
+ version_requirements: *70171855520160
69
69
  description: Yet another syntax tree generator made with Ruby and RMagick
70
70
  email:
71
71
  - yohasebe@gmail.com
@@ -112,7 +112,7 @@ files:
112
112
  - views/index.haml
113
113
  - views/layout.haml
114
114
  - views/navbar.haml
115
- homepage: ''
115
+ homepage: http://github.com/yohasebe/rsyntaxtree
116
116
  licenses: []
117
117
  post_install_message:
118
118
  rdoc_options: []