scholarmarkdown 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +15 -0
  3. data/Gemfile.lock +88 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +45 -0
  6. data/Rakefile +24 -0
  7. data/VERSION +1 -0
  8. data/bin/generate-scholarmarkdown +19 -0
  9. data/bin/template/.gitignore +9 -0
  10. data/bin/template/Gemfile +36 -0
  11. data/bin/template/Guardfile +15 -0
  12. data/bin/template/README.md +15 -0
  13. data/bin/template/Rules +51 -0
  14. data/bin/template/config.ru +11 -0
  15. data/bin/template/content/abstract.md +15 -0
  16. data/bin/template/content/index.md.erb +21 -0
  17. data/bin/template/content/introduction.md +4 -0
  18. data/bin/template/content/references.bib +10 -0
  19. data/bin/template/content/styles/lncs.scss +1086 -0
  20. data/bin/template/content/styles/print.scss +2 -0
  21. data/bin/template/content/styles/reset.scss +47 -0
  22. data/bin/template/content/styles/screen.scss +364 -0
  23. data/bin/template/content/styles/shared.scss +77 -0
  24. data/bin/template/layouts/default.html.erb +12 -0
  25. data/bin/template/nanoc.yaml +28 -0
  26. data/lib/scholarmarkdown/citationstyles/lncs-custom.csl +159 -0
  27. data/lib/scholarmarkdown/filter/acronym.rb +13 -0
  28. data/lib/scholarmarkdown/filter/citation.rb +18 -0
  29. data/lib/scholarmarkdown/filter/headerids_to_section.rb +7 -0
  30. data/lib/scholarmarkdown/filter/hyphenate_iri.rb +18 -0
  31. data/lib/scholarmarkdown/filter/include_code.rb +10 -0
  32. data/lib/scholarmarkdown/filter/labelify.rb +94 -0
  33. data/lib/scholarmarkdown/filter/references_to_footer.rb +10 -0
  34. data/lib/scholarmarkdown/snippets.rb +28 -0
  35. data/lib/scholarmarkdown.rb +2 -0
  36. data/scholarmarkdown.gemspec +96 -0
  37. metadata +193 -0
