pretty_doc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'pretty_doc/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'pretty_doc'
9
+ s.version = PrettyDoc::VERSION
10
+ s.authors = ['lyfeyaj']
11
+ s.email = ['lyfeyaj@gmail.com']
12
+ s.description = 'Pretty Doc is quick and convenient markdown to html converter with beautiful templates, aiming to provide a simple tool to generate beautiful docs for common use.'
13
+ s.summary = 'Pretty Doc is quick and convenient markdown to html converter with beautiful templates, aiming to provide a simple tool to generate beautiful docs for common use.'
14
+ s.homepage = 'https://github.com/lyfeyaj/pretty_doc'
15
+ s.license = 'MIT'
16
+
17
+ s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
+ s.require_paths = ['lib']
21
+
22
+ s.add_dependency 'nokogiri', '~> 1.6.6'
23
+ s.add_dependency 'kramdown', '~> 1.8.0'
24
+ s.add_dependency 'pygments.rb', '~> 0.6.3'
25
+ s.add_dependency 'compass', '~> 1.0.3'
26
+ s.add_dependency 'bootstrap-sass', '~> 3.3.5'
27
+
28
+ s.add_development_dependency 'bundler', ['>= 1.0.0']
29
+ s.add_development_dependency 'rake', ['>= 0']
30
+ s.add_development_dependency 'rspec', ['>= 3.0.0']
31
+ s.add_development_dependency 'rspec-its', ['>= 1.0.0']
32
+ s.add_development_dependency 'pry', ['>= 0']
33
+ end
@@ -0,0 +1,10 @@
1
+ require 'bootstrap-sass'
2
+
3
+ # Bootstrap Template
4
+ class BootstrapTemplate < PrettyDoc::Template
5
+ def initialize
6
+ self.dir = Pathname.new(__FILE__).dirname
7
+ end
8
+ end
9
+
10
+ PrettyDoc::Template.register('bootstrap', BootstrapTemplate.new)
@@ -0,0 +1,252 @@
1
+ @import "compass";
2
+
3
+ $baseFontSize: 15px;
4
+ $baseLineHeight: $baseFontSize * 1.5;
5
+
6
+ @import "bootstrap";
7
+
8
+ html, body {
9
+ margin: 0;
10
+ padding: 0;
11
+ }
12
+
13
+ @media print {
14
+ @page {
15
+ margin: 1cm;
16
+ }
17
+
18
+ body {
19
+ width: 19cm;
20
+ min-width: 19cm;
21
+ max-width: 19cm;
22
+ }
23
+
24
+ img, .thumbnail {
25
+ page-break-inside: avoid;
26
+ }
27
+ }
28
+
29
+ @media screen {
30
+ html, body {
31
+ background: gray;
32
+ }
33
+
34
+ body {
35
+ margin: 1cm auto;
36
+ width: 21cm;
37
+ min-height: 29.7cm;
38
+ @include box-sizing(border-box);
39
+ padding: 1cm;
40
+ background: white;
41
+ box-shadow: 0px 0px 0.5cm black;
42
+ }
43
+ }
44
+
45
+ body {
46
+ }
47
+
48
+
49
+ // h1 { font-size: $baseFontSize * 2.5; }
50
+ // h2 { font-size: $baseFontSize * 2.0; }
51
+ // h3 { font-size: $baseFontSize * 1.5; }
52
+ // h4 { font-size: $baseFontSize * 1.1; }
53
+ // h5 { font-size: $baseFontSize * 0.9; }
54
+ // h6 { font-size: $baseFontSize * 0.8; }
55
+
56
+ // h4, h5, h6 {
57
+ // line-height: $baseLineHeight;
58
+ // }
59
+
60
+ article {
61
+ h1, h2, h3, h4, h5, h6 {
62
+ margin: 1em 0 0.5em 0;
63
+ }
64
+
65
+ h1 {
66
+ margin-top: 0;
67
+ }
68
+
69
+ p {
70
+ margin-bottom: 0.75em;
71
+
72
+ img {
73
+ width: 100%;
74
+ }
75
+
76
+ code {
77
+ white-space: nowrap;
78
+ }
79
+ }
80
+
81
+ dt {
82
+ margin-top: 1em;
83
+ margin-bottom: 0.3em;
84
+ }
85
+
86
+ ul, ol {
87
+ li {
88
+ margin: 0.3em 0;
89
+ }
90
+ }
91
+
92
+ .thumbnail {
93
+
94
+ figcaption {
95
+ margin-top: 0.2em;
96
+ text-align: center;
97
+ font-style: italic;
98
+ }
99
+ }
100
+
101
+ // figure {
102
+ // width: 100%;
103
+ // margin: 0;
104
+ // margin-bottom: 0.75em;
105
+ // padding: 0;
106
+
107
+ // img {
108
+ // width: 100%;
109
+ // @include box-sizing(border-box);
110
+ // border: 1px solid #999;
111
+ // padding: 0.5em;
112
+ // }
113
+ // }
114
+
115
+ table {
116
+ @extend .table;
117
+ @extend .table-bordered;
118
+
119
+ th {
120
+ white-space: nowrap;
121
+ }
122
+ }
123
+
124
+ pre {
125
+ font-size: $baseFontSize * 0.8;
126
+ white-space: pre;
127
+ word-break: normal;
128
+ word-wrap: normal;
129
+ overflow-x: auto;
130
+ line-height: 1.5;
131
+
132
+ code {
133
+ font-size: inherit;
134
+ white-space: pre;
135
+ @include experimental(tab-size, 4);
136
+ }
137
+ }
138
+ }
139
+
140
+ .highlight {
141
+ padding: 8px;
142
+ background-color: #f7f7f9;
143
+ border: 1px solid #e1e1e8;
144
+ margin-bottom: 20px;
145
+
146
+ @include box-shadow(inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0);
147
+ @include border-radius(4px);
148
+
149
+ table {
150
+ margin: 0;
151
+ table-layout: fixed;
152
+ }
153
+
154
+ table, td, th {
155
+ border: none;
156
+ padding: 0;
157
+ }
158
+
159
+ .lines {
160
+ width: 33px;
161
+ pre {
162
+ color: #bebec5;
163
+ }
164
+
165
+ .line-number:after {
166
+ content: ".";
167
+ }
168
+ }
169
+
170
+ .code {
171
+ padding-left: 8px;
172
+ }
173
+
174
+ pre {
175
+ @include border-radius(0px);
176
+ border: none;
177
+ margin: 0;
178
+ padding: 0;
179
+ background: transparent;
180
+ }
181
+
182
+ .c { color: #999988; font-style: italic } /* Comment */
183
+ .err { color: #a61717; background-color: #e3d2d2 } /* Error */
184
+ .k { color: #000000; font-weight: bold } /* Keyword */
185
+ .o { color: #000000; font-weight: bold } /* Operator */
186
+ .cm { color: #999988; font-style: italic } /* Comment.Multiline */
187
+ .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
188
+ .c1 { color: #999988; font-style: italic } /* Comment.Single */
189
+ .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
190
+ .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
191
+ .ge { color: #000000; font-style: italic } /* Generic.Emph */
192
+ .gr { color: #aa0000 } /* Generic.Error */
193
+ .gh { color: #999999 } /* Generic.Heading */
194
+ .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
195
+ .go { color: #888888 } /* Generic.Output */
196
+ .gp { color: #555555 } /* Generic.Prompt */
197
+ .gs { font-weight: bold } /* Generic.Strong */
198
+ .gu { color: #aaaaaa } /* Generic.Subheading */
199
+ .gt { color: #aa0000 } /* Generic.Traceback */
200
+ .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
201
+ .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
202
+ .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
203
+ .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
204
+ .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
205
+ .kt { color: #445588; font-weight: bold } /* Keyword.Type */
206
+ .m { color: #009999 } /* Literal.Number */
207
+ .s { color: #d01040 } /* Literal.String */
208
+ .na { color: #008080 } /* Name.Attribute */
209
+ .nb { color: #0086B3 } /* Name.Builtin */
210
+ .nc { color: #445588; font-weight: bold } /* Name.Class */
211
+ .no { color: #008080 } /* Name.Constant */
212
+ .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
213
+ .ni { color: #800080 } /* Name.Entity */
214
+ .ne { color: #990000; font-weight: bold } /* Name.Exception */
215
+ .nf { color: #990000; font-weight: bold } /* Name.Function */
216
+ .nl { color: #990000; font-weight: bold } /* Name.Label */
217
+ .nn { color: #555555 } /* Name.Namespace */
218
+ .nt { color: #000080 } /* Name.Tag */
219
+ .nv { color: #008080 } /* Name.Variable */
220
+ .ow { color: #000000; font-weight: bold } /* Operator.Word */
221
+ .w { color: #bbbbbb } /* Text.Whitespace */
222
+ .mf { color: #009999 } /* Literal.Number.Float */
223
+ .mh { color: #009999 } /* Literal.Number.Hex */
224
+ .mi { color: #009999 } /* Literal.Number.Integer */
225
+ .mo { color: #009999 } /* Literal.Number.Oct */
226
+ .sb { color: #d01040 } /* Literal.String.Backtick */
227
+ .sc { color: #d01040 } /* Literal.String.Char */
228
+ .sd { color: #d01040 } /* Literal.String.Doc */
229
+ .s2 { color: #d01040 } /* Literal.String.Double */
230
+ .se { color: #d01040 } /* Literal.String.Escape */
231
+ .sh { color: #d01040 } /* Literal.String.Heredoc */
232
+ .si { color: #d01040 } /* Literal.String.Interpol */
233
+ .sx { color: #d01040 } /* Literal.String.Other */
234
+ .sr { color: #009926 } /* Literal.String.Regex */
235
+ .s1 { color: #d01040 } /* Literal.String.Single */
236
+ .ss { color: #990073 } /* Literal.String.Symbol */
237
+ .bp { color: #999999 } /* Name.Builtin.Pseudo */
238
+ .vc { color: #008080 } /* Name.Variable.Class */
239
+ .vg { color: #008080 } /* Name.Variable.Global */
240
+ .vi { color: #008080 } /* Name.Variable.Instance */
241
+ .il { color: #009999 } /* Literal.Number.Integer.Long */
242
+ }
243
+
244
+ .no-lines {
245
+ @include box-shadow(none);
246
+ }
247
+
248
+ @media print {
249
+ .highlight pre {
250
+ overflow-x: hidden;
251
+ }
252
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= @title %></title>
6
+ <link rel="stylesheet" type="text/css" href="style.css" />
7
+ </head>
8
+ <body>
9
+ <article id='container'>
10
+ <%= @content %>
11
+ </article>
12
+ </body>
13
+ </html>
@@ -0,0 +1,63 @@
1
+ $baseSize: 12pt;
2
+ $baseLineHeight: $baseSize * 1.4;
3
+
4
+ $normalText: #333;
5
+ $normalBackground: #f5f5f5;
6
+ $normalBorder: darken(adjust-hue($normalBackground, -10), 7%) !default;
7
+
8
+ $warningText: #c09853 !default;
9
+ $warningBackground: #fcf8e3 !default;
10
+ $warningBorder: darken(adjust-hue($warningBackground, -10), 3%) !default;
11
+
12
+ $errorText: #b94a48 !default;
13
+ $errorBackground: #f2dede !default;
14
+ $errorBorder: darken(adjust-hue($errorBackground, -10), 3%) !default;
15
+
16
+ $successText: #468847 !default;
17
+ $successBackground: #dff0d8 !default;
18
+ $successBorder: darken(adjust-hue($successBackground, -10), 5%) !default;
19
+
20
+ $infoText: #3a87ad !default;
21
+ $infoBackground: #d9edf7 !default;
22
+ $infoBorder: darken(adjust-hue($infoBackground, -10), 7%) !default;
23
+
24
+ .box {
25
+ padding: ($baseSize * 0.5) ($baseSize * 1);
26
+ border-radius: 0.3em;
27
+ background-color: $normalBackground;
28
+ border: 1px solid $normalBorder;
29
+ }
30
+
31
+ .box-warning {
32
+ @extend .box;
33
+ background-color: $warningBackground;
34
+ border-color: $warningBorder;
35
+ color: $warningText;
36
+ }
37
+
38
+ .box-success {
39
+ @extend .box;
40
+ background-color: $successBackground;
41
+ border-color: $successBorder;
42
+ color: $successText;
43
+ }
44
+
45
+ .box-info {
46
+ @extend .box;
47
+ background-color: $infoBackground;
48
+ border-color: $infoBorder;
49
+ color: $infoText;
50
+ }
51
+
52
+ .box-normal {
53
+ @extend .box;
54
+ background-color: $normalBackground;
55
+ border-color: 1px solid $normalBorder;
56
+ }
57
+
58
+ .box-error, .box-danger {
59
+ @extend .box;
60
+ background-color: $errorBackground;
61
+ border-color: $errorBorder;
62
+ color: $errorText;
63
+ }