ontology 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/LICENSE +19 -0
  2. data/NEWS.md +7 -0
  3. data/README.md +36 -0
  4. data/bin/ontology +83 -0
  5. data/doc/Change_Log_txt.html +97 -0
  6. data/doc/Gemfile.html +93 -0
  7. data/doc/LICENSE.html +111 -0
  8. data/doc/Object.html +230 -0
  9. data/doc/Ontology.html +791 -0
  10. data/doc/Ontology/Leaf.html +370 -0
  11. data/doc/bin/ontology.html +193 -0
  12. data/doc/created.rid +17 -0
  13. data/doc/images/add.png +0 -0
  14. data/doc/images/brick.png +0 -0
  15. data/doc/images/brick_link.png +0 -0
  16. data/doc/images/bug.png +0 -0
  17. data/doc/images/bullet_black.png +0 -0
  18. data/doc/images/bullet_toggle_minus.png +0 -0
  19. data/doc/images/bullet_toggle_plus.png +0 -0
  20. data/doc/images/date.png +0 -0
  21. data/doc/images/delete.png +0 -0
  22. data/doc/images/find.png +0 -0
  23. data/doc/images/loadingAnimation.gif +0 -0
  24. data/doc/images/macFFBgHack.png +0 -0
  25. data/doc/images/package.png +0 -0
  26. data/doc/images/page_green.png +0 -0
  27. data/doc/images/page_white_text.png +0 -0
  28. data/doc/images/page_white_width.png +0 -0
  29. data/doc/images/plugin.png +0 -0
  30. data/doc/images/ruby.png +0 -0
  31. data/doc/images/tag_blue.png +0 -0
  32. data/doc/images/tag_green.png +0 -0
  33. data/doc/images/transparent.png +0 -0
  34. data/doc/images/wrench.png +0 -0
  35. data/doc/images/wrench_orange.png +0 -0
  36. data/doc/images/zoom.png +0 -0
  37. data/doc/index.html +88 -0
  38. data/doc/js/darkfish.js +153 -0
  39. data/doc/js/jquery.js +18 -0
  40. data/doc/js/navigation.js +142 -0
  41. data/doc/js/search.js +94 -0
  42. data/doc/js/search_index.js +1 -0
  43. data/doc/js/searcher.js +228 -0
  44. data/doc/rdoc.css +543 -0
  45. data/doc/table_of_contents.html +110 -0
  46. data/lib/ontology.rb +11 -0
  47. data/lib/ontology/error_message.rb +17 -0
  48. data/lib/ontology/leaf.rb +57 -0
  49. data/lib/ontology/load_config_yaml.rb +13 -0
  50. data/lib/ontology/make_glossary.rb +128 -0
  51. data/lib/ontology/write_file.rb +10 -0
  52. data/lib/ontology/yaml_utils.rb +74 -0
  53. data/ontology.gemspec +32 -0
  54. data/spec/config.yaml +3 -0
  55. data/spec/decompose_md_file_spec.rb +417 -0
  56. data/spec/leaf_spec.rb +13 -0
  57. data/spec/test.md +5 -0
  58. data/spec/test_make_glossary.rb +68 -0
  59. data/spec/write_md_file_spec.rb +23 -0
  60. data/spec/yaml_utils_spec.rb +39 -0
  61. metadata +109 -0
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2012 Mathias Foehr and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/NEWS.md ADDED
@@ -0,0 +1,7 @@
1
+ #ontology news
2
+
3
+ ##ontology 0.0.1 - Sept. 12 2012
4
+
5
+ Initial release, the code is at alpha stage.
6
+
7
+ so beware
@@ -0,0 +1,36 @@
1
+ #ontology
2
+
3
+ ontology is a helper to generate dictionary pages.
4
+
5
+ Ontology is designed to work a static web site environment. I use it with the nanoc static website generator developped by Didier Defreyne http://nanoc.stoneship.org/ . Ontology is written in Ruby and if you want to hack the code, some Ruby knowledge might help
6
+
7
+ ontology is designed from ground up to work in a multi-language environment. However the whole system is conceived to work at no cost in a similar way in a single language environment
8
+
9
+ ##Beware
10
+
11
+ Conceptually, ontology is a tool which generates from your text glossary or dictionary entries which are usually written in the directories you are maintaining. So it is possible that through whatever reason, you might overwrite valuable files of yours.
12
+
13
+ And you should definitely take care of this !!
14
+
15
+ config.yaml (or whatever you choose to call your configuration files) has two entries for each glossary.
16
+
17
+ ontology:
18
+ source: my_glossary
19
+ destination:
20
+ fr: content/fr/mon_glossaire
21
+ de: c
22
+ en: content/en/my_glossary
23
+
24
+ Be aware that, with this configuration, you will routinel write to the directories content/fr/mon_glossaire, content/fr/mon_glossaire and content/en/my_glossary.
25
+
26
+ They are within the content directory, you tend to consider as yours ... So take care!!!
27
+
28
+ ##Resources
29
+
30
+ The project home page is here <www.mathiasfoehr.lu/ontology>
31
+
32
+ and the files are at <rubyforge.org/projects/ontology/>
33
+
34
+ ##Contact
35
+
36
+ You can reach me at <mf_tech@mathiasfoehr.lu>
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ require 'optparse'
5
+ require 'ontology'
6
+ include Ontology
7
+
8
+ $options = {}
9
+ option_parser = OptionParser.new do |opts|
10
+ opts.on('-c file', '--config-file file') do |file|
11
+ $options[:config_file] = file
12
+ puts "config_file #{file}"
13
+ end
14
+ opts.on("-d", "--display") do
15
+ $options[:display] = true
16
+ puts "display #{options[:display]}"
17
+ end
18
+ opts.on('-b', '--build') do
19
+ $options[:build] = true
20
+ end
21
+ opts.on('-s', '--simulate') do
22
+ $options[:simulate] = true
23
+ end
24
+ opts.on('-g glos', '--glossary glos') do
25
+ $options[:glossary] = glos
26
+ end
27
+ opts.on('-f file', '--file file') do
28
+ $options[:file] = file
29
+ end
30
+ opts.on('-v', '--verbose') do
31
+ $options[:verbose] = true
32
+ end
33
+ end
34
+ option_parser.parse!
35
+
36
+ $options[:config_file] ||= 'config.yaml'
37
+
38
+ $options[:glossary] ||= :all
39
+ $options[:file] ||= :all
40
+
41
+ puts $options.inspect
42
+
43
+ Base_dir = Dir.pwd
44
+ begin
45
+ File.open($options[:config_file], 'rb') do |f1|
46
+ data_str = f1.read
47
+ load_config_pars(data_str)
48
+ end
49
+ rescue
50
+ error_message_abort "#{$options[:config_file]} does not exist in the current directory, aborting"
51
+ end
52
+
53
+ unless $options[:display] || $options[:build] || $options[:simulate]
54
+ puts "You must specify one and only one command ie -d --display, or -b --build, or -s --simulate"
55
+ exit 1
56
+ end
57
+ if $options[:display] && $options[:build] && $options[:simulate]
58
+ puts "You can only specify one command ie -d --display, or -b --build, or -s --simulate"
59
+ exit 1
60
+ end
61
+ if $options[:display] && $options[:build]
62
+ puts "You cannot only specify --display and --build together"
63
+ exit 1
64
+ end
65
+ if $options[:display] && $options[:simulate]
66
+ puts "You cannot only specify --display and --simulate together"
67
+ exit 1
68
+ end
69
+ if $options[:build] && $options[:simulate]
70
+ puts "You cannot only specify --build and --simulate together"
71
+ exit 1
72
+ end
73
+ if $options[:display]
74
+ puts $data_symb
75
+ elsif ($options[:build] || $options[:simulate])
76
+ puts $data_symb
77
+
78
+ $data_symb[:ontology][:glossaries].each {|glos_symb|
79
+ puts glos_symb.to_s
80
+ build_glossary glos_symb
81
+ puts "======================"
82
+ }
83
+ end
@@ -0,0 +1,97 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Change_Log - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Change_Log_txt.html">Change_Log</a>
53
+
54
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
55
+
56
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
57
+
58
+ <li class="file"><a href="./bin/ontology.html">ontology</a>
59
+
60
+ </ul>
61
+ </nav>
62
+
63
+ <nav id="classindex-section" class="section project-section">
64
+ <h3 class="section-header">Class and Module Index</h3>
65
+
66
+ <ul class="link-list">
67
+
68
+ <li><a href="./Ontology.html">Ontology</a>
69
+
70
+ <li><a href="./Ontology/Leaf.html">Ontology::Leaf</a>
71
+
72
+ <li><a href="./Object.html">Object</a>
73
+
74
+ </ul>
75
+ </nav>
76
+
77
+ </div>
78
+ </nav>
79
+
80
+ <div id="documentation" class="description">
81
+
82
+ <p>For release notes, please see the NEWS file.</p>
83
+
84
+ <p>For a list of all changes, please see the changelog on the project
85
+ repository at (<a
86
+ href="http://rubyforge.org/projects/ontology/">rubyforge.org/projects/ontology/</a>).</p>
87
+
88
+ </div>
89
+
90
+
91
+
92
+ <footer id="validator-badges">
93
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
94
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
95
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
96
+ </footer>
97
+
@@ -0,0 +1,93 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>Gemfile - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Change_Log_txt.html">Change_Log</a>
53
+
54
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
55
+
56
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
57
+
58
+ <li class="file"><a href="./bin/ontology.html">ontology</a>
59
+
60
+ </ul>
61
+ </nav>
62
+
63
+ <nav id="classindex-section" class="section project-section">
64
+ <h3 class="section-header">Class and Module Index</h3>
65
+
66
+ <ul class="link-list">
67
+
68
+ <li><a href="./Ontology.html">Ontology</a>
69
+
70
+ <li><a href="./Ontology/Leaf.html">Ontology::Leaf</a>
71
+
72
+ <li><a href="./Object.html">Object</a>
73
+
74
+ </ul>
75
+ </nav>
76
+
77
+ </div>
78
+ </nav>
79
+
80
+ <div id="documentation" class="description">
81
+
82
+ <p>source :rubygems gemspec</p>
83
+
84
+ </div>
85
+
86
+
87
+
88
+ <footer id="validator-badges">
89
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
90
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
91
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
92
+ </footer>
93
+
@@ -0,0 +1,111 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>LICENSE - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./Change_Log_txt.html">Change_Log</a>
53
+
54
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
55
+
56
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
57
+
58
+ <li class="file"><a href="./bin/ontology.html">ontology</a>
59
+
60
+ </ul>
61
+ </nav>
62
+
63
+ <nav id="classindex-section" class="section project-section">
64
+ <h3 class="section-header">Class and Module Index</h3>
65
+
66
+ <ul class="link-list">
67
+
68
+ <li><a href="./Ontology.html">Ontology</a>
69
+
70
+ <li><a href="./Ontology/Leaf.html">Ontology::Leaf</a>
71
+
72
+ <li><a href="./Object.html">Object</a>
73
+
74
+ </ul>
75
+ </nav>
76
+
77
+ </div>
78
+ </nav>
79
+
80
+ <div id="documentation" class="description">
81
+
82
+ <p>Copyright © 2012 Mathias Foehr and contributors</p>
83
+
84
+ <p>Permission is hereby granted, free of charge, to any person obtaining a
85
+ copy of this software and associated documentation files (the “Software”),
86
+ to deal in the Software without restriction, including without limitation
87
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
88
+ and/or sell copies of the Software, and to permit persons to whom the
89
+ Software is furnished to do so, subject to the following conditions:</p>
90
+
91
+ <p>The above copyright notice and this permission notice shall be included in
92
+ all copies or substantial portions of the Software.</p>
93
+
94
+ <p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
95
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
96
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
97
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
98
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
99
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
100
+ DEALINGS IN THE SOFTWARE.</p>
101
+
102
+ </div>
103
+
104
+
105
+
106
+ <footer id="validator-badges">
107
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
108
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
109
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
110
+ </footer>
111
+