arthurgeek-kitabu 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/History.txt +59 -0
  2. data/License.txt +20 -0
  3. data/README.markdown +220 -0
  4. data/Rakefile +68 -0
  5. data/TODO.txt +2 -0
  6. data/app_generators/kitabu/USAGE +5 -0
  7. data/app_generators/kitabu/kitabu_generator.rb +68 -0
  8. data/app_generators/kitabu/templates/Rakefile +3 -0
  9. data/app_generators/kitabu/templates/config.yml +8 -0
  10. data/app_generators/kitabu/templates/css/active4d.css +114 -0
  11. data/app_generators/kitabu/templates/css/blackboard.css +88 -0
  12. data/app_generators/kitabu/templates/css/dawn.css +121 -0
  13. data/app_generators/kitabu/templates/css/eiffel.css +121 -0
  14. data/app_generators/kitabu/templates/css/idle.css +62 -0
  15. data/app_generators/kitabu/templates/css/iplastic.css +80 -0
  16. data/app_generators/kitabu/templates/css/lazy.css +73 -0
  17. data/app_generators/kitabu/templates/css/mac_classic.css +123 -0
  18. data/app_generators/kitabu/templates/css/slush_poppies.css +85 -0
  19. data/app_generators/kitabu/templates/css/sunburst.css +180 -0
  20. data/app_generators/kitabu/templates/layouts/boom/layout.css +469 -0
  21. data/app_generators/kitabu/templates/layouts/boom/layout.html +37 -0
  22. data/app_generators/kitabu/templates/user.css +0 -0
  23. data/bin/kitabu +17 -0
  24. data/kitabu.gemspec +79 -0
  25. data/lib/kitabu.rb +18 -0
  26. data/lib/kitabu/base.rb +332 -0
  27. data/lib/kitabu/blackcloth.rb +165 -0
  28. data/lib/kitabu/redcloth.rb +963 -0
  29. data/lib/kitabu/tasks.rb +119 -0
  30. data/themes/active4d.css +114 -0
  31. data/themes/all_hallows_eve.css +72 -0
  32. data/themes/amy.css +147 -0
  33. data/themes/blackboard.css +88 -0
  34. data/themes/brilliance_black.css +605 -0
  35. data/themes/brilliance_dull.css +599 -0
  36. data/themes/cobalt.css +149 -0
  37. data/themes/dawn.css +121 -0
  38. data/themes/eiffel.css +121 -0
  39. data/themes/espresso_libre.css +109 -0
  40. data/themes/idle.css +62 -0
  41. data/themes/iplastic.css +80 -0
  42. data/themes/lazy.css +73 -0
  43. data/themes/mac_classic.css +123 -0
  44. data/themes/magicwb_amiga.css +104 -0
  45. data/themes/pastels_on_dark.css +188 -0
  46. data/themes/slush_poppies.css +85 -0
  47. data/themes/spacecadet.css +51 -0
  48. data/themes/sunburst.css +180 -0
  49. data/themes/twilight.css +137 -0
  50. data/themes/zenburnesque.css +91 -0
  51. metadata +144 -0
