Permalink
Browse files

Reorganise build process

  • Loading branch information...
1 parent 9f9a1c3 commit b6ae002afe852f0f8166f41b0c29cba834e01447 @runpaint committed Jun 12, 2010
Showing with 552 additions and 356 deletions.
  1. +42 −353 Rakefile
  2. +3 −3 templates/chapter.rhtml → chapter.mustache
  3. +272 −0 chapter_css.mustache
  4. 0 { → chapters}/classes.html
  5. 0 { → chapters}/closures.html
  6. 0 { → chapters}/enumerables.html
  7. 0 { → chapters}/files.html
  8. 0 { → chapters}/flow.html
  9. 0 { → chapters}/io.html
  10. 0 { → chapters}/keywords.html
  11. 0 { → chapters}/messages.html
  12. 0 { → chapters}/methods.html
  13. 0 { → chapters}/modules.html
  14. 0 { → chapters}/numerics.html
  15. 0 { → chapters}/objects.html
  16. 0 { → chapters}/programs.html
  17. 0 { → chapters}/punctuation.html
  18. 0 { → chapters}/references.html
  19. 0 { → chapters}/text.html
  20. 0 { → chapters}/variables.html
  21. +1 −0 css/chapter.mustache
  22. +1 −0 css/index.mustache
  23. +1 −0 css/main.mustache
  24. +1 −0 css/syntax.mustache
  25. +1 −0 css/toc.mustache
  26. +1 −0 example.mustache
  27. +13 −0 footnote.mustache
  28. +2 −0 index_css.mustache
  29. 0 { → js}/ui.js
  30. +46 −0 lib/read-ruby.rb
  31. +69 −0 lib/read-ruby/chapter.rb
  32. +14 −0 lib/read-ruby/example.rb
  33. +13 −0 lib/read-ruby/railroad.rb
  34. +5 −0 lib/read-ruby/root.rb
  35. +16 −0 lib/read-ruby/sitemap.rb
  36. +13 −0 lib/read-ruby/toc.rb
  37. BIN railroads/def-expression.png
  38. +1 −0 index.html → root.mustache
  39. +4 −0 sitemap.xml → sitemap.mustache
  40. +2 −0 test.mustache
  41. +1 −0 toc.html → toc.mustache
  42. +3 −0 toc_css.mustache
  43. +1 −0 { → www}/.htstatic
  44. +1 −0 www/chapter.css
  45. +1 −0 www/classes.html
  46. +1 −0 www/closures.html
  47. +1 −0 www/enumerables.html
  48. +1 −0 www/examples
  49. +1 −0 www/files.html
  50. +1 −0 www/flow.html
  51. +1 −0 www/fonts
  52. 0 { → www}/google18c41b892eabf75d.html
  53. +1 −0 www/index.css
  54. +1 −0 www/index.html
  55. +1 −0 www/io.html
  56. +1 −0 www/keywords.html
  57. +1 −0 www/messages.html
  58. +1 −0 www/methods.html
  59. +1 −0 www/modules.html
  60. +1 −0 www/objects.html
  61. +1 −0 www/programs.html
  62. +1 −0 www/punctuation.html
  63. +1 −0 www/railroads
  64. +1 −0 www/references.html
  65. 0 { → www}/robots.txt
  66. +1 −0 www/sitemap.xml
  67. BIN { → www}/small-strawberry.jpeg
  68. +1 −0 www/text.html
  69. +1 −0 www/toc.css
  70. +1 −0 www/toc.html
  71. +1 −0 www/ui.js
  72. +1 −0 www/variables.html
