rdoc-generator-solarfish 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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rubocop.yml +26 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE +21 -0
  7. data/README.md +175 -0
  8. data/Rakefile +28 -0
  9. data/data/rdoc-generator-solarfish/templates/onepage.slim +110 -0
  10. data/data/rdoc-generator-solarfish/themes/common/fonts/LICENSE +7 -0
  11. data/data/rdoc-generator-solarfish/themes/common/fonts/LICENSE.Raleway +95 -0
  12. data/data/rdoc-generator-solarfish/themes/common/fonts/LICENSE.Roboto +201 -0
  13. data/data/rdoc-generator-solarfish/themes/common/fonts/Raleway-Regular.ttf +0 -0
  14. data/data/rdoc-generator-solarfish/themes/common/fonts/Raleway-SemiBold.ttf +0 -0
  15. data/data/rdoc-generator-solarfish/themes/common/fonts/Roboto-Regular.ttf +0 -0
  16. data/data/rdoc-generator-solarfish/themes/common/syntax/LICENSE +3 -0
  17. data/data/rdoc-generator-solarfish/themes/common/syntax/LICENSE.onelight +20 -0
  18. data/data/rdoc-generator-solarfish/themes/common/syntax/onelight.sass +47 -0
  19. data/data/rdoc-generator-solarfish/themes/light/main.sass +215 -0
  20. data/data/rdoc-generator-solarfish/themes/light.yml +16 -0
  21. data/docs/example.rb +142 -0
  22. data/docs/example_output/Raleway-Regular.ttf +0 -0
  23. data/docs/example_output/Raleway-SemiBold.ttf +0 -0
  24. data/docs/example_output/Roboto-Regular.ttf +0 -0
  25. data/docs/example_output/created.rid +2 -0
  26. data/docs/example_output/index.html +404 -0
  27. data/docs/example_output/index.json +428 -0
  28. data/docs/example_output/main.css +210 -0
  29. data/docs/example_output/onelight.css +22 -0
  30. data/lib/rdoc/discover.rb +1 -0
  31. data/lib/rdoc/generator/doc_loader.rb +315 -0
  32. data/lib/rdoc/generator/html_writer.rb +35 -0
  33. data/lib/rdoc/generator/json_writer.rb +16 -0
  34. data/lib/rdoc/generator/settings.rb +57 -0
  35. data/lib/rdoc/generator/solarfish.rb +135 -0
  36. data/lib/rdoc/generator/template_loader.rb +42 -0
  37. data/lib/rdoc/generator/theme_loader.rb +160 -0
  38. data/lib/solarfish.rb +2 -0
  39. data/rdoc-generator-solarfish.gemspec +31 -0
  40. data/test/test_generator.rb +95 -0
  41. data/test/test_theme_loader.rb +89 -0
  42. data/test/themes.rb +213 -0
  43. metadata +216 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 28f7541a023cad2c48f01845b5737d76921a23dc3739bf1866bf9f5f4347b2a7
