burr 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE.md +30 -0
  6. data/README.md +180 -0
  7. data/Rakefile +118 -0
  8. data/bin/burr +9 -0
  9. data/burr.gemspec +36 -0
  10. data/generators/Gemfile.txt +3 -0
  11. data/generators/config.yml +55 -0
  12. data/generators/contents/chapter1.md +7 -0
  13. data/generators/contents/chapter2.md +7 -0
  14. data/generators/stylesheets/pdf.css +569 -0
  15. data/generators/stylesheets/site.css +1 -0
  16. data/lib/burr.rb +56 -0
  17. data/lib/burr/book.rb +289 -0
  18. data/lib/burr/cli.rb +64 -0
  19. data/lib/burr/converter.rb +19 -0
  20. data/lib/burr/core_ext/blank.rb +107 -0
  21. data/lib/burr/dependency.rb +28 -0
  22. data/lib/burr/eeepub_ext/maker.rb +131 -0
  23. data/lib/burr/exporter.rb +137 -0
  24. data/lib/burr/exporters/epub.rb +163 -0
  25. data/lib/burr/exporters/pdf.rb +95 -0
  26. data/lib/burr/exporters/site.rb +101 -0
  27. data/lib/burr/generator.rb +41 -0
  28. data/lib/burr/kramdown_ext/converter.rb +145 -0
  29. data/lib/burr/kramdown_ext/options.rb +38 -0
  30. data/lib/burr/kramdown_ext/parser.rb +65 -0
  31. data/lib/burr/liquid_ext/block.rb +58 -0
  32. data/lib/burr/liquid_ext/extends.rb +114 -0
  33. data/lib/burr/plugin.rb +70 -0
  34. data/lib/burr/plugins/aside.rb +44 -0
  35. data/lib/burr/plugins/codeblock.rb +42 -0
  36. data/lib/burr/plugins/figure.rb +62 -0
  37. data/lib/burr/plugins/link.rb +47 -0
  38. data/lib/burr/plugins/parser_plugin.rb +18 -0
  39. data/lib/burr/plugins/table.rb +42 -0
  40. data/lib/burr/plugins/toc.rb +105 -0
  41. data/lib/burr/ruby_version_check.rb +4 -0
  42. data/lib/burr/server.rb +27 -0
  43. data/lib/burr/ui.rb +46 -0
  44. data/lib/burr/version.rb +8 -0
  45. data/resources/locales/labels/en.yml +45 -0
  46. data/resources/locales/labels/zh_CN.yml +46 -0
  47. data/resources/locales/titles/en.yml +21 -0
  48. data/resources/locales/titles/zh_CN.yml +21 -0
  49. data/resources/templates/epub/_layout.liquid +17 -0
  50. data/resources/templates/epub/acknowledgement.liquid +10 -0
  51. data/resources/templates/epub/afterword.liquid +10 -0
  52. data/resources/templates/epub/appendix.liquid +10 -0
  53. data/resources/templates/epub/author.liquid +10 -0
  54. data/resources/templates/epub/chapter.liquid +10 -0
  55. data/resources/templates/epub/conclusion.liquid +10 -0
  56. data/resources/templates/epub/cover.liquid +9 -0
  57. data/resources/templates/epub/dedication.liquid +10 -0
  58. data/resources/templates/epub/edition.liquid +1 -0
  59. data/resources/templates/epub/epilogue.liquid +1 -0
  60. data/resources/templates/epub/foreword.liquid +10 -0
  61. data/resources/templates/epub/glossary.liquid +1 -0
  62. data/resources/templates/epub/introduction.liquid +1 -0
  63. data/resources/templates/epub/license.liquid +1 -0
  64. data/resources/templates/epub/lof.liquid +24 -0
  65. data/resources/templates/epub/lot.liquid +24 -0
  66. data/resources/templates/epub/part.liquid +4 -0
  67. data/resources/templates/epub/preface.liquid +10 -0
  68. data/resources/templates/epub/prologue.liquid +1 -0
  69. data/resources/templates/epub/table.liquid +7 -0
  70. data/resources/templates/epub/title.liquid +3 -0
  71. data/resources/templates/epub/toc.liquid +10 -0
  72. data/resources/templates/pdf/_item.liquid +6 -0
  73. data/resources/templates/pdf/acknowledgement.liquid +1 -0
  74. data/resources/templates/pdf/afterword.liquid +1 -0
  75. data/resources/templates/pdf/appendix.liquid +4 -0
  76. data/resources/templates/pdf/author.liquid +1 -0
  77. data/resources/templates/pdf/blank.liquid +3 -0
  78. data/resources/templates/pdf/book.liquid +42 -0
  79. data/resources/templates/pdf/chapter.liquid +4 -0
  80. data/resources/templates/pdf/code.liquid +3 -0
  81. data/resources/templates/pdf/conclusion.liquid +1 -0
  82. data/resources/templates/pdf/cover.liquid +6 -0
  83. data/resources/templates/pdf/dedication.liquid +3 -0
  84. data/resources/templates/pdf/edition.liquid +1 -0
  85. data/resources/templates/pdf/epilogue.liquid +1 -0
  86. data/resources/templates/pdf/foreword.liquid +1 -0
  87. data/resources/templates/pdf/glossary.liquid +1 -0
  88. data/resources/templates/pdf/introduction.liquid +1 -0
  89. data/resources/templates/pdf/license.liquid +1 -0
  90. data/resources/templates/pdf/lof.liquid +24 -0
  91. data/resources/templates/pdf/lot.liquid +24 -0
  92. data/resources/templates/pdf/part.liquid +4 -0
  93. data/resources/templates/pdf/preface.liquid +1 -0
  94. data/resources/templates/pdf/prologue.liquid +1 -0
  95. data/resources/templates/pdf/table.liquid +7 -0
  96. data/resources/templates/pdf/title.liquid +3 -0
  97. data/resources/templates/pdf/toc.liquid +4 -0
  98. data/resources/templates/site/_layout.liquid +27 -0
  99. data/resources/templates/site/author.liquid +13 -0
  100. data/resources/templates/site/chapter.liquid +13 -0
  101. data/resources/templates/site/foreword.liquid +13 -0
  102. data/resources/templates/site/preface.liquid +13 -0
  103. metadata +232 -0
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{item.label }} {{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item chapter">
7
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
8
+ {{ item.content }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item conclusion">
7
+ <h1 id="{{ item.id }}">{{ item.title }}</h1>
8
+ {{ item.content }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1,9 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item cover">
7
+ <img src="cover.jpg" alt="cover" style="max-width:100%;" />
8
+ </div>
9
+ {% endblock %}
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item dedication">
7
+ <h1 id="{{ item.id }}">{{ item.title }}</h1>
8
+ {{ item.content }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item foreword">
7
+ <h1 id="{{ item.id }}">{{ item.title }}</h1>
8
+ {{ item.content }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,24 @@
1
+ <div class="item lof">
2
+
3
+ <h1>{{ item.title }}</h1>
4
+
5
+ <ul>
6
+ {% for item in app.get('publishing.list.images') %}
7
+ {% if item|length > 0 %}
8
+ {% for entry in item %}
9
+ {% if entry.item.caption is empty %}
10
+ <li><a href="#{{ entry.item.slug }}">
11
+ <span>{{ app.getLabel('figure', entry) }}</span>
12
+ </a></li>
13
+ {% else %}
14
+ <li><a href="#{{ entry.item.slug }}">
15
+ <span>{{ entry.element.number }}.{{ entry.item.number }}</span>
16
+ {{ entry.item.caption }}
17
+ </a></li>
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endif %}
21
+ {% endfor %}
22
+ </ul>
23
+
24
+ </div>
@@ -0,0 +1,24 @@
1
+ <div class="item lot">
2
+
3
+ <h1>{{ item.title }}</h1>
4
+
5
+ <ul>
6
+ {% for item in app.get('publishing.list.tables') %}
7
+ {% if item|length > 0 %}
8
+ {% for entry in item %}
9
+ {% if entry.item.caption is empty %}
10
+ <li><a href="#{{ entry.item.slug }}">
11
+ <span>{{ app.getLabel('table', entry) }}</span>
12
+ </a></li>
13
+ {% else %}
14
+ <li><a href="#{{ entry.item.slug }}">
15
+ <span>{{ entry.element.number }}.{{ entry.item.number }}</span>
16
+ {{ entry.item.caption }}
17
+ </a></li>
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endif %}
21
+ {% endfor %}
22
+ </ul>
23
+
24
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class="item part">
2
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
3
+ {{ item.content }}
4
+ </div>
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item preface">
7
+ <h1 id="{{ item.id }}">{{ item.title }}</h1>
8
+ {{ item.content }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,7 @@
1
+ <div class="table" id="{{ item.id }}">
2
+ {% if item.caption != '' %}
3
+ <p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
4
+ {% endif %}
5
+
6
+ {{ item.content }}
7
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="item title">
2
+ {{ item.content }}
3
+ </div>
@@ -0,0 +1,10 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item toc">
7
+ <h1 id="toc">{{ item.title }}</h1>
8
+ {{ toc }}
9
+ </div>
10
+ {% endblock %}
@@ -0,0 +1,6 @@
1
+ <div class="item {% block class %}{{ item.element }}{% endblock %}">
2
+ <h1 id="{{ item.element }}">{{ item.title }}</h1>
3
+ {% block content %}
4
+ {{ item.content }}
5
+ {% endblock %}
6
+ </div>
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,4 @@
1
+ <div class="item appendix">
2
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
3
+ {{ item.content }}
4
+ </div>
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,3 @@
1
+ <div class="item blank">
2
+ <p>{{ item.title }}</p>
3
+ </div>
@@ -0,0 +1,42 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
+ <html lang="{{ config.language }}">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+
6
+ <!-- Metadata used by PrinceXML to set PDF metadata -->
7
+ <title>{{ config.title }}</title>
8
+ <meta name="author" content="{% if config.translator %}{{ config.translator }}{% else %}{{ config.author }}{% endif %}" />
9
+ <meta name="date" content="{{ config.publication_date | date: "%Y-%m-%d" }}" />
10
+ <meta name="generator" content="{{ generator.name }} v{{ generator.version }}"/>
11
+
12
+ <link rel="stylesheet" type="text/css" href="style.css" />
13
+ </head>
14
+
15
+ <body>
16
+
17
+ {% if frontmatter.size > 0 %}
18
+ <div class="frontmatter">
19
+ {% for item in frontmatter %}
20
+ {{ item.content }}
21
+ {% endfor %}
22
+ </div>
23
+ {% endif %}
24
+
25
+ {% if bodymatter.size > 0 %}
26
+ <div class="bodymatter">
27
+ {% for item in bodymatter %}
28
+ {{ item.content }}
29
+ {% endfor %}
30
+ </div>
31
+ {% endif %}
32
+
33
+ {% if backmatter.size > 0 %}
34
+ <div class="backmatter">
35
+ {% for item in backmatter %}
36
+ {{ item.content }}
37
+ {% endfor %}
38
+ </div>
39
+ {% endif %}
40
+
41
+ </body>
42
+ </html>
@@ -0,0 +1,4 @@
1
+ <div class="item chapter">
2
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
3
+ {{ item.content }}
4
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="code {{ item.language }}">
2
+ {{ item.content }}
3
+ </div>
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,6 @@
1
+ <div class="item cover">
2
+ {% if config.edition %}<p class="edition">{{ config.edition }}</p>{% endif %}
3
+ <h1>{{ config.title }}</h1>
4
+ {% if config.subtitle %}<h2>{{ config.subtitle }}</h2>{% endif %}
5
+ <h3>{{ config.author }}{% if config.translator %}&nbsp;&nbsp;{{ config.translator }}{% endif %}</h3>
6
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="item dedication">
2
+ {{ item.content }}
3
+ </div>
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,24 @@
1
+ <div class="item lof">
2
+
3
+ <h1>{{ item.title }}</h1>
4
+
5
+ <ul>
6
+ {% for item in app.get('publishing.list.images') %}
7
+ {% if item|length > 0 %}
8
+ {% for entry in item %}
9
+ {% if entry.item.caption is empty %}
10
+ <li><a href="#{{ entry.item.slug }}">
11
+ <span>{{ app.getLabel('figure', entry) }}</span>
12
+ </a></li>
13
+ {% else %}
14
+ <li><a href="#{{ entry.item.slug }}">
15
+ <span>{{ entry.element.number }}.{{ entry.item.number }}</span>
16
+ {{ entry.item.caption }}
17
+ </a></li>
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endif %}
21
+ {% endfor %}
22
+ </ul>
23
+
24
+ </div>
@@ -0,0 +1,24 @@
1
+ <div class="item lot">
2
+
3
+ <h1>{{ item.title }}</h1>
4
+
5
+ <ul>
6
+ {% for item in app.get('publishing.list.tables') %}
7
+ {% if item|length > 0 %}
8
+ {% for entry in item %}
9
+ {% if entry.item.caption is empty %}
10
+ <li><a href="#{{ entry.item.slug }}">
11
+ <span>{{ app.getLabel('table', entry) }}</span>
12
+ </a></li>
13
+ {% else %}
14
+ <li><a href="#{{ entry.item.slug }}">
15
+ <span>{{ entry.element.number }}.{{ entry.item.number }}</span>
16
+ {{ entry.item.caption }}
17
+ </a></li>
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endif %}
21
+ {% endfor %}
22
+ </ul>
23
+
24
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class="item part">
2
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
3
+ {{ item.content }}
4
+ </div>
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1 @@
1
+ {% extends 'item' %}
@@ -0,0 +1,7 @@
1
+ <div class="table" id="{{ item.id }}">
2
+ {% if item.caption != '' %}
3
+ <p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
4
+ {% endif %}
5
+
6
+ {{ item.content }}
7
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="item title">
2
+ {{ item.content }}
3
+ </div>
@@ -0,0 +1,4 @@
1
+ <div class="item toc">
2
+ <h1 id="toc">{{ item.title }}</h1>
3
+ {{ toc }}
4
+ </div>
@@ -0,0 +1,27 @@
1
+ <!doctype html>
2
+ <html lang="{{ config.language }}">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>{% block title %}{{ config.title }}{% endblock %}</title>
6
+ <meta name="author" content="{% if config.translator %}{{ config.translator }}{% else %}{{ config.author }}{% endif %}" />
7
+ <link rel="stylesheet" href="style.css" />
8
+ </head>
9
+
10
+ <body>
11
+ <div class="container">
12
+ {% block body %}{% endblock %}
13
+ {% block navigation %}
14
+ {% if item.pre or item.nxt %}
15
+ <div class="navigation">
16
+ {% if item.pre %}
17
+ <a class="prev_page" href="{{ item.pre_url }}">&laquo; {{ item.pre }}</a>
18
+ {% endif %}
19
+ {% if item.nxt %}
20
+ <a class="next_page" href="{{ item.nxt_url }}">{{ item.nxt }} &raquo;</a>
21
+ {% endif %}
22
+ </div>
23
+ {% endif %}
24
+ {% endblock %}
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,13 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item author">
7
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
8
+ {{ item.toc }}
9
+ <div class="main">
10
+ {{ item.content }}
11
+ </div>
12
+ </div>
13
+ {% endblock %}
@@ -0,0 +1,13 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{item.label }} {{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item chapter">
7
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
8
+ {{ item.toc }}
9
+ <div class="main">
10
+ {{ item.content }}
11
+ </div>
12
+ </div>
13
+ {% endblock %}
@@ -0,0 +1,13 @@
1
+ {% extends 'layout' %}
2
+
3
+ {% block title %}{{ item.title }}{% endblock %}
4
+
5
+ {% block body %}
6
+ <div class="item foreword">
7
+ <h1 id="{{ item.id }}"><span>{{ item.label }}</span> {{ item.title }}</h1>
8
+ {{ item.toc }}
9
+ <div class="main">
10
+ {{ item.content }}
11
+ </div>
12
+ </div>
13
+ {% endblock %}