acts_as_api 0.2.2 → 0.3.0

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 (73) hide show
  1. data/.gitignore +10 -0
  2. data/Gemfile +12 -0
  3. data/History.txt +8 -0
  4. data/README.rdoc +29 -225
  5. data/Rakefile +20 -28
  6. data/acts_as_api.gemspec +31 -0
  7. data/examples/introduction/docco.css +186 -0
  8. data/examples/introduction/index.html +340 -0
  9. data/examples/introduction/index.rb +132 -0
  10. data/examples/introduction/layout.mustache +64 -0
  11. data/lib/acts_as_api.rb +11 -25
  12. data/lib/acts_as_api/api_template.rb +14 -0
  13. data/lib/acts_as_api/base.rb +61 -56
  14. data/lib/acts_as_api/config.rb +34 -0
  15. data/lib/acts_as_api/rails_renderer.rb +15 -0
  16. data/lib/acts_as_api/rendering.rb +11 -8
  17. data/lib/acts_as_api/version.rb +4 -0
  18. data/spec/controllers/respond_with_users_controller_spec.rb +5 -0
  19. data/spec/controllers/users_controller_spec.rb +161 -0
  20. data/spec/models/base_spec.rb +437 -0
  21. data/spec/rails_app/.gitignore +4 -0
  22. data/spec/rails_app/Rakefile +7 -0
  23. data/spec/rails_app/app/controllers/application_controller.rb +3 -0
  24. data/spec/rails_app/app/controllers/respond_with_users_controller.rb +15 -0
  25. data/spec/rails_app/app/controllers/users_controller.rb +21 -0
  26. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  27. data/spec/rails_app/app/models/task.rb +3 -0
  28. data/spec/rails_app/app/models/untouched.rb +2 -0
  29. data/spec/rails_app/app/models/user.rb +69 -0
  30. data/spec/rails_app/app/views/layouts/application.html.erb +14 -0
  31. data/spec/rails_app/config.ru +4 -0
  32. data/spec/rails_app/config/application.rb +42 -0
  33. data/spec/rails_app/config/boot.rb +6 -0
  34. data/spec/rails_app/config/database.yml +23 -0
  35. data/spec/rails_app/config/environment.rb +5 -0
  36. data/spec/rails_app/config/environments/development.rb +26 -0
  37. data/spec/rails_app/config/environments/production.rb +49 -0
  38. data/spec/rails_app/config/environments/test.rb +35 -0
  39. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  41. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  42. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  43. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  44. data/spec/rails_app/config/locales/en.yml +5 -0
  45. data/spec/rails_app/config/routes.rb +7 -0
  46. data/spec/rails_app/db/migrate/20110214201640_create_tables.rb +35 -0
  47. data/spec/rails_app/db/schema.rb +34 -0
  48. data/spec/rails_app/db/seeds.rb +7 -0
  49. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  50. data/spec/rails_app/public/404.html +26 -0
  51. data/spec/rails_app/public/422.html +26 -0
  52. data/spec/rails_app/public/500.html +26 -0
  53. data/spec/rails_app/public/favicon.ico +0 -0
  54. data/spec/rails_app/public/images/rails.png +0 -0
  55. data/spec/rails_app/public/index.html +239 -0
  56. data/spec/rails_app/public/javascripts/application.js +2 -0
  57. data/spec/rails_app/public/javascripts/controls.js +965 -0
  58. data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
  59. data/spec/rails_app/public/javascripts/effects.js +1123 -0
  60. data/spec/rails_app/public/javascripts/prototype.js +6001 -0
  61. data/spec/rails_app/public/javascripts/rails.js +191 -0
  62. data/spec/rails_app/public/robots.txt +5 -0
  63. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  64. data/spec/rails_app/script/rails +6 -0
  65. data/spec/spec_helper.rb +12 -13
  66. data/spec/support/api_test_helpers.rb +23 -0
  67. metadata +137 -35
  68. data/Manifest.txt +0 -15
  69. data/script/console +0 -10
  70. data/script/destroy +0 -14
  71. data/script/generate +0 -14
  72. data/spec/acts_as_api_spec.rb +0 -87
  73. data/tasks/rspec.rake +0 -21