4
+ data.tar.gz: 3c6ad8b452343f5315bcb50981533280f79c8427f3e059220e2b3ef607d527e7
5
+ SHA512:
6
+ metadata.gz: 7a15bebfc2bf46263da39e21c692a92601f4e53b5cdc77e624b7f7cf938f80384880844e821a86b8c86d1c53fb095f9d842db502bbbb84ea643495a992d22aba
7
+ data.tar.gz: 1b562c560027b34fa74a55841361fa86b03496af5edaedcd63ef07326c46649430c73bd33ea1bf9878291fa7cbe22264c58e90fc872c3934ff5bc0320f23dd91
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ Gemfile.lock
2
+ .bundle
3
+ .sass-cache
4
+ pkg
5
+ *.gem
6
+
7
+ # swap
8
+ [._]*.s[a-w][a-z]
9
+ [._]s[a-w][a-z]
10
+ *~
11
+
12
+ # auto-generated rdoc output
13
+ doc
data/.rubocop.yml ADDED
@@ -0,0 +1,26 @@
1
+ Style/ClassAndModuleChildren:
2
+ Enabled: false
3
+
4
+ Style/GuardClause:
5
+ Enabled: false
6
+
7
+ Metrics/ClassLength:
8
+ Enabled: false
9
+
10
+ Metrics/MethodLength:
11
+ Enabled: false
12
+
13
+ Metrics/BlockLength:
14
+ Enabled: false
15
+
16
+ Metrics/CyclomaticComplexity:
17
+ Enabled: false
18
+
19
+ Metrics/PerceivedComplexity:
20
+ Enabled: false
21
+
22
+ Metrics/AbcSize:
23
+ Enabled: false
24
+
25
+ Metrics/LineLength:
26
+ Max: 90
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.3
4
+ - 2.6.3
5
+ script:
6
+ - rake rubocop
7
+ - rake test
8
+ - rake install
9
+ - rake example
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Victor Gaydov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # RDoc::Generator::SolarFish [![Gem Version](https://badge.fury.io/rb/rdoc-generator-solarfish.svg)](https://badge.fury.io/rb/rdoc-generator-solarfish) [![Build Status](https://travis-ci.org/rbdoc/rdoc-generator-solarfish.svg?branch=master)](https://travis-ci.org/rbdoc/rdoc-generator-solarfish)
2
+
3
+ Single page HTML5 generator for Ruby RDoc.
4
+
5
+ ## Features
6
+
7
+ * Generate single page HTML5 documentation suitable for offline use.
8
+ * Templates support using [Slim](http://slim-lang.com/).
9
+ * Themes support.
10
+ * Out of the box [Sass](http://sass-lang.com/) and SCSS support.
11
+ * Filter classes or members by regex.
12
+
13
+ ## Example
14
+
15
+ See example output:
16
+
17
+ * [HTML](https://rbdoc.github.io/rdoc-generator-solarfish/example_output/)
18
+ * [JSON](docs/example_output/index.json)
19
+
20
+ It was generated from the [`example.rb`](docs/example.rb) in the [`docs`](docs) directory.
21
+
22
+ Generate locally:
23
+
24
+ ```
25
+ $ rake install
26
+ $ rake example
27
+ ```
28
+
29
+ ## Installation
30
+
31
+ From rubygems:
32
+
33
+ ```
34
+ gem install rdoc-generator-solarfish
35
+ ```
36
+
37
+ From sources:
38
+
39
+ ```
40
+ $ rake install
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ #### From command line
46
+
47
+ Display all supported command line options:
48
+
49
+ ```
50
+ $ rdoc --help
51
+ ```
52
+
53
+ Generate documentation under the `doc/` directory:
54
+
55
+ ```
56
+ $ rdoc -f solarfish --title "My Project"
57
+ ```
58
+
59
+ Use custom directory and file name:
60
+
61
+ ```
62
+ $ rdoc -f solarfish --output superdoc --sf-htmlfile superdoc.html
63
+ ```
64
+
65
+ Additionally dump JSON:
66
+
67
+ ```
68
+ $ rdoc -f solarfish --output superdoc --sf-htmlfile superdoc.html --sf-jsonfile superdoc.json
69
+ ```
70
+
71
+ Specify template name:
72
+
73
+ ```
74
+ $ rdoc -f solarfish --sf-template onepage
75
+ ```
76
+
77
+ Specify theme name:
78
+
79
+ ```
80
+ $ rdoc -f solarfish --sf-theme light
81
+ ```
82
+
83
+ Specify additional theme that may partially override default one:
84
+
85
+ ```
86
+ $ rdoc -f solarfish --sf-theme light --sf-theme ./custom_theme.yml
87
+ ```
88
+
89
+ Filter classes and members by regex:
90
+
91
+ ```
92
+ $ rdoc -f solarfish --sf-filter-classes '^Test.*' --sf-filter-members '^test_.*'
93
+ ```
94
+
95
+ #### From code
96
+
97
+ ```ruby
98
+ require 'rdoc/rdoc'
99
+
100
+ options = RDoc::Options.new
101
+ options.setup_generator 'solarfish'
102
+
103
+ options.files = ['input_file.rb']
104
+ options.op_dir = 'output_dir'
105
+ options.title = 'Page title'
106
+
107
+ options.sf_htmlfile = 'output_file.html'
108
+ options.sf_jsonfile = 'output_file.json'
109
+
110
+ options.sf_prefix = '/url_prefix'
111
+
112
+ options.sf_template = '/path/to/template.slim'
113
+ options.sf_themes = ['/path/to/theme.yml']
114
+
115
+ options.sf_filter_classes = '^Test.*'
116
+ options.sf_filter_members = '^test_.*'
117
+
118
+ rdoc = RDoc::RDoc.new
119
+ rdoc.document options
120
+ ```
121
+
122
+ ## Configuration
123
+
124
+ #### Templates
125
+
126
+ The HTML page layout is defined by a [Slim](http://slim-lang.com/) template.
127
+
128
+ Only one template is available out of the box:
129
+
130
+ * ["onepage" template](https://github.com/rbdoc/rdoc-generator-solarfish/blob/master/data/rdoc-generator-solarfish/templates/onepage.slim)
131
+
132
+ You can configure what template to use with the `--sf-template` option. Its value may be either a path or a name. In the later case, the template is searched in all locally installed gems that provide `data/rdoc-generator-solarfish/templates` directory.
133
+
134
+ #### Themes
135
+
136
+ The HTML page style is defined by a YAML theme. A theme file may contain Sass and SCSS stylesheet files and font files.
137
+
138
+ Only one theme is available out of the box:
139
+
140
+ * ["light" theme](https://github.com/rbdoc/rdoc-generator-solarfish/blob/master/data/rdoc-generator-solarfish/themes/light.yml)
141
+
142
+ You can configure what theme to use with the `--sf-theme` option. Its value may be either a path or a name. In the later case, the theme is searched in all locally installed gems that provide `data/rdoc-generator-solarfish/themes` directory.
143
+
144
+ Multiple themes can be used simultaneously. In this case, each next theme may add more stylesheet or font files and overrides previous themes.
145
+
146
+ ## Development
147
+
148
+ Install development dependencies:
149
+
150
+ ```
151
+ $ bundle
152
+ ```
153
+
154
+ Run tests:
155
+
156
+ ```
157
+ $ rake test
158
+ ```
159
+
160
+ Run linters:
161
+
162
+ ```
163
+ $ rake rubocop
164
+ ```
165
+
166
+ Automatically fix some linter errors:
167
+
168
+ ```
169
+ $ rake rubocop:auto_correct
170
+ ```
171
+
172
+ ## License
173
+
174
+ * The source code is licensed under [MIT](LICENSE) license.
175
+ * [Fonts](data/rdoc-generator-solarfish/themes/common/fonts) and [syntax themes](data/rdoc-generator-solarfish/themes/common/syntax) have their own licenses.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rubocop/rake_task'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.verbose = true
7
+ t.warning = false
8
+ t.test_files = FileList['test/test*.rb']
9
+ end
10
+
11
+ RuboCop::RakeTask.new(:rubocop) do |t|
12
+ t.patterns = ['lib/**/*.rb']
13
+ t.fail_on_error = false
14
+ t.options = [
15
+ '--display-cop-names'
16
+ ]
17
+ end
18
+
19
+ task :example do
20
+ sh 'cd docs &&' \
21
+ ' rdoc' \
22
+ " -t 'RDoc::Generator::SolarFish Example'" \
23
+ ' -a' \
24
+ ' -f solarfish' \
25
+ ' -o example_output' \
26
+ ' --sf-htmlfile index.html' \
27
+ ' --sf-jsonfile index.json'
28
+ end
@@ -0,0 +1,110 @@
1
+ doctype html
2
+ html
3
+ head
4
+ meta charset="UTF-8"
5
+
6
+ title
7
+ | #{title}
8
+
9
+ - theme.head.fonts.each do |file|
10
+ css:
11
+ @font-face {
12
+ font-family: '#{file.family}';
13
+ src: url('#{file.url}');
14
+ }
15
+
16
+ - theme.head.styles.each do |file|
17
+ link rel="stylesheet" href="#{file.url}"
18
+
19
+ - theme.head.scripts.each do |file|
20
+ script src="#{file.url}"
21
+
22
+ - theme.head.html.each do |file|
23
+ | #{{file.data}}
24
+
25
+ body
26
+ - theme.body.header.each do |file|
27
+ | #{{file.data}}
28
+
29
+ header class="mainHeader"
30
+ | #{title}
31
+
32
+ aside
33
+ - classes.each do |klass|
34
+
35
+ - if klass.groups.empty?
36
+ div class="tocClassBlock"
37
+ - klass.labels.each do |label|
38
+ div class="label label#{label.id}"
39
+ | #{label.title}
40
+
41
+ a class="tocClass" href="##{klass.id}"
42
+ | #{klass.title}
43
+
44
+ - else
45
+ details class="tocClassBlock"
46
+ summary
47
+ - klass.labels.each do |label|
48
+ span class="label label#{label.id}"
49
+ | #{label.title}
50
+
51
+ a class="tocClass" href="##{klass.id}"
52
+ | #{klass.title}
53
+
54
+ div class="tocGroupBlock"
55
+ - klass.groups.each do |group|
56
+ a class="tocGroup" href="##{group.id}"
57
+ | #{group.title}
58
+
59
+ main
60
+ - classes.each do |klass|
61
+
62
+ article class="classBlock" id="#{klass.id}"
63
+
64
+ header class="classHeader"
65
+ - klass.labels.each do |label|
66
+ div class="label label#{label.id}"
67
+ | #{label.title}
68
+
69
+ span class="className"
70
+ | #{klass.title}
71
+
72
+ - if klass.comment
73
+ div class="classComment"
74
+ | #{{klass.comment}}
75
+
76
+ - klass.groups.each do |group|
77
+ section class="groupBlock" id="#{group.id}"
78
+
79
+ header class="groupHeader"
80
+ span class="groupName"
81
+ | #{group.title}
82
+
83
+ - group.members.each do |member|
84
+ div class="memberBlock" id="#{member.id}"
85
+
86
+ div class="memberHeader"
87
+ - member.labels.each do |label|
88
+ div class="label label#{label.id}"
89
+ | #{label.title}
90
+
91
+ span class="memberName"
92
+ | #{member.title}
93
+
94
+ - if member.signature
95
+ pre class="memberSignature"
96
+ | #{{member.signature}}
97
+
98
+ - if member.comment
99
+ div class="memberComment"
100
+ | #{{member.comment}}
101
+
102
+ - if member.code
103
+ details class="memberCode"
104
+ summary
105
+ | Source code
106
+ pre
107
+ | #{{member.code}}
108
+
109
+ - theme.body.footer.each do |file|
110
+ | #{{file.data}}
@@ -0,0 +1,7 @@
1
+ Raleway fonts:
2
+ Homepage: https://github.com/impallari/Raleway
3
+ License: LICENSE.Raleway
4
+
5
+ Roboto fonts:
6
+ Homepage: https://github.com/google/roboto
7
+ License: LICENSE.Roboto
@@ -0,0 +1,95 @@
1
+ Copyright (c) 2010, Matt McInerney (matt@pixelspread.com),
2
+ Copyright (c) 2011, Pablo Impallari (www.impallari.com|impallari@gmail.com),
3
+ Copyright (c) 2011, Rodrigo Fuenzalida (www.rfuenzalida.com|hello@rfuenzalida.com), with Reserved Font Name Raleway
4
+
5
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
6
+ This license is copied below, and is also available with a FAQ at:
7
+ http://scripts.sil.org/OFL
8
+
9
+
10
+ -----------------------------------------------------------
11
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
12
+ -----------------------------------------------------------
13
+
14
+ PREAMBLE
15
+ The goals of the Open Font License (OFL) are to stimulate worldwide
16
+ development of collaborative font projects, to support the font creation
17
+ efforts of academic and linguistic communities, and to provide a free and
18
+ open framework in which fonts may be shared and improved in partnership
19
+ with others.
20
+
21
+ The OFL allows the licensed fonts to be used, studied, modified and
22
+ redistributed freely as long as they are not sold by themselves. The
23
+ fonts, including any derivative works, can be bundled, embedded,
24
+ redistributed and/or sold with any software provided that any reserved
25
+ names are not used by derivative works. The fonts and derivatives,
26
+ however, cannot be released under any other type of license. The
27
+ requirement for fonts to remain under this license does not apply
28
+ to any document created using the fonts or their derivatives.
29
+
30
+ DEFINITIONS
31
+ "Font Software" refers to the set of files released by the Copyright
32
+ Holder(s) under this license and clearly marked as such. This may
33
+ include source files, build scripts and documentation.
34
+
35
+ "Reserved Font Name" refers to any names specified as such after the
36
+ copyright statement(s).
37
+
38
+ "Original Version" refers to the collection of Font Software components as
39
+ distributed by the Copyright Holder(s).
40
+
41
+ "Modified Version" refers to any derivative made by adding to, deleting,
42
+ or substituting -- in part or in whole -- any of the components of the
43
+ Original Version, by changing formats or by porting the Font Software to a
44
+ new environment.
45
+
46
+ "Author" refers to any designer, engineer, programmer, technical
47
+ writer or other person who contributed to the Font Software.
48
+
49
+ PERMISSION & CONDITIONS
50
+ Permission is hereby granted, free of charge, to any person obtaining
51
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
52
+ redistribute, and sell modified and unmodified copies of the Font
53
+ Software, subject to the following conditions:
54
+
55
+ 1) Neither the Font Software nor any of its individual components,
56
+ in Original or Modified Versions, may be sold by itself.
57
+
58
+ 2) Original or Modified Versions of the Font Software may be bundled,
59
+ redistributed and/or sold with any software, provided that each copy
60
+ contains the above copyright notice and this license. These can be
61
+ included either as stand-alone text files, human-readable headers or
62
+ in the appropriate machine-readable metadata fields within text or
63
+ binary files as long as those fields can be easily viewed by the user.
64
+
65
+ 3) No Modified Version of the Font Software may use the Reserved Font
66
+ Name(s) unless explicit written permission is granted by the corresponding
67
+ Copyright Holder. This restriction only applies to the primary font name as
68
+ presented to the users.
69
+
70
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
71
+ Software shall not be used to promote, endorse or advertise any
72
+ Modified Version, except to acknowledge the contribution(s) of the
73
+ Copyright Holder(s) and the Author(s) or with their explicit written
74
+ permission.
75
+
76
+ 5) The Font Software, modified or unmodified, in part or in whole,
77
+ must be distributed entirely under this license, and must not be
78
+ distributed under any other license. The requirement for fonts to
79
+ remain under this license does not apply to any document created
80
+ using the Font Software.
81
+
82
+ TERMINATION
83
+ This license becomes null and void if any of the above conditions are
84
+ not met.
85
+
86
+ DISCLAIMER
87
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
88
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
89
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
90
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
91
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
92
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
93
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
94
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
95
+ OTHER DEALINGS IN THE FONT SOFTWARE.