View
395 Rakefile
Oops, something went wrong.
@@ -1,7 +1,7 @@
<!doctype html>
<link href=http://fonts.googleapis.com/css?family=OFL+Sorts+Mill+Goudy+TT|Inconsolata rel=stylesheet>
<meta charset=utf-8>
-<title><%= title %> (Read Ruby 1.9)</title>
+<title>{{{ title }}} (Read Ruby 1.9)</title>
<link href=/chapter rel=stylesheet>
<link rel=license href=//creativecommons.org/licenses/by-nc-sa/2.0/uk/>
<link rel='index up' href=/toc>
@@ -16,13 +16,13 @@
<nav>
<ol>
<li><a href=/toc>Read Ruby</a>
- <li><%= title %> <span>(draft)</span>
+ <li>{{{ title }}} <span>(draft)</span>
</ol>
</nav>
</header>
<article>
-<%= article %>
+{{{ article }}}
</article>
<footer>
View
@@ -0,0 +1,272 @@
+{{> css/main}}
+/***********
+ * *
+ * LINKS *
+ * *
+ ***********/
+
+/* Make in-book links less dominant */
+
+article a[href^="#"]:link, article a[href^="/"]:link {
+ color: black;
+ text-decoration: none;
+ border-bottom: 1px dotted;
+}
+
+article a[href^="#"]:visited, article a[href^="/"]:visited {
+ color: gray;
+ text-decoration: none;
+ border-bottom: 1px dotted;
+}
+
+/* Mute the colours of external links */
+article a[href^="//"]:link, article a[href^="http:"]:link {
+ color: #6495ED;
+ text-decoration: underline;
+}
+
+article a[href^="//"]:visited, article a[href^="http"]:visited {
+ color: #9966CC;
+ text-decoration: underline;
+}
+
+/* Hardcode quotation marks. The UA should do this, of course, but for some
+ inexplicable reason, Chromium was messing up the opening mark. */
+
+q:before {
+ content: '“';
+}
+
+q:after {
+ content: '”';
+}
+
+/* We can’t use a simple class selector because it doesn’t have high-enough
+ * specificity. !important is an option, of course...
+ */
+a[href^="#fn-"]:link, a[href^="#fn-"]:visited, a[href^="#fn-"]:hover, a[href^="#fn-"]:active {
+ text-decoration: none;
+ border-bottom: none;
+ font-weight: bold;
+}
+
+/* The header is a strip that runs across the top of the screen and holds the
+ * breadcrumb.
+ */
+header {
+ margin: 0;
+ padding: 0;
+ font-size: large;
+ width: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+
+/* The book name is hidden because it's repeated in the breadcrumb */
+header > h1 {
+ display: none;
+}
+
+/* The breadcrumb is marked up as a list, but we want it to display inline */
+header li, header ol, header nav { display: inline; }
+
+/* The breacrumb should be indented slightly from the left; flush with all
+ * other margins.
+ */
+header > nav > ol {
+ margin: 0;
+ padding: 0 0 0 0.5em;
+}
+
+/* The crumbs should be separated by an arrow. */
+header > nav > ol > li + li:before {
+ content: " \2192 ";
+}
+
+/* The crumbs should be bold. */
+header li {
+ font-weight: bold;
+}
+
+/* The beta label following the chapter name in the breadcrumb should be red.
+ */
+header > nav > ol > li > span {
+ color: red;
+}
+
+/* The page content needs a top margin to separate it from the header. */
+article {
+ margin-top: 2em;
+}
+
+article > h1, body > section > h1 {
+ font-size: 500%;
+ text-transform: uppercase;
+ text-align: center;
+ line-height: 80%;
+ margin: 0;
+}
+article > section > h1 {
+ font-size: 200%;
+ text-align: center;
+}
+
+article > section > section > h1 {
+ font-size: 125%;
+}
+
+article > section > section > section > h1 {
+ font-size: 110%;
+}
+code {
+ font-family: Inconsolata, 'Courier New', 'Courier', monospace;
+ font-size: 80%;
+}
+
+h1.runin {
+ font-size: 100%;
+ font-weight: bold;
+ display: run-in;
+ padding-right: 0.5em;
+ margin-right:0;
+ margin-bottom:0;
+ margin-left: 0;
+}
+
+figure {
+ padding-left: 1em;
+}
+
+
+figure.railroad {
+ margin-right: 0;
+ margin-left: -12%;
+ border: none;
+}
+figure > img {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+figcaption {
+ display: none;
+ font-size: small;
+ font-style: italic;
+}
+figure.railroad > figcaption {
+ text-align: center;
+}
+
+a.fn, a.returner {
+ font-weight: bold;
+}
+
+ol.footnote-popup {
+ position: absolute;
+ width: 600px;
+}
+
+li.footnote-container {
+ position: relative;
+ padding: 0.9em;
+ margin-top: 1em;
+ margin-bottom: 18px;
+ background-color: #fff;
+ border: 1px #cccccc solid;
+}
+
+/***********
+ * *
+ * LISTS *
+ * *
+ ***********/
+
+dl.inline dt {
+ display: run-in;
+ padding-right: 1em;
+}
+
+/***********
+ * *
+ * TABLES *
+ * *
+ ***********/
+table {
+ margin-left: auto;
+ margin-right: auto;
+}
+table.border thead {
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+}
+
+/* All table cells are bordered with a thin black line */
+table.border, table.border th, table.border tr, table.border td {
+ border-collapse: collapse;
+ padding-left: 5px;
+ padding-right: 5px;
+}
+
+/* Table headings are bold and centered */
+tbody > th, th {
+ text-align: center
+ display: inline;
+ font-weight: bold;
+}
+
+/* The following two styles are for zebra striping table rows. The first is
+ * cleaner, but assumes no rowspans; the second relies on a class being
+ * applied manually to such tables. */
+
+tbody.zebra tr:nth-child(2n+1) {
+ background-color: #F5F5F5;
+}
+
+tbody > tr.odd {
+ background-color: #F5F5F5;
+}
+
+/* Table captions are similar to figure captions. They are centered below the
+ * table, in a slightly smaller, italic font */
+table > caption {
+ caption-side: bottom;
+ margin-top: 2%;
+ padding-top: 2%;
+ text-align: center;
+ font-style: italic;
+ font-size: 90%;
+}
+
+details {
+ display: block;
+}
+
+details > * {
+ display: none;
+}
+
+details.open > *, /* sigh :-( http://twitter.com/rem/status/2178972149 */
+details[open] > * {
+ display: block;
+}
+
+details > summary:first-child {
+ display: block;
+ cursor: pointer;
+}
+
+details[open] {
+ display: block;
+}
+
+body > footer {
+ text-align: center;
+ font-style: italic;
+ font-size: small;
+}
+
+body > footer:before {
+ content: "\2767";
+}
+{{> css/syntax}}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
View
View
View
View
View
@@ -0,0 +1 @@
+<a href={{{ path }}}>{{{ html }}}</a>
View
@@ -0,0 +1,13 @@
+{{^returner}}
+<sup>
+ <a href="#fn-{{ name }}-{{ index }}" class="fn" id="ref-{{ name }}-{{ index }}"
+ title="View footnote">{{ index }}
+ </a>
+</sup>
+{{/returner}}
+{{#returner}}
+ <a class=returner
+ href=#ref-{{ name }}-{{ index }}
+ title='Return to where you left off'>&#8617;
+ </a>
+{{/returner}}
View
@@ -0,0 +1,2 @@
+{{> css/main }}
+{{> css/index }}
View
File renamed without changes.
View
@@ -0,0 +1,46 @@
+%w{mustache nokogiri pathname uri}.each{|n| require n}
+
+module ReadRuby
+
+ CHAPTERS = %w{programs variables messages methods objects classes modules
+ closures flow text enumerables io files punctuation keywords references}
+ OUT_DIR = Pathname 'out'
+ PRISTINE_DIR = Pathname 'www'
+ TEMPLATE_EXT = '.mustache'
+ ROOT_URL = URI.parse 'http://ruby.runpaint.org/'
+
+ def dir name=nil
+ name ? @dir = Pathname(name) : @dir
+ end
+
+ def target_ext ext=nil
+ extension ext, :@target_ext
+ end
+
+ def source_ext ext=nil
+ extension ext, :@source_ext
+ end
+
+ def target file
+ path_for file, target_ext
+ end
+
+ def source file
+ path_for file, source_ext
+ end
+
+ def each
+ dir.each_child.select{|f| f.extname == source_ext}.each{|o| yield o}
+ end
+
+ private
+ def extension ext, ivar
+ ext ? instance_variable_set(ivar, '.' + ext) : instance_variable_get(ivar)
+ end
+
+ def path_for file, ext
+ dir.join(Pathname(file).basename.sub_ext ext)
+ end
+end
+
+Dir[File.dirname(__FILE__) + '/**/*rb'].each{|f| require_relative f}
Oops, something went wrong.

0 comments on commit b6ae002

Please sign in to comment.