@@ -0,0 +1,2 @@
1
+ @import "lncs.scss";
2
+ @import "shared.scss";
@@ -0,0 +1,47 @@
1
+ /* http://meyerweb.com/eric/tools/css/reset/
2
+ v2.0 | 20110126
3
+ License: none (public domain)
4
+ */
5
+
6
+ html, body, div, span, object, iframe,
7
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
8
+ a, abbr, acronym, address, big, cite, code,
9
+ del, dfn, em, img, ins, kbd, q, s, samp,
10
+ small, strike, strong, sub, sup, tt, var,
11
+ b, u, i, center,
12
+ dl, dt, dd, ol, ul, li,
13
+ fieldset, form, label, legend,
14
+ table, caption, tbody, tfoot, thead, tr, th, td,
15
+ article, aside, canvas, details, embed,
16
+ figure, figcaption, footer, header, hgroup,
17
+ menu, nav, output, ruby, section, summary,
18
+ time, mark, audio, video {
19
+ margin: 0;
20
+ padding: 0;
21
+ border: 0;
22
+ font-size: 100%;
23
+ font: inherit;
24
+ vertical-align: baseline;
25
+ }
26
+ /* HTML5 display-role reset for older browsers */
27
+ article, aside, details, figcaption, figure,
28
+ footer, header, hgroup, menu, nav, section {
29
+ display: block;
30
+ }
31
+ body {
32
+ line-height: 1;
33
+ }
34
+ ol, ul {
35
+ list-style: none;
36
+ }
37
+ blockquote, q {
38
+ quotes: none;
39
+ &::before, &::after {
40
+ content: '';
41
+ content: none;
42
+ }
43
+ }
44
+ table {
45
+ border-collapse: collapse;
46
+ border-spacing: 0;
47
+ }
@@ -0,0 +1,364 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,700,700i');
2
+ @import 'reset.scss';
3
+
4
+ @media screen {
5
+ #repeating-title {
6
+ display: none;
7
+ }
8
+ }
9
+
10
+ #keywords {
11
+ font-weight: normal;
12
+ .title {
13
+ font-style: italic;
14
+ }
15
+ }
16
+
17
+ img.plot {
18
+ width: auto;
19
+ height: 16em;
20
+ }
21
+
22
+ body {
23
+ margin: 0 auto;
24
+ padding: 1em;
25
+
26
+ font: 13pt/1.4 "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
27
+ max-width: 800px;
28
+ }
29
+
30
+ header {
31
+ margin-bottom: 2em;
32
+
33
+ h1 {
34
+ font-size: 1.9em;
35
+ letter-spacing: -.01em;
36
+ font-weight: bold;
37
+ margin: 1em 0 .5em;
38
+ }
39
+
40
+ ul {
41
+ list-style: none;
42
+ margin: 1em 0;
43
+ padding: 0;
44
+ }
45
+
46
+ #authors {
47
+ li {
48
+ display: inline;
49
+ margin-right: 1.5em;
50
+ white-space: nowrap;
51
+ }
52
+
53
+ a {
54
+ &:not(:hover) {
55
+ background: none;
56
+ }
57
+ sup {
58
+ margin: 0 -.1em 0 .1em;
59
+ }
60
+ }
61
+ }
62
+
63
+ #affiliations {
64
+ list-style: none;
65
+ margin: 1em 0;
66
+ padding: 0;
67
+
68
+ font-size: .9em;
69
+
70
+ sup {
71
+ margin-right: .15em;
72
+ }
73
+ }
74
+
75
+ #abstract {
76
+ font-weight: bold;
77
+ hyphens: auto;
78
+
79
+ h2 {
80
+ display: none;
81
+ }
82
+ }
83
+ }
84
+
85
+ main, #appendix {
86
+ counter-reset: section;
87
+
88
+ section > p, ul, ol, dl {
89
+ hyphens: auto;
90
+ }
91
+
92
+ // Sections
93
+ h2 {
94
+ font-size: 1.5em;
95
+ font-weight: bold;
96
+ margin: 1.5em 0 .5em;
97
+
98
+ counter-increment: section;
99
+ counter-reset: subsection;
100
+
101
+ &::before {
102
+ content: counter(section) ". ";
103
+ }
104
+ }
105
+
106
+ // Subsections
107
+ h3 {
108
+ font-size: 1.2em;
109
+ font-weight: bold;
110
+
111
+ counter-increment: subsection;
112
+ counter-reset: subsubsection;
113
+
114
+ &::before {
115
+ content: counter(section) "." counter(subsection) ". ";
116
+ }
117
+ }
118
+
119
+ // Titled paragraphs
120
+ h4 {
121
+ font-weight: bold;
122
+ margin: 0 1em 0 0;
123
+
124
+ counter-increment: subsubsection;
125
+
126
+ &::before {
127
+ content: counter(section) "." counter(subsection) "." counter(subsubsection) ". ";
128
+ }
129
+ }
130
+
131
+ // Paragraphs
132
+ p {
133
+ margin-bottom: 1em;
134
+ }
135
+
136
+ // Lists
137
+ ul, ol {
138
+ margin: 1em 0;
139
+
140
+ li {
141
+ margin-left: 2em;
142
+ &:before {
143
+ position: absolute;
144
+ display: block;
145
+ }
146
+ }
147
+ }
148
+ ul {
149
+ li {
150
+ &:before {
151
+ content: "▪";
152
+ font-size: 1.2em;
153
+ margin: -.1em 0 0 -.9em;
154
+ }
155
+ }
156
+ }
157
+ ol {
158
+ counter-reset: ol;
159
+ li {
160
+ &:before {
161
+ content: counter(ol) ".";
162
+ counter-increment: ol;
163
+ margin: 0 0 0 -2em;
164
+ text-align: right;
165
+ min-width: 1.5em;
166
+ }
167
+ }
168
+ }
169
+
170
+ // Figures
171
+ figure {
172
+ background: darken(white, 4%);
173
+ padding: 1em 2em;
174
+ margin: 1em 0;
175
+
176
+ figcaption {
177
+ margin: 1em 0 .5em;
178
+
179
+ .label {
180
+ float: left;
181
+ font-weight: bold;
182
+ margin-right: .5em;
183
+ }
184
+ p {
185
+ margin: 0;
186
+ }
187
+ }
188
+ }
189
+
190
+ // References
191
+ a.reference {
192
+ font-size: .95em;
193
+ &:not(:hover) {
194
+ color: #999;
195
+ background: none;
196
+ }
197
+ }
198
+ }
199
+
200
+ #appendix {
201
+ h1 {
202
+ font-size: 1.5em;
203
+ font-weight: bold;
204
+ margin: 1em 0 .5em;
205
+ }
206
+ // Sections
207
+ h2 {
208
+ &::before {
209
+ content: counter(section, upper-alpha) ". ";
210
+ }
211
+ }
212
+ }
213
+
214
+ footer {
215
+ h2 {
216
+ font-size: 1.5em;
217
+ font-weight: bold;
218
+ margin: 1em 0 .5em;
219
+ }
220
+ }
221
+
222
+ a {
223
+ $link-color: #45678e;
224
+ $hover-color: #0b99bc;
225
+
226
+ color: $link-color;
227
+ text-decoration: none;
228
+ background-image: linear-gradient(currentColor 50%, currentColor 50%);
229
+ background-repeat: repeat-x;
230
+ background-position: 0 1.2em;
231
+ background-size: 50px 1px;
232
+
233
+ &:hover {
234
+ color: $hover-color;
235
+ }
236
+ }
237
+
238
+ em {
239
+ font-style: italic;
240
+ }
241
+
242
+ strong {
243
+ font-weight: bold;
244
+ }
245
+
246
+ sup {
247
+ vertical-align: super;
248
+ font-size: smaller;
249
+ }
250
+ sub {
251
+ vertical-align: sub;
252
+ font-size: smaller;
253
+ }
254
+
255
+ q {
256
+ font-style: italic;
257
+
258
+ &::before {
259
+ content: "“";
260
+ }
261
+ &::after {
262
+ content: "”";
263
+ }
264
+ }
265
+
266
+ pre {
267
+ line-height: 1.2;
268
+ overflow-x: scroll;
269
+ overflow-y: hidden;
270
+
271
+ code {
272
+ font-size: .9em;
273
+ letter-spacing: -.1pt;
274
+ }
275
+ }
276
+
277
+ figure.numbered pre {
278
+ counter-reset: precode;
279
+
280
+ code {
281
+ &::before {
282
+ color: lightgray;
283
+ left: -1.75em;
284
+ text-align: right;
285
+ display: inline-block;
286
+ width: 1.5em;
287
+ content: counter(precode) " ";
288
+ counter-increment: precode;
289
+ }
290
+ }
291
+ }
292
+
293
+ #references {
294
+ h2 {
295
+ &::before {
296
+ content: "";
297
+ }
298
+ }
299
+
300
+ dl {
301
+ font-size: .9em;
302
+
303
+ dt {
304
+ float: left;
305
+ clear: left;
306
+ }
307
+
308
+ dd {
309
+ margin: 0 0 .5em 2em;
310
+ }
311
+ }
312
+ }
313
+
314
+
315
+ #footnotes {
316
+ counter-reset: footnote;
317
+
318
+ ol {
319
+ font-size: .9em;
320
+ list-style: none;
321
+
322
+ li {
323
+ &:before {
324
+ counter-increment: footnote;
325
+ content: counter(footnote);
326
+ font-size: smaller;
327
+ margin: -.3em .1em 0 0;
328
+ float: left;
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ table {
335
+ margin: 0 auto;
336
+
337
+ th, td {
338
+ text-align: left;
339
+ padding: 0 .5em;
340
+ }
341
+
342
+ th {
343
+ font-weight: bold;
344
+ }
345
+
346
+ thead {
347
+ border-bottom: 1px solid;
348
+ }
349
+
350
+ .hr {
351
+ display: block;
352
+ width: 100%;
353
+ border-bottom: 1px solid;
354
+ }
355
+ }
356
+
357
+ caption {
358
+ padding:0.25em 0;
359
+ }
360
+ tbody th {
361
+ text-align:left;
362
+ }
363
+
364
+ @import "shared.scss";
@@ -0,0 +1,77 @@
1
+ @import url('https://fonts.googleapis.com/css?family=Ubuntu+Mono');
2
+ figure {
3
+ img {
4
+ width: 100%;
5
+ }
6
+ }
7
+
8
+ .todo {
9
+ color: red;
10
+ &::before {
11
+ content: "TODO: ";
12
+ }
13
+ }
14
+ .comment {
15
+ &, & * {
16
+ color: red !important;
17
+ }
18
+
19
+ font-style: italic;
20
+ &:before {
21
+ content: "[";
22
+ }
23
+ &[data-author]:before {
24
+ content: "[" attr(data-author) ": ";
25
+ }
26
+ &:after {
27
+ content: "]";
28
+ }
29
+ }
30
+ del.comment {
31
+ &:before, &[data-author]:before, &:after {
32
+ content: "";
33
+ }
34
+ &[data-author]:after {
35
+ content: " (" attr(data-author) ")";
36
+ }
37
+ }
38
+
39
+ .spelling {
40
+ text-decoration: underline wavy red;
41
+ }
42
+ .grammar {
43
+ text-decoration: underline wavy darkgreen;
44
+ }
45
+ .rephrase {
46
+ text-decoration: underline wavy blue;
47
+ }
48
+ .reference.needed {
49
+ &:before {
50
+ content: "[?!]";
51
+ color: red;
52
+ font-weight: bold;
53
+ }
54
+ }
55
+
56
+ code {
57
+ font-family: "Ubuntu Mono", monospace;
58
+ }
59
+
60
+ li p {
61
+ display: inline;
62
+ }
63
+
64
+ dl {
65
+ margin: 1em 0;
66
+
67
+ dt {
68
+ font-weight: bold;
69
+ float: left;
70
+ clear: left;
71
+ margin-right: 1ex;
72
+ }
73
+ }
74
+
75
+ var {
76
+ font-style: italic;
77
+ }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title><%= h @item[:title] %></title>
6
+ <link rel="stylesheet" media="screen" href="styles/screen.css">
7
+ <link rel="stylesheet" media="print" href="styles/print.css">
8
+ </head>
9
+ <body prefix="cc: https://creativecommons.org/ns# rdfs: http://www.w3.org/2000/01/rdf-schema#">
10
+ <%= yield %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,28 @@
1
+ string_pattern_type: glob
2
+
3
+ text_extensions: [ 'adoc', 'asciidoc', 'atom', 'bib', 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'html', 'js', 'json', 'jsonld', 'less', 'markdown', 'md', 'ms', 'mustache', 'php', 'rb', 'rdoc', 'sass', 'scss', 'slim', 'ttl', 'txt', 'xhtml', 'xml', 'csv' ]
4
+
5
+ output_dir: output
6
+
7
+ index_filenames: [ 'index.html' ]
8
+
9
+ enable_output_diff: false
10
+
11
+ prune:
12
+ auto_prune: true
13
+ exclude: [ '.git', '.hg', '.svn', 'CVS' ]
14
+
15
+ data_sources:
16
+ -
17
+ type: filesystem
18
+ items_root: /
19
+ layouts_root: /
20
+ encoding: utf-8
21
+ identifier_type: full
22
+
23
+ checks:
24
+ internal_links:
25
+ exclude: []
26
+ external_links:
27
+ exclude: []
28
+ exclude_files: []
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
3
+ <info>
4
+ <title>Springer Lecture Notes in Computer Science</title>
5
+ <title-short>Springer LNCS</title-short>
6
+ <id>http://www.zotero.org/styles/springer-lecture-notes-in-computer-science</id>
7
+ <link href="http://www.zotero.org/styles/springer-lecture-notes-in-computer-science" rel="self"/>
8
+ <link href="http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0" rel="documentation"/>
9
+ <author>
10
+ <name>Ammar Memari</name>
11
+ <email>memari@wi-ol.de</email>
12
+ </author>
13
+ <contributor>
14
+ <name>Mikko Ronkko</name>
15
+ </contributor>
16
+ <category citation-format="numeric"/>
17
+ <category field="engineering"/>
18
+ <updated>2012-09-27T22:06:38+00:00</updated>
19
+ <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
20
+ </info>
21
+ <macro name="author">
22
+ <group>
23
+ <names variable="author">
24
+ <name name-as-sort-order="all" sort-separator=", " initialize-with="." delimiter=", " delimiter-precedes-last="always"/>
25
+ <label form="short" prefix=" " strip-periods="true"/>
26
+ <substitute>
27
+ <names variable="editor"/>
28
+ </substitute>
29
+ </names>
30
+ </group>
31
+ </macro>
32
+ <macro name="editor">
33
+ <names variable="editor">
34
+ <name initialize-with="." delimiter=", " and="text" name-as-sort-order="all" sort-separator=", "/>
35
+ <label form="short" prefix=" (" suffix=")"/>
36
+ </names>
37
+ </macro>
38
+ <macro name="title">
39
+ <choose>
40
+ <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
41
+ <text variable="title"/>
42
+ </if>
43
+ <else>
44
+ <text variable="title"/>
45
+ </else>
46
+ </choose>
47
+ </macro>
48
+ <macro name="publisher">
49
+ <text variable="publisher"/>
50
+ <text variable="publisher-place" prefix=", "/>
51
+ </macro>
52
+ <macro name="page">
53
+ <group>
54
+ <label variable="page" form="short" suffix=" "/>
55
+ <text variable="page"/>
56
+ </group>
57
+ </macro>
58
+ <citation et-al-min="3" et-al-use-first="1" collapse="citation-number">
59
+ <sort>
60
+ <key variable="citation-number"/>
61
+ </sort>
62
+ <layout prefix="[" suffix="]" delimiter=", ">
63
+ <text variable="citation-number"/>
64
+ </layout>
65
+ </citation>
66
+ <bibliography entry-spacing="0" second-field-align="flush">
67
+ <layout>
68
+ <text variable="citation-number" suffix="."/>
69
+ <text macro="author" suffix=": "/>
70
+ <choose>
71
+ <if type="bill book graphic legal_case legislation motion_picture report song" match="any">
72
+ <group delimiter=" ">
73
+ <text macro="title" suffix="."/>
74
+ <group delimiter=", ">
75
+ <text macro="publisher"/>
76
+ <text variable="URL"/>
77
+ </group>
78
+ <date variable="issued">
79
+ <date-part name="year" prefix="(" suffix=")."/>
80
+ </date>
81
+ </group>
82
+ </if>
83
+ <else-if type="article-journal">
84
+ <group delimiter=" ">
85
+ <text macro="title" suffix="."/>
86
+ <text variable="container-title" form="short" suffix="."/>
87
+ <text variable="volume" suffix=","/>
88
+ <text variable="page"/>
89
+ <date variable="issued">
90
+ <date-part name="year" prefix="(" suffix=")."/>
91
+ </date>
92
+ </group>
93
+ </else-if>
94
+ <else-if type="chapter paper-conference" match="any">
95
+ <group delimiter=" ">
96
+ <text macro="title" suffix="."/>
97
+ <choose>
98
+ <if variable="container-title">
99
+ <text term="in" text-case="capitalize-first" suffix=": "/>
100
+ <text macro="editor" suffix=" "/>
101
+ <group delimiter=". ">
102
+ <text variable="container-title"/>
103
+ <text macro="page"/>
104
+ <text macro="publisher"/>
105
+ </group>
106
+ </if>
107
+ <else>
108
+ <text term="presented at" text-case="capitalize-first" suffix=" "/>
109
+ <text variable="event"/>
110
+ <text variable="event-place" prefix=", "/>
111
+ <date variable="issued" prefix=" ">
112
+ <date-part name="month" suffix=" "/>
113
+ <date-part name="day" suffix=" "/>
114
+ </date>
115
+ </else>
116
+ </choose>
117
+ <date variable="issued">
118
+ <date-part name="year" prefix="(" suffix=")."/>
119
+ </date>
120
+ </group>
121
+ </else-if>
122
+ <else-if type="webpage online">
123
+ <group delimiter=", ">
124
+ <text macro="title"/>
125
+ <text variable="URL"/>
126
+ </group>
127
+ </else-if>
128
+ <else-if type="speech">
129
+ <group delimiter=" ">
130
+ <text macro="title" suffix="."/>
131
+ <text variable="event" suffix="."/>
132
+ <text variable="event-place" prefix=", "/>
133
+ <date variable="issued">
134
+ <date-part name="year" prefix="(" suffix=")."/>
135
+ </date>
136
+ </group>
137
+ </else-if>
138
+ <else-if variable="URL">
139
+ <group delimiter=" ">
140
+ <text macro="title" suffix="."/>
141
+ <text variable="URL"/>
142
+ <date variable="issued">
143
+ <date-part name="year" prefix="(" suffix=")."/>
144
+ </date>
145
+ </group>
146
+ </else-if>
147
+ <else>
148
+ <group delimiter=" ">
149
+ <text macro="title"/>
150
+ <text variable="URL"/>
151
+ <date variable="issued">
152
+ <date-part name="year" prefix="(" suffix=")."/>
153
+ </date>
154
+ </group>
155
+ </else>
156
+ </choose>
157
+ </layout>
158
+ </bibliography>
159
+ </style>
@@ -0,0 +1,13 @@
1
+ require 'csv'
2
+
3
+ # A filter for displaying full names of acronyms
4
+ Nanoc::Filter.define(:scholar_acronym) do |content, params|
5
+ acronyms = CSV.parse(params[:acronyms].raw_content, :headers => true)
6
+ transformed = content.dup
7
+ acronyms.each do |row|
8
+ transformed.gsub! %r{(?<=[^a-zA-Z0-9])#{row['abbreviation']}(?=[^a-zA-Z0-9])} do |match|
9
+ %{<span class='abbreviation' title='#{row['full']}'>#{row['abbreviation']}</span>}
10
+ end
11
+ end
12
+ transformed
13
+ end