@@ -0,0 +1,10 @@
1
+ nbproject/
2
+ pkg/*
3
+ .bundle
4
+ Gemfile.lock
5
+ test
6
+ acts_as_api.tmproj
7
+ spec/rails_app/db/*.sqlite3
8
+ spec/rails_app/tmp/**/*
9
+ spec/rails_app/log/*.log
10
+ .rspec
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in acts_as_api.gemspec
4
+ gemspec
5
+
6
+
7
+ group :test do
8
+ gem 'sqlite3-ruby'
9
+ gem 'rspec-rails', '>= 2.4.1'
10
+ gem 'webrat'
11
+ gem 'rocco', :git => 'git://github.com/fabrik42/rocco.git'
12
+ end
@@ -1,3 +1,11 @@
1
+ === 0.3.0 TO BE RELEASED AS A GEM
2
+
3
+ * Added bundler support
4
+
5
+ * Added mongoid support
6
+
7
+ * Removed lots of unnecessary dependencies esp. ActiveRecord
8
+
1
9
  === 0.2.2 2010-10-21
2
10
 
3
11
  * Version bump only for changing the github account in the docs.
@@ -1,255 +1,59 @@
1
1
  = acts_as_api
2
2
 
3
- * http://github.com/fabrik42/acts_as_api
4
-
5
- == DESCRIPTION:
6
-
7
3
  acts_as_api makes creating XML/JSON responses in Rails 3 easy and fun.
8
4
 
9
- == FEATURES:
10
-
11
- The built-in XML/JSON support of Rails is great but:
12
-
13
- You surely don't want to expose your models always with all attributes.
14
-
15
- acts_as_api enriches the models and controllers of your app in a rails-like way so
16
- you can easily determine how your API responses should look like.
17
-
18
- acts_as_api uses the *default Rails serializers* for XML and JSON, so you don't have to
19
- mess around with even more dependencies. Once you change the serializers for your Rails app,
20
- they will be changed for acts_as_api too.
21
-
22
- As of the version 0.2.0 it supports multiple api rendering templates for a models.
23
- This is especially useful for API versioning or for example for private vs. public
24
- access points to a user's profile.
25
-
26
- *Note that upgrading to 0.2.0 will break code that worked with previous versions as you now have to specify an API template*
27
-
28
- == SYNOPSIS:
29
-
30
- === Set up your model
31
-
32
- Say you have a model +Customer+ and every customer has many +Orders+.
33
-
34
- If you only want to expose the +firstname+ and +lastname+ attribute of a customer
35
- via the api, you would do something like this:
36
-
37
-
38
- class Customer < ActiveRecord::Base
39
-
40
- has_many :orders
41
-
42
- # let this model act as api!
43
- acts_as_api
44
-
45
- # define the accessible attributes/methods for the api response
46
- api_accessible :default => [ :firstname, :lastname ]
47
-
48
- end
49
-
50
-
51
- An API template with the name +:default+ was created, see below how to use it in the controller:
5
+ == Introduction
52
6
 
53
- === Set up controller
7
+ acts_as_api enriches the models and controllers of your app in a rails-like way so you can easily determine how your API responses should look like:
54
8
 
55
- Now you just have to exchange the +render+ method in your controller for the +render_for_api+ method.
9
+ class User < ActiveRecord::Base
56
10
 
57
- class CustomersController < ApplicationController
11
+ acts_as_api
58
12
 
59
- def show
60
- @customer = Customer.find(params[:id])
61
-
62
- respond_to do |format|
63
- format.html # show.html.erb
64
- format.xml { render_for_api :default, :xml => @customer }
65
- format.json { render_for_api :default, :json => @customer }
13
+ api_accessible :name_only do |template|
14
+ template.add :first_name
15
+ template.add :last_name
66
16
  end
67
- end
68
-
69
- end
70
-
71
-
72
- === That's it!
73
-
74
- Try it. The response should now look like this:
75
-
76
- <?xml version="1.0" encoding="UTF-8"?>
77
- <customer>
78
- <firstname>John</firstname>
79
- <lastname>Doe</lastname>
80
- </customer>
81
-
82
- Other attributes of the model like +created_at+ or +updated_at+ won't be included because they were
83
- not listed by +api_accessible+ in the model.
84
-
85
- == But you can do more...
86
-
87
- === API Versioning
88
17
 
89
- With the different named API templates, API versioning is pretty easy:
90
-
91
- class User < ActiveRecord::Base
92
-
93
- # let this model act as api!
94
- acts_as_api
95
-
96
- # define the accessible attributes/methods for the api response
97
- api_accessible
98
- :v1_public => [ :firstname, :age ],
99
- :v2_public => [ :firstname, :age, :sex ],
100
-
101
- :v1_private => [ :firstname, :lastname, :age, :sex ],
102
- :v2_private => [ :firstname, :lastname, :age, :sex, :phone ]
103
-
104
- end
105
-
106
- Now you could create a method in the application controller of your app:
107
-
108
- def api_template(version = :v2, template = :public)
109
- "#{version.to_s}_#{template.to_s}".to_sym
110
18
  end
111
19
 
112
- And render the API responses:
113
20
 
114
- class UsersController < ApplicationController
21
+ A nice introduction about acts_as_api with examples can be found here:
115
22
 
116
- # renders the :v2_public template
117
- def show
118
- @user = User.find(params[:id])
23
+ http://fabrik42.github.com/acts_as_api
119
24
 
120
- respond_to do |format|
121
- format.html # show.html.erb
122
- format.xml { render_for_api api_template, :xml => @user }
123
- format.json { render_for_api api_template, :json => @user }
124
- end
125
- end
126
25
 
127
- # renders the :v1_private template
128
- def profile_deprecated
129
- @user = @current_user
26
+ == Features:
130
27
 
131
- respond_to do |format|
132
- format.html # show.html.erb
133
- format.xml { render_for_api api_template(:v1, :private), :xml => @user }
134
- format.json { render_for_api api_template(:v1, :private), :json => @user }
135
- end
136
- end
137
-
138
- end
139
-
140
-
141
- === Metadata
142
-
143
- You can include metadata elements in the response outside of your objects and collections. Typical usage for this is to include a total results count or page. Just pass in a :meta key with a hash of the meta items you want.
144
-
145
- class CustomersController < ApplicationController
146
-
147
- def index
148
- @customers = Customer.paginate(:all, :page = params[:page])
149
- metadata = { :total => @customers.total_entries, :page => params[:page] }
150
- respond_to do |format|
151
- format.html # show.html.erb
152
- format.xml { render_for_api :default, :xml => @customer, :meta => metadata }
153
- format.json { render_for_api :default, :json => @customer, :meta => metadata }
154
- end
155
- end
156
-
157
- end
28
+ * DRY templates for your api responses
29
+ * Easy but very flexible syntax for defining the templates
30
+ * XML, JSON and JSON-P support out of the box, easy to extend
31
+ * Minimal dependecies (you can also use it without Rails)
32
+ * Does not rely on ActiveRecord (can be used with other ORMs like Mongoid)
33
+ * Supports multiple api rendering templates for a models. This is especially useful for API versioning or for example for private vs. public access points to a user’s profile.
158
34
 
159
- === What can I include in my responses?
35
+ === Requirements:
160
36
 
161
- You can do basically anything:
37
+ * ActiveModel (>= 3.0.0)
38
+ * ActiveSupport (>= 3.0.0)
39
+ * Rack (>= 1.1.0)
162
40
 
163
- * Include attributes and all other kinds of methods of your model
164
- * Include child associations (if they also act_as_api this will be considered)
165
- * Call methods of a parent association
166
- * Rename attributes, methods, associations
167
- * Create your own hierarchies
168
-
169
- Here are two models from the example app that show how it works.
170
-
171
- The model +Customer+ shows all kinds of ways to add data to your API response.
172
-
173
- class Customer < ActiveRecord::Base
174
-
175
- has_many :orders
176
-
177
- # let this model act as api!
178
- acts_as_api
179
-
180
- # define the accessible attributes/methods for the api response
181
- # some attributes of the model
182
- api_accessible :default => [ :firstname, :lastname, :age,
183
- # you can include methods
184
- :full_name,
185
- # include associated model in response
186
- :orders,
187
- # rename the node for orders
188
- { :renamed_orders => :orders },
189
- # put orders in another subnode
190
- { :subnode_orders => { :sub_oders => :orders } },
191
- # rename nodes/tag names
192
- { :other_node => :say_something },
193
- # create a deeper node hierarchy
194
- { :maybe => { :useful => { :for => :say_something } } }
195
- ]
196
-
197
- # some example methods
198
- def full_name
199
- '' << firstname.to_s << ' ' << lastname.to_s
200
- end
201
-
202
- def say_something
203
- "something"
204
- end
41
+ === Links
205
42
 
206
- end
207
-
208
- The model +Order+ also acts as api and is even able to access a method of their parent customer.
209
-
210
- class Order < ActiveRecord::Base
211
-
212
- belongs_to :customer
213
-
214
- # let this model act as api!
215
- acts_as_api
216
-
217
- # define the accessible attributes/methods for the api response
218
- # some attributes of the model
219
- api_accessible :default => [ :city, :amount,
220
- #access a method of the parent association
221
- { :parent_name => "customer.full_name" }
222
- ]
223
-
224
- end
225
-
226
-
227
- === Is there an example I can play around with?
228
-
229
- If you want a working example right out of the box, grab the example app: http://github.com/fabrik42/acts_as_api_example
230
-
231
-
232
- == REQUIREMENTS:
233
-
234
- * Rails 3.0.0
235
-
236
- == INSTALL:
237
-
238
- sudo gem install acts_as_api
239
-
240
- Then add acts_as_api to the Gemfile of your Rails project
241
-
242
- gem 'acts_as_api'
243
-
244
- == Links
43
+ * Introduction: http://fabrik42.github.com/acts_as_api/
245
44
 
246
45
  * Docs: http://rdoc.info/projects/fabrik42/acts_as_api
247
46
 
248
47
  * Found a bug? http://github.com/fabrik42/acts_as_api/issues
249
48
 
250
- * Example App: http://github.com/fabrik42/acts_as_api_example
49
+ * Wiki: https://github.com/fabrik42/acts_as_api/wiki/
50
+
51
+ === Downwards Compatibility
52
+
53
+ Note that upgrading to 0.3.0 will break code that worked with previous versions due to a complete overhaul of the lib.
54
+ For a legacy version of this readme file look here: https://github.com/fabrik42/acts_as_api/wiki/legacy-acts_as_api-0.2-readme
251
55
 
252
- == LICENSE:
56
+ === LICENSE:
253
57
 
254
58
  (The MIT License)
255
59
 
data/Rakefile CHANGED
@@ -1,28 +1,20 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
- require 'fileutils'
5
- require './lib/acts_as_api'
6
-
7
- Hoe.plugin :newgem
8
- # Hoe.plugin :website
9
- # Hoe.plugin :cucumberfeatures
10
-
11
- # Generate all the Rake tasks
12
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
- $hoe = Hoe.spec 'acts_as_api' do
14
- self.developer 'Christian Bäuerlein', 'christian@ffwdme.com'
15
- #self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
- #self.rubyforge_name = self.name # TODO this is default value
17
- self.extra_deps = [['activerecord','>= 3.0.0'], ['actionpack','>= 3.0.0']]
18
-
19
- end
20
-
21
- require 'newgem/tasks'
22
- # In Netbeans the next lines causes every rspec test to run twice.
23
- # If you're not using Netbeans and having problem with testing - try to disable it.
24
- #Dir['tasks/**/*.rake'].each { |t| load t }
25
-
26
- # TODO - want other tests/tasks run by default? Add them to the list
27
- # remove_task :default
28
- # task :default => [:spec, :features]
1
+ require 'bundler'
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ require 'rake/rdoctask'
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ RSpec::Core::RakeTask.new
9
+
10
+ gemspec = Gem::Specification.load("acts_as_api.gemspec")
11
+
12
+ Rake::RDocTask.new do |rdoc|
13
+ rdoc.rdoc_dir = 'doc'
14
+ rdoc.title = "#{gemspec.name} #{gemspec.version}"
15
+ rdoc.options += gemspec.rdoc_options
16
+ rdoc.rdoc_files.include(gemspec.extra_rdoc_files)
17
+ rdoc.rdoc_files.include('lib/**/*.rb')
18
+ end
19
+
20
+ #bundle exec rocco examples/introduction/intro.rb -t examples/introduction/intro.mustache
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "acts_as_api/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "acts_as_api"
7
+ s.version = ActsAsApi::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Christian Bäuerlein"]
10
+ s.email = ["christian@ffwdme.com"]
11
+ s.homepage = "https://github.com/fabrik42/acts_as_api"
12
+ s.summary = %q{Makes creating XML/JSON responses in Rails 3 easy and fun.}
13
+ s.description = %q{acts_as_api enriches the models and controllers of your app in a rails-like way so you can easily determine how your XML/JSON API responses should look like.}
14
+
15
+ s.add_dependency('activemodel','>= 3.0.0')
16
+ s.add_dependency('activesupport','>= 3.0.0')
17
+ s.add_dependency('rack','>= 1.1.0')
18
+ # TODO: Problem in Rails with JSON dependency?!
19
+ # s.add_dependency('json','>= 1.4.6')
20
+
21
+ s.add_development_dependency('rails', ['>= 3.0.0'])
22
+
23
+ s.has_rdoc = true
24
+ s.rdoc_options = ['--main', 'README.rdoc', '--charset=UTF-8']
25
+ s.extra_rdoc_files = ['README.rdoc']
26
+
27
+ s.files = `git ls-files`.split("\n")
28
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
29
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
30
+ s.require_paths = ["lib"]
31
+ end
@@ -0,0 +1,186 @@
1
+ /*--------------------- Layout and Typography ----------------------------*/
2
+ body {
3
+ font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
4
+ font-size: 15px;
5
+ line-height: 22px;
6
+ color: #252519;
7
+ margin: 0; padding: 0;
8
+ }
9
+ a {
10
+ color: #261a3b;
11
+ }
12
+ a:visited {
13
+ color: #261a3b;
14
+ }
15
+ p {
16
+ margin: 0 0 15px 0;
17
+ }
18
+ h1, h2, h3, h4, h5, h6 {
19
+ margin: 0px 0 15px 0;
20
+ }
21
+ h1 {
22
+ margin-top: 40px;
23
+ }
24
+ #container {
25
+ position: relative;
26
+ }
27
+ #background {
28
+ position: fixed;
29
+ top: 0; left: 525px; right: 0; bottom: 0;
30
+ background: #f5f5ff;
31
+ border-left: 1px solid #e5e5ee;
32
+ z-index: -1;
33
+ }
34
+ #jump_to, #jump_page {
35
+ background: white;
36
+ -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
37
+ -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
38
+ font: 10px Arial;
39
+ text-transform: uppercase;
40
+ cursor: pointer;
41
+ text-align: right;
42
+ }
43
+ #jump_to, #jump_wrapper {
44
+ position: fixed;
45
+ right: 0; top: 0;
46
+ padding: 5px 10px;
47
+ }
48
+ #jump_wrapper {
49
+ padding: 0;
50
+ display: none;
51
+ }
52
+ #jump_to:hover #jump_wrapper {
53
+ display: block;
54
+ }
55
+ #jump_page {
56
+ padding: 5px 0 3px;
57
+ margin: 0 0 25px 25px;
58
+ }
59
+ #jump_page .source {
60
+ display: block;
61
+ padding: 5px 10px;
62
+ text-decoration: none;
63
+ border-top: 1px solid #eee;
64
+ }
65
+ #jump_page .source:hover {
66
+ background: #f5f5ff;
67
+ }
68
+ #jump_page .source:first-child {
69
+ }
70
+ table td {
71
+ border: 0;
72
+ outline: 0;
73
+ }
74
+ td.docs, th.docs {
75
+ max-width: 450px;
76
+ min-width: 450px;
77
+ min-height: 5px;
78
+ padding: 10px 25px 1px 50px;
79
+ overflow-x: hidden;
80
+ vertical-align: top;
81
+ text-align: left;
82
+ }
83
+ .docs pre {
84
+ margin: 15px 0 15px;
85
+ padding-left: 15px;
86
+ }
87
+ .docs p tt, .docs p code {
88
+ background: #f8f8ff;
89
+ border: 1px solid #dedede;
90
+ font-size: 12px;
91
+ padding: 0 0.2em;
92
+ }
93
+ .pilwrap {
94
+ position: relative;
95
+ }
96
+ .pilcrow {
97
+ font: 12px Arial;
98
+ text-decoration: none;
99
+ color: #454545;
100
+ position: absolute;
101
+ top: 3px; left: -20px;
102
+ padding: 1px 2px;
103
+ opacity: 0;
104
+ -webkit-transition: opacity 0.2s linear;
105
+ }
106
+ td.docs:hover .pilcrow {
107
+ opacity: 1;
108
+ }
109
+ td.code, th.code {
110
+ padding: 14px 15px 16px 25px;
111
+ width: 100%;
112
+ vertical-align: top;
113
+ background: #f5f5ff;
114
+ border-left: 1px solid #e5e5ee;
115
+ }
116
+ pre, tt, code {
117
+ font-size: 12px; line-height: 18px;
118
+ font-family: Monaco, Consolas, "Lucida Console", monospace;
119
+ margin: 0; padding: 0;
120
+ }
121
+
122
+
123
+ /*---------------------- Syntax Highlighting -----------------------------*/
124
+ td.linenos { background-color: #f0f0f0; padding-right: 10px; }
125
+ span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
126
+ body .hll { background-color: #ffffcc }
127
+ body .c { color: #408080; font-style: italic } /* Comment */
128
+ body .err { border: 1px solid #FF0000 } /* Error */
129
+ body .k { color: #954121 } /* Keyword */
130
+ body .o { color: #666666 } /* Operator */
131
+ body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
132
+ body .cp { color: #BC7A00 } /* Comment.Preproc */
133
+ body .c1 { color: #408080; font-style: italic } /* Comment.Single */
134
+ body .cs { color: #408080; font-style: italic } /* Comment.Special */
135
+ body .gd { color: #A00000 } /* Generic.Deleted */
136
+ body .ge { font-style: italic } /* Generic.Emph */
137
+ body .gr { color: #FF0000 } /* Generic.Error */
138
+ body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
139
+ body .gi { color: #00A000 } /* Generic.Inserted */
140
+ body .go { color: #808080 } /* Generic.Output */
141
+ body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
142
+ body .gs { font-weight: bold } /* Generic.Strong */
143
+ body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
144
+ body .gt { color: #0040D0 } /* Generic.Traceback */
145
+ body .kc { color: #954121 } /* Keyword.Constant */
146
+ body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
147
+ body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
148
+ body .kp { color: #954121 } /* Keyword.Pseudo */
149
+ body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
150
+ body .kt { color: #B00040 } /* Keyword.Type */
151
+ body .m { color: #666666 } /* Literal.Number */
152
+ body .s { color: #219161 } /* Literal.String */
153
+ body .na { color: #7D9029 } /* Name.Attribute */
154
+ body .nb { color: #954121 } /* Name.Builtin */
155
+ body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
156
+ body .no { color: #880000 } /* Name.Constant */
157
+ body .nd { color: #AA22FF } /* Name.Decorator */
158
+ body .ni { color: #999999; font-weight: bold } /* Name.Entity */
159
+ body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
160
+ body .nf { color: #0000FF } /* Name.Function */
161
+ body .nl { color: #A0A000 } /* Name.Label */
162
+ body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
163
+ body .nt { color: #954121; font-weight: bold } /* Name.Tag */
164
+ body .nv { color: #19469D } /* Name.Variable */
165
+ body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
166
+ body .w { color: #bbbbbb } /* Text.Whitespace */
167
+ body .mf { color: #666666 } /* Literal.Number.Float */
168
+ body .mh { color: #666666 } /* Literal.Number.Hex */
169
+ body .mi { color: #666666 } /* Literal.Number.Integer */
170
+ body .mo { color: #666666 } /* Literal.Number.Oct */
171
+ body .sb { color: #219161 } /* Literal.String.Backtick */
172
+ body .sc { color: #219161 } /* Literal.String.Char */
173
+ body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
174
+ body .s2 { color: #219161 } /* Literal.String.Double */
175
+ body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
176
+ body .sh { color: #219161 } /* Literal.String.Heredoc */
177
+ body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
178
+ body .sx { color: #954121 } /* Literal.String.Other */
179
+ body .sr { color: #BB6688 } /* Literal.String.Regex */
180
+ body .s1 { color: #219161 } /* Literal.String.Single */
181
+ body .ss { color: #19469D } /* Literal.String.Symbol */
182
+ body .bp { color: #954121 } /* Name.Builtin.Pseudo */
183
+ body .vc { color: #19469D } /* Name.Variable.Class */
184
+ body .vg { color: #19469D } /* Name.Variable.Global */
185
+ body .vi { color: #19469D } /* Name.Variable.Instance */
186
+ body .il { color: #666666 } /* Literal.Number.Integer.Long */