@@ -0,0 +1,119 @@
1
+ require "kitabu"
2
+
3
+ begin
4
+ require "discount"
5
+ rescue LoadError => e
6
+ puts "\nDiscount gem not found. NO MARKDOWN for you.\n" +
7
+ "Install using `sudo gem install discount`.\n"
8
+ end
9
+
10
+ require File.dirname(__FILE__) + "/redcloth"
11
+ require File.dirname(__FILE__) + "/blackcloth"
12
+
13
+ begin
14
+ require "uv" if RUBY_PLATFORM =~ /darwin/
15
+ rescue LoadError => e
16
+ puts "\nUltraviolet gem not found. NO SYNTAX HIGHLIGHT for you.\n" +
17
+ "Install using `sudo gem install ultraviolet`.\n\n"
18
+ end
19
+
20
+ begin
21
+ require "hpricot"
22
+ rescue LoadError => e
23
+ puts "\nHpricot gem not found. NO TOC for you.\n" +
24
+ "Install using `sudo gem install hpricot`.\n\n"
25
+ end
26
+
27
+ begin
28
+ require "unicode"
29
+ rescue LoadError => e
30
+ puts "\nUnicode gem not found. NO TOC for you.\n" +
31
+ "Install using `sudo gem install unicode`.\n\n"
32
+ end
33
+
34
+ namespace :kitabu do
35
+ desc "Generate PDF from markup files"
36
+ task :pdf => :html do
37
+ Kitabu::Base.generate_pdf
38
+ puts "Your PDF has been generated. Check it out the output directory!"
39
+ sleep(1) && system("open #{Kitabu::Base.pdf_path}") if RUBY_PLATFORM =~ /darwin/
40
+ end
41
+
42
+ desc "Generate HTML from markup files"
43
+ task :html do
44
+ Kitabu::Base.generate_html
45
+ end
46
+
47
+ desc "List all available syntaxes"
48
+ task :syntaxes do
49
+ puts Kitabu::Base.syntaxes.sort.join("\n")
50
+ end
51
+
52
+ desc "List all available themes"
53
+ task :themes do
54
+ puts Kitabu::Base.themes.sort.join("\n")
55
+ end
56
+
57
+ desc "List all titles and its permalinks"
58
+ task :titles => :html do
59
+ contents = File.new(Kitabu::Base.html_path).read
60
+ doc = Hpricot(contents)
61
+ counter = {}
62
+
63
+ titles = (doc/"h2, h3, h4, h5, h6").collect do |node|
64
+ title = node.inner_text
65
+ permalink = Kitabu::Base.to_permalink(title)
66
+
67
+ # initialize and increment counter
68
+ counter[permalink] ||= 0
69
+ counter[permalink] += 1
70
+
71
+ # set a incremented permalink if more than one occurrence
72
+ # is found
73
+ permalink = "#{permalink}-#{counter[permalink]}" if counter[permalink] > 1
74
+
75
+ [title, permalink]
76
+ end
77
+
78
+ titles.sort_by {|items| items.last }.each do |items|
79
+ puts items.first
80
+ puts %(##{items.last})
81
+ puts
82
+ end
83
+ end
84
+
85
+ desc "Watch changes and automatically generate html"
86
+ task :watch do
87
+ thread = Thread.new do
88
+ latest_mtime = 0
89
+
90
+ trap 'INT' do
91
+ puts
92
+ thread.exit
93
+ end
94
+
95
+ loop do
96
+ files = Dir["text/**/*.textile"] + Dir["text/**/*.markdown"]
97
+ changes = []
98
+
99
+ mtime = files.collect do |file|
100
+ mt = File.mtime(file).to_i
101
+ changes << file if latest_mtime > 0 && mt > latest_mtime
102
+ mt
103
+ end.max
104
+
105
+ if latest_mtime < mtime
106
+ puts "generating html - #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"
107
+ changes.each {|file| puts " - #{file}" } unless latest_mtime == 0
108
+ latest_mtime = mtime
109
+ Kitabu::Base.generate_html
110
+ Kitabu::Base.generate_pdf
111
+ end
112
+
113
+ sleep 5
114
+ end
115
+ end
116
+
117
+ thread.join
118
+ end
119
+ end
@@ -0,0 +1,114 @@
1
+ pre.active4d .DiffHeader {
2
+ background-color: #656565;
3
+ color: #FFFFFF;
4
+ }
5
+ pre.active4d .Operator {
6
+ }
7
+ pre.active4d .InheritedClass {
8
+ }
9
+ pre.active4d .TypeName {
10
+ color: #21439C;
11
+ }
12
+ pre.active4d .Number {
13
+ color: #A8017E;
14
+ }
15
+ pre.active4d .EmbeddedSource {
16
+ background-color: #ECF1FF;
17
+ }
18
+ pre.active4d {
19
+ background-color: #FFFFFF;
20
+ color: #000000;
21
+ }
22
+ pre.active4d .DiffInsertedLine {
23
+ background-color: #98FF9A;
24
+ color: #000000;
25
+ }
26
+ pre.active4d .LibraryVariable {
27
+ color: #A535AE;
28
+ }
29
+ pre.active4d .Storage {
30
+ color: #FF5600;
31
+ }
32
+ pre.active4d .InterpolatedEntity {
33
+ font-weight: bold;
34
+ color: #66CCFF;
35
+ }
36
+ pre.active4d .line-numbers {
37
+ background-color: #BAD6FD;
38
+ color: #000000;
39
+ }
40
+ pre.active4d .LocalVariable {
41
+ font-weight: bold;
42
+ color: #6392FF;
43
+ }
44
+ pre.active4d .DiffLineRange {
45
+ background-color: #1B63FF;
46
+ color: #FFFFFF;
47
+ }
48
+ pre.active4d .BlockComment {
49
+ color: #D33435;
50
+ }
51
+ pre.active4d .TagName {
52
+ color: #016CFF;
53
+ }
54
+ pre.active4d .FunctionArgument {
55
+ }
56
+ pre.active4d .BuiltInConstant {
57
+ color: #A535AE;
58
+ }
59
+ pre.active4d .LineComment {
60
+ color: #D33535;
61
+ }
62
+ pre.active4d .DiffDeletedLine {
63
+ background-color: #FF7880;
64
+ color: #000000;
65
+ }
66
+ pre.active4d .NamedConstant {
67
+ color: #B7734C;
68
+ }
69
+ pre.active4d .CommandMethod {
70
+ font-weight: bold;
71
+ color: #45AE34;
72
+ }
73
+ pre.active4d .TableField {
74
+ color: #0BB600;
75
+ }
76
+ pre.active4d .PlainXmlText {
77
+ color: #000000;
78
+ }
79
+ pre.active4d .Invalid {
80
+ background-color: #990000;
81
+ color: #FFFFFF;
82
+ }
83
+ pre.active4d .LibraryClassType {
84
+ color: #A535AE;
85
+ }
86
+ pre.active4d .TagAttribute {
87
+ color: #963DFF;
88
+ }
89
+ pre.active4d .Keyword {
90
+ font-weight: bold;
91
+ color: #006699;
92
+ }
93
+ pre.active4d .UserDefinedConstant {
94
+ }
95
+ pre.active4d .String {
96
+ color: #666666;
97
+ }
98
+ pre.active4d .DiffUnchangedLine {
99
+ color: #5E5E5E;
100
+ }
101
+ pre.active4d .TagContainer {
102
+ color: #7A7A7A;
103
+ }
104
+ pre.active4d .FunctionName {
105
+ color: #21439C;
106
+ }
107
+ pre.active4d .Variable {
108
+ font-weight: bold;
109
+ color: #0053FF;
110
+ }
111
+ pre.active4d .DateTimeLiteral {
112
+ font-weight: bold;
113
+ color: #66CCFF;
114
+ }
@@ -0,0 +1,72 @@
1
+ pre.all_hallows_eve .ClassInheritance {
2
+ font-style: italic;
3
+ }
4
+ pre.all_hallows_eve .Constant {
5
+ color: #3387CC;
6
+ }
7
+ pre.all_hallows_eve .TypeName {
8
+ text-decoration: underline;
9
+ }
10
+ pre.all_hallows_eve .TextBase {
11
+ background-color: #434242;
12
+ color: #FFFFFF;
13
+ }
14
+ pre.all_hallows_eve {
15
+ background-color: #000000;
16
+ color: #FFFFFF;
17
+ }
18
+ pre.all_hallows_eve .StringEscapesExecuted {
19
+ color: #555555;
20
+ }
21
+ pre.all_hallows_eve .line-numbers {
22
+ background-color: #73597E;
23
+ color: #FFFFFF;
24
+ }
25
+ pre.all_hallows_eve .StringExecuted {
26
+ background-color: #CCCC33;
27
+ color: #000000;
28
+ }
29
+ pre.all_hallows_eve .BlockComment {
30
+ background-color: #9B9B9B;
31
+ color: #FFFFFF;
32
+ }
33
+ pre.all_hallows_eve .TagName {
34
+ text-decoration: underline;
35
+ }
36
+ pre.all_hallows_eve .PreProcessorLine {
37
+ color: #D0D0FF;
38
+ }
39
+ pre.all_hallows_eve .SupportFunction {
40
+ color: #C83730;
41
+ }
42
+ pre.all_hallows_eve .FunctionArgument {
43
+ font-style: italic;
44
+ }
45
+ pre.all_hallows_eve .PreProcessorDirective {
46
+ }
47
+ pre.all_hallows_eve .StringEscapes {
48
+ color: #AAAAAA;
49
+ }
50
+ pre.all_hallows_eve .SourceBase {
51
+ background-color: #000000;
52
+ color: #FFFFFF;
53
+ }
54
+ pre.all_hallows_eve .TagAttribute {
55
+ }
56
+ pre.all_hallows_eve .StringLiteral {
57
+ color: #CCCC33;
58
+ }
59
+ pre.all_hallows_eve .String {
60
+ color: #66CC33;
61
+ }
62
+ pre.all_hallows_eve .Keyword {
63
+ color: #CC7833;
64
+ }
65
+ pre.all_hallows_eve .RegularExpression {
66
+ color: #CCCC33;
67
+ }
68
+ pre.all_hallows_eve .FunctionName {
69
+ }
70
+ pre.all_hallows_eve .Comment {
71
+ color: #9933CC;
72
+ }
@@ -0,0 +1,147 @@
1
+ pre.amy .PolymorphicVariants {
2
+ color: #60B0FF;
3
+ font-style: italic;
4
+ }
5
+ pre.amy .KeywordDecorator {
6
+ color: #D0D0FF;
7
+ }
8
+ pre.amy .Punctuation {
9
+ color: #805080;
10
+ }
11
+ pre.amy .InheritedClass {
12
+ }
13
+ pre.amy .InvalidDepricated {
14
+ background-color: #CC66FF;
15
+ color: #200020;
16
+ }
17
+ pre.amy .LibraryVariable {
18
+ }
19
+ pre.amy .TokenReferenceOcamlyacc {
20
+ color: #3CB0D0;
21
+ }
22
+ pre.amy .Storage {
23
+ color: #B0FFF0;
24
+ }
25
+ pre.amy .KeywordOperator {
26
+ color: #A0A0FF;
27
+ }
28
+ pre.amy .CharacterConstant {
29
+ color: #666666;
30
+ }
31
+ pre.amy .line-numbers {
32
+ background-color: #800000;
33
+ color: #000000;
34
+ }
35
+ pre.amy .ClassName {
36
+ color: #70E080;
37
+ }
38
+ pre.amy .Int64Constant {
39
+ font-style: italic;
40
+ }
41
+ pre.amy .NonTerminalReferenceOcamlyacc {
42
+ color: #C0F0F0;
43
+ }
44
+ pre.amy .TokenDefinitionOcamlyacc {
45
+ color: #3080A0;
46
+ }
47
+ pre.amy .ClassType {
48
+ color: #70E0A0;
49
+ }
50
+ pre.amy .ControlKeyword {
51
+ color: #80A0FF;
52
+ }
53
+ pre.amy .LineNumberDirectives {
54
+ text-decoration: underline;
55
+ color: #C080C0;
56
+ }
57
+ pre.amy .FloatingPointConstant {
58
+ text-decoration: underline;
59
+ }
60
+ pre.amy .Int32Constant {
61
+ font-weight: bold;
62
+ }
63
+ pre.amy .TagName {
64
+ color: #009090;
65
+ }
66
+ pre.amy .ModuleTypeDefinitions {
67
+ text-decoration: underline;
68
+ color: #B000B0;
69
+ }
70
+ pre.amy .Integer {
71
+ color: #7090B0;
72
+ }
73
+ pre.amy .Camlp4TempParser {
74
+ }
75
+ pre.amy .InvalidIllegal {
76
+ font-weight: bold;
77
+ background-color: #FFFF00;
78
+ color: #400080;
79
+ }
80
+ pre.amy .LibraryConstant {
81
+ background-color: #200020;
82
+ }
83
+ pre.amy .ModuleDefinitions {
84
+ color: #B000B0;
85
+ }
86
+ pre.amy .Variants {
87
+ color: #60B0FF;
88
+ }
89
+ pre.amy .CompilerDirectives {
90
+ color: #C080C0;
91
+ }
92
+ pre.amy .FloatingPointInfixOperator {
93
+ text-decoration: underline;
94
+ }
95
+ pre.amy .BuiltInConstant1 {
96
+ }
97
+ pre.amy {
98
+ background-color: #200020;
99
+ color: #D0D0FF;
100
+ }
101
+ pre.amy .FunctionArgument {
102
+ color: #80B0B0;
103
+ }
104
+ pre.amy .FloatingPointPrefixOperator {
105
+ text-decoration: underline;
106
+ }
107
+ pre.amy .NativeintConstant {
108
+ font-weight: bold;
109
+ }
110
+ pre.amy .BuiltInConstant {
111
+ color: #707090;
112
+ }
113
+ pre.amy .BooleanConstant {
114
+ color: #8080A0;
115
+ }
116
+ pre.amy .LibraryClassType {
117
+ }
118
+ pre.amy .TagAttribute {
119
+ }
120
+ pre.amy .Keyword {
121
+ color: #A080FF;
122
+ }
123
+ pre.amy .UserDefinedConstant {
124
+ }
125
+ pre.amy .String {
126
+ color: #999999;
127
+ }
128
+ pre.amy .Camlp4Code {
129
+ background-color: #350060;
130
+ }
131
+ pre.amy .NonTerminalDefinitionOcamlyacc {
132
+ color: #90E0E0;
133
+ }
134
+ pre.amy .FunctionName {
135
+ color: #50A0A0;
136
+ }
137
+ pre.amy .SupportModules {
138
+ color: #A00050;
139
+ }
140
+ pre.amy .Variable {
141
+ color: #008080;
142
+ }
143
+ pre.amy .Comment {
144
+ background-color: #200020;
145
+ color: #404080;
146
+ font-style: italic;
147
+ }