coursegen 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +2 -0
  7. data/bin/cg +4 -0
  8. data/coursegen.gemspec +29 -0
  9. data/lib/coursegen/cli.rb +49 -0
  10. data/lib/coursegen/course/helpers/content_helpers.rb +139 -0
  11. data/lib/coursegen/course/helpers/lecture_helpers.rb +9 -0
  12. data/lib/coursegen/course/helpers/logging_helpers.rb +14 -0
  13. data/lib/coursegen/course/helpers/navigation_helpers.rb +64 -0
  14. data/lib/coursegen/course/helpers/sidebar_helpers.rb +63 -0
  15. data/lib/coursegen/course/lib/citem.rb +88 -0
  16. data/lib/coursegen/course/lib/helpers_.rb +9 -0
  17. data/lib/coursegen/course/lib/lectures.rb +91 -0
  18. data/lib/coursegen/course/lib/schedule_def.rb +13 -0
  19. data/lib/coursegen/course/lib/scheduler.rb +77 -0
  20. data/lib/coursegen/course/lib/search_data_generator.rb +21 -0
  21. data/lib/coursegen/course/lib/section.rb +74 -0
  22. data/lib/coursegen/course/lib/section_def.rb +10 -0
  23. data/lib/coursegen/course/lib/toc.rb +160 -0
  24. data/lib/coursegen/templates.rb +54 -0
  25. data/lib/coursegen/version.rb +3 -0
  26. data/lib/coursegen.rb +23 -0
  27. data/templates/Rules +98 -0
  28. data/templates/cg_config.rb +12 -0
  29. data/templates/cg_config.rb_sample +46 -0
  30. data/templates/content/bootstrap/css/custom.css +187 -0
  31. data/templates/content/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  32. data/templates/content/bootstrap/js/custom.js +7 -0
  33. data/templates/content/content/index.md.erb +4 -0
  34. data/templates/layouts/body_footer.html +8 -0
  35. data/templates/layouts/body_header.html.erb +6 -0
  36. data/templates/layouts/course.html +59 -0
  37. data/templates/layouts/main_navbar.html.erb +21 -0
  38. data/templates/lib/default.rb +5 -0
  39. data/test1/Rules +40 -0
  40. data/test1/content/index.html +14 -0
  41. data/test1/content/stylesheet.css +101 -0
  42. data/test1/layouts/default.html +29 -0
  43. data/test1/lib/default.rb +2 -0
  44. data/test1/nanoc.yaml +62 -0
  45. metadata +159 -0
@@ -0,0 +1,187 @@
1
+ @import url(//fonts.googleapis.com/css?family=Telex);
2
+
3
+ .navbar-inverse {
4
+ background-color: black;
5
+ }
6
+
7
+ .navbar a.navbar-brand {
8
+ color: white;
9
+ padding-top: 7px;
10
+ }
11
+
12
+ .navbar {
13
+ min-height: 35px;
14
+ margin-bottom: 1px;
15
+ }
16
+
17
+ .navbar a:hover {
18
+ color: white;
19
+ }
20
+
21
+ .navbar a {
22
+ padding: 6px;
23
+ color: light-blue;
24
+ }
25
+
26
+ .navbar .input-group-sm input{
27
+ height: 22px;
28
+ width: 150px;
29
+ margin-top: 6px;
30
+ }
31
+
32
+ h1, h2, h3, h4, h5{
33
+ font-family: telex;
34
+ color: rgb(21, 123, 207);
35
+ }
36
+
37
+ h3 {
38
+ margin-bottom: 0px;
39
+ }
40
+
41
+ h4 {
42
+ margin-top: 20px;
43
+ border-top: gainsboro solid 1px;
44
+ padding-top: 5px;
45
+ }
46
+
47
+ h5 {
48
+ margin-top: 15px;
49
+ }
50
+
51
+ body {
52
+ padding-top: 40px;
53
+ padding-bottom: 40px;
54
+ }
55
+
56
+ footer {
57
+ padding-top: 20px;
58
+ }
59
+
60
+ .right-nav ul {
61
+ list-style: none;
62
+ padding-left: 12px;
63
+ margin-top: 3px
64
+ }
65
+
66
+ .right-nav label.level2 {
67
+ margin-bottom: 0px;
68
+ }
69
+
70
+ .right-nav a {
71
+ font-size: 85%;
72
+ }
73
+
74
+ .right-nav label.level1 {
75
+ text-transform: uppercase;
76
+ color: grey;
77
+ margin-top: 10px;
78
+ margin-bottom: 3px;
79
+ }
80
+
81
+ .right-nav label.level2 {
82
+ font-weight: normal;
83
+ }
84
+
85
+ .CodeRay .line-numbers {
86
+ margin-right: 15px;
87
+ }
88
+
89
+ .tree .bold a {
90
+ font-weight: bold;
91
+ }
92
+
93
+ .tree .red a {
94
+ color: red;
95
+ }
96
+ .tree .italic a {
97
+ font-style: italic;
98
+ }
99
+
100
+ .glyphicon-small {
101
+ font-size: 10px;
102
+ }
103
+
104
+ /* Search Page */
105
+ #tipue_search_results_count {
106
+ font-size: 14px;
107
+ color: red;
108
+ font-family: telex;
109
+ }
110
+
111
+ .tipue_search_content_title {
112
+ color: purple;
113
+ font-size: 16px;
114
+ margin-top: 15px;
115
+ margin-left: 10px;
116
+ text-rendering: optimizelegibility;
117
+ font-family: telex;
118
+ }
119
+
120
+ .tipue_search_content_text {
121
+ font-size: 14px;
122
+ margin-left: 30px;
123
+ }
124
+
125
+ div.tipue_search_content_loc a {
126
+ font-size: 14px;
127
+ margin-left: 20px;
128
+ display: none;
129
+ }
130
+
131
+ #tipue_search_foot
132
+ {
133
+ margin: 51px 0 21px 0;
134
+ }
135
+ #tipue_search_foot_boxes
136
+ {
137
+ padding: 0;
138
+ margin: 0;
139
+ font: 12px/1 'Open Sans', sans-serif;
140
+ }
141
+ #tipue_search_foot_boxes li
142
+ {
143
+ list-style: none;
144
+ margin: 0;
145
+ padding: 0;
146
+ display: inline;
147
+ }
148
+ #tipue_search_foot_boxes li a
149
+ {
150
+ padding: 9px 15px 10px 15px;
151
+ background-color: #f1f1f1;
152
+ border: 1px solid #dcdcdc;
153
+ border-radius: 1px;
154
+ color: #333;
155
+ margin-right: 7px;
156
+ text-decoration: none;
157
+ text-align: center;
158
+ }
159
+ #tipue_search_foot_boxes li.current
160
+ {
161
+ padding: 9px 15px 10px 15px;
162
+ background: #fff;
163
+ border: 1px solid #dcdcdc;
164
+ border-radius: 1px;
165
+ color: #333;
166
+ margin-right: 7px;
167
+ text-align: center;
168
+ }
169
+ #tipue_search_foot_boxes li a:hover
170
+ {
171
+ border: 1px solid #ccc;
172
+ background-color: #f3f3f3;
173
+ }
174
+
175
+
176
+
177
+
178
+ @media (max-width: 980px) {
179
+
180
+ /* Enable use of floated navbar text */
181
+ .navbar-text.pull-right {
182
+ float: none;
183
+ padding-left: 5px;
184
+ padding-right: 5px;
185
+ }
186
+ }
187
+
@@ -0,0 +1,7 @@
1
+ $('label.tree-toggler').click(function () {
2
+ $(this).parent().children('ul.tree').toggle(100);
3
+ });
4
+
5
+ $(document).ready(function(){
6
+ $("[rel=tooltip]").tooltip({ placement: 'bottom'});
7
+ });
@@ -0,0 +1,4 @@
1
+ ---
2
+ title: Welcome!
3
+ section: background
4
+ ---
@@ -0,0 +1,8 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-xs-12">
4
+ <footer><%= COPYRIGHT_STRING %></footer>
5
+ </div>
6
+ </div>
7
+ </div>
8
+
@@ -0,0 +1,6 @@
1
+ <h3>
2
+ <%= citem.title %>
3
+ <% if citem.is_lecture? %>
4
+ <small class="pull-right">(<%= citem.lecture_date_s %>, <%= citem.lecture_number_s.to_s %>)</small>
5
+ <% end %>
6
+ </h4>
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= @item[:title] %> - <%= COURSE_SHORT_NAME %></title>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+
8
+ <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
9
+ <link rel="stylesheet" href="/bootstrap/css/custom.css">
10
+
11
+ <!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400" rel="stylesheet">
12
+ -->
13
+ <script src="https://code.jquery.com/jquery.js"></script>
14
+
15
+ <script src="/tipuesearch/js/tipuesearch_content.js"></script>
16
+ <!-- <link href="/tipuesearch/css/tipuesearch.css" rel="stylesheet"> -->
17
+ <script src="/tipuesearch/js/tipuesearch_set.js"></script>
18
+ <script src="/tipuesearch/js/tipuesearch.js"></script>
19
+
20
+
21
+ <!-- you don't need to keep this, but it's cool for stats! -->
22
+ <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
23
+ </head>
24
+ <body>
25
+
26
+ <% @citem = Toc.instance.n2c(@item) %>
27
+ <div class="navbar navbar-inverse navbar-fixed-top">
28
+ <%= render "main_navbar", toc: Toc.instance, item: item, citem: @citem %>
29
+ </div>
30
+ <div class="container">
31
+ <div class="row">
32
+ <div class="col-xs-12">
33
+ <%= render "body_header", toc: Toc.instance, item: item, citem: @citem %>
34
+ </div>
35
+ </div>
36
+ <div class="row">
37
+ <div class="col-xs-9">
38
+ <%= yield %>
39
+ </div>
40
+ <div class="col-xs-3 well right-nav">
41
+ <ul>
42
+ <% SECTION_CONFIG.each do |sbb| %>
43
+ <%= section_helper(title: sbb.title, selector: sbb.selector) unless sbb.options[:hidden] %>
44
+ <% end %>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <%= render "body_footer" %>
49
+ </div>
50
+ <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
51
+ <!-- Include all compiled plugins (below), or include individual files as needed -->
52
+ <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
53
+ <script src="/bootstrap/js/custom.js"></script>
54
+ <script> $(document).ready(function() {
55
+ $('#tipue_search_input').tipuesearch();
56
+ });</script>
57
+
58
+ </body>
59
+ </html>
@@ -0,0 +1,21 @@
1
+ <div class="container">
2
+ <div class="row">
3
+ <div class="col-xs-7">
4
+ <a class="navbar-brand" href="/"><%= COURSE_SHORT_NAME %> - <%= COURSE_LONG_NAME %></a>
5
+ </div>
6
+ <div class="col-xs-2">
7
+ <div class="btn-group">
8
+ <%if citem.section != "root" %>
9
+ <%= link_to_prev toc, item %> <%= link_to_next toc, item %>
10
+ <% end %>
11
+ </div>
12
+ </div>
13
+ <div class="col-xs-3">
14
+ <form role="form" class="form-inline" action="/search_index/search/index.html">
15
+ <div class="input-group input-group-sm">
16
+ <input type="text" name="q" id="tipue_search_input" placeholder="search..."class="form-control">
17
+ </div>
18
+ </form>
19
+ </div>
20
+ </div>
21
+ </div>
@@ -0,0 +1,5 @@
1
+ # All files in the 'lib' directory will be loaded
2
+ # before nanoc starts compiling.
3
+
4
+ require 'coursegen'
5
+
data/test1/Rules ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # A few helpful tips about the Rules file:
4
+ #
5
+ # * The string given to #compile and #route are matching patterns for
6
+ # identifiers--not for paths. Therefore, you can’t match on extension.
7
+ #
8
+ # * The order of rules is important: for each item, only the first matching
9
+ # rule is applied.
10
+ #
11
+ # * Item identifiers start and end with a slash (e.g. “/about/” for the file
12
+ # “content/about.html”). To select all children, grandchildren, … of an
13
+ # item, use the pattern “/about/*/”; “/about/*” will also select the parent,
14
+ # because “*” matches zero or more characters.
15
+
16
+ compile '*' do
17
+ if item[:extension] == 'css'
18
+ # don’t filter stylesheets
19
+ elsif item.binary?
20
+ # don’t filter binary items
21
+ else
22
+ filter :erb
23
+ layout 'default'
24
+ end
25
+ end
26
+
27
+ route '*' do
28
+ if item[:extension] == 'css'
29
+ # Write item with identifier /foo/ to /foo.css
30
+ item.identifier.chop + '.css'
31
+ elsif item.binary?
32
+ # Write item with identifier /foo/ to /foo.ext
33
+ item.identifier.chop + '.' + item[:extension]
34
+ else
35
+ # Write item with identifier /foo/ to /foo/index.html
36
+ item.identifier + 'index.html'
37
+ end
38
+ end
39
+
40
+ layout '*', :erb
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: Home
3
+ ---
4
+
5
+ <h1>A Brand New nanoc Site</h1>
6
+
7
+ <p>You’ve just created a new nanoc site. The page you are looking at right now is the home page for your site. To get started, consider replacing this default homepage with your own customized homepage. Some pointers on how to do so:</p>
8
+
9
+ <ul>
10
+ <li><p><strong>Change this page’s content</strong> by editing the “index.html” file in the “content” directory. This is the actual page content, and therefore doesn’t include the header, sidebar or style information (those are part of the layout).</p></li>
11
+ <li><p><strong>Change the layout</strong>, which is the “default.html” file in the “layouts” directory, and create something unique (and hopefully less bland).</p></li>
12
+ </ul>
13
+
14
+ <p>If you need any help with customizing your nanoc web site, be sure to check out the documentation (see sidebar), and be sure to subscribe to the discussion group (also see sidebar). Enjoy!</p>
@@ -0,0 +1,101 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+
5
+ font-family: Georgia, Palatino, serif;
6
+ }
7
+
8
+ body {
9
+ background: #fff;
10
+ }
11
+
12
+ a {
13
+ text-decoration: none;
14
+ }
15
+
16
+ a:link,
17
+ a:visited {
18
+ color: #f30;
19
+ }
20
+
21
+ a:hover {
22
+ color: #f90;
23
+ }
24
+
25
+ #main {
26
+ position: absolute;
27
+
28
+ top: 40px;
29
+ left: 280px;
30
+
31
+ width: 500px;
32
+ }
33
+
34
+ #main h1 {
35
+ font-size: 40px;
36
+ font-weight: normal;
37
+
38
+ line-height: 40px;
39
+
40
+ letter-spacing: -1px;
41
+ }
42
+
43
+ #main p {
44
+ margin: 20px 0;
45
+
46
+ font-size: 15px;
47
+
48
+ line-height: 20px;
49
+ }
50
+
51
+ #main ul, #main ol {
52
+ margin: 20px;
53
+ }
54
+
55
+ #main li {
56
+ font-size: 15px;
57
+
58
+ line-height: 20px;
59
+ }
60
+
61
+ #main ul li {
62
+ list-style-type: square;
63
+ }
64
+
65
+ #sidebar {
66
+ position: absolute;
67
+
68
+ top: 40px;
69
+ left: 20px;
70
+ width: 200px;
71
+
72
+ padding: 20px 20px 0 0;
73
+
74
+ border-right: 1px solid #ccc;
75
+
76
+ text-align: right;
77
+ }
78
+
79
+ #sidebar h2 {
80
+ text-transform: uppercase;
81
+
82
+ font-size: 13px;
83
+
84
+ color: #333;
85
+
86
+ letter-spacing: 1px;
87
+
88
+ line-height: 20px;
89
+ }
90
+
91
+ #sidebar ul {
92
+ list-style-type: none;
93
+
94
+ margin: 20px 0;
95
+ }
96
+
97
+ #sidebar li {
98
+ font-size: 14px;
99
+
100
+ line-height: 20px;
101
+ }
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>A Brand New nanoc Site - <%= @item[:title] %></title>
6
+ <link rel="stylesheet" href="<%= @items['/stylesheet/'].path %>">
7
+
8
+ <!-- you don't need to keep this, but it's cool for stats! -->
9
+ <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
10
+ </head>
11
+ <body>
12
+ <div id="main">
13
+ <%= yield %>
14
+ </div>
15
+ <div id="sidebar">
16
+ <h2>Documentation</h2>
17
+ <ul>
18
+ <li><a href="http://nanoc.ws/docs/">Documentation</a></li>
19
+ <li><a href="http://nanoc.ws/docs/tutorial/">Getting Started</a></li>
20
+ </ul>
21
+ <h2>Community</h2>
22
+ <ul>
23
+ <li><a href="http://groups.google.com/group/nanoc/">Discussion Group</a></li>
24
+ <li><a href="irc://chat.freenode.net/#nanoc">IRC Channel</a></li>
25
+ <li><a href="http://github.com/nanoc/nanoc/wiki/">Wiki</a></li>
26
+ </ul>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,2 @@
1
+ # All files in the 'lib' directory will be loaded
2
+ # before nanoc starts compiling.
data/test1/nanoc.yaml ADDED
@@ -0,0 +1,62 @@
1
+ # A list of file extensions that nanoc will consider to be textual rather than
2
+ # binary. If an item with an extension not in this list is found, the file
3
+ # will be considered as binary.
4
+ text_extensions: [ 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'html', 'js', 'less', 'markdown', 'md', 'ms', 'mustache', 'php', 'rb', 'sass', 'scss', 'txt', 'xhtml', 'xml' ]
5
+
6
+ # The path to the directory where all generated files will be written to. This
7
+ # can be an absolute path starting with a slash, but it can also be path
8
+ # relative to the site directory.
9
+ output_dir: output
10
+
11
+ # A list of index filenames, i.e. names of files that will be served by a web
12
+ # server when a directory is requested. Usually, index files are named
13
+ # “index.html”, but depending on the web server, this may be something else,
14
+ # such as “default.htm”. This list is used by nanoc to generate pretty URLs.
15
+ index_filenames: [ 'index.html' ]
16
+
17
+ # Whether or not to generate a diff of the compiled content when compiling a
18
+ # site. The diff will contain the differences between the compiled content
19
+ # before and after the last site compilation.
20
+ enable_output_diff: false
21
+
22
+ prune:
23
+ # Whether to automatically remove files not managed by nanoc from the output
24
+ # directory. For safety reasons, this is turned off by default.
25
+ auto_prune: false
26
+
27
+ # Which files and directories you want to exclude from pruning. If you version
28
+ # your output directory, you should probably exclude VCS directories such as
29
+ # .git, .svn etc.
30
+ exclude: [ '.git', '.hg', '.svn', 'CVS' ]
31
+
32
+ # The data sources where nanoc loads its data from. This is an array of
33
+ # hashes; each array element represents a single data source. By default,
34
+ # there is only a single data source that reads data from the “content/” and
35
+ # “layout/” directories in the site directory.
36
+ data_sources:
37
+ -
38
+ # The type is the identifier of the data source. By default, this will be
39
+ # `filesystem_unified`.
40
+ type: filesystem_unified
41
+
42
+ # The path where items should be mounted (comparable to mount points in
43
+ # Unix-like systems). This is “/” by default, meaning that items will have
44
+ # “/” prefixed to their identifiers. If the items root were “/en/”
45
+ # instead, an item at content/about.html would have an identifier of
46
+ # “/en/about/” instead of just “/about/”.
47
+ items_root: /
48
+
49
+ # The path where layouts should be mounted. The layouts root behaves the
50
+ # same as the items root, but applies to layouts rather than items.
51
+ layouts_root: /
52
+
53
+ # Whether to allow periods in identifiers. When turned off, everything
54
+ # past the first period is considered to be the extension, and when
55
+ # turned on, only the characters past the last period are considered to
56
+ # be the extension. For example, a file named “content/about.html.erb”
57
+ # will have the identifier “/about/” when turned off, but when turned on
58
+ # it will become “/about.html/” instead.
59
+ allow_periods_in_identifiers: false
60
+
61
+ # The default encoding for all files in `content/` and `layouts/`.
62
+ encoding: utf-8