Skip to content

Commit

Permalink
Use YARD for documentation.
Browse files Browse the repository at this point in the history
Signed-off-by: Yorick Peterse <[email protected]>
  • Loading branch information
Yorick Peterse committed May 11, 2013
1 parent 8e80dc4 commit c3d33dd
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/build
lib/bundler/man
pkg
rdoc
Expand All @@ -21,4 +22,3 @@ lib/parser/ruby18.rb
lib/parser/ruby19.rb
lib/parser/ruby20.rb
lib/parser/ruby21.rb

16 changes: 12 additions & 4 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
--markup-provider redcarpet
--markup markdown
-o yardoc/
- doc/*
./lib/parser/**/*.rb ./lib/parser.rb
-m markdown
-M redcarpet
-o ./doc/build
-r ./README.md
--private
--protected
--asset ./doc/css/common.css:css/common.css

This comment has been minimized.

Copy link
@yorickpeterse

yorickpeterse May 11, 2013

Contributor

To clarify, this adds a stylesheet that gives the generated layout a fixed width. This in turn makes it a lot easier to read the text.

--verbose
-
./doc/*.md
LICENSE.txt
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in parser.gemspec
gemspec

gem 'redcarpet', '~> 1.0', :platform => :mri
gem 'redcarpet', '~> 2.0', :platform => :mri

This comment has been minimized.

Copy link
@yorickpeterse

yorickpeterse May 11, 2013

Contributor

Redcarpet 1.0 is stone age old.

5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ task :clean_env do
ENV.delete 'RACC_DEBUG'
end

desc 'Generates YARD documentation'
task :yard => :generate do
sh('yard doc')

This comment has been minimized.

Copy link
@whitequark
end

rule '.rb' => '.rl' do |t|
sh "ragel -R #{t.source} -o #{t.name}"
end
Expand Down
Empty file added doc/css/.gitkeep
Empty file.
68 changes: 68 additions & 0 deletions doc/css/common.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
body
{
font-size: 14px;
line-height: 1.6;
margin: 0 auto;
max-width: 960px;
}

p code
{
background: #f2f2f2;
padding-left: 3px;
padding-right: 3px;
}

pre.code
{
font-size: 13px;
line-height: 1.4;
}

/**
* YARD uses generic table styles, using a special class means those tables
* don't get messed up.
*/
.table
{
border: 1px solid #ccc;
border-right: none;
border-collapse: separate;
border-spacing: 0;
text-align: left;
}

.table.full
{
width: 100%;
}

.table .field_name
{
min-width: 160px;
}

.table thead tr th.no_sort:first-child
{
width: 25px;
}

.table thead tr th, .table tbody tr td
{
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc;
min-width: 20px;
padding: 8px 5px;
text-align: left;
vertical-align: top;
}

.table tbody tr:last-child td
{
border-bottom: none;
}

.table tr:nth-child(odd) td
{
background: #f9f9f9;
}
1 change: 1 addition & 0 deletions parser.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
spec.summary = spec.description
spec.homepage = 'http://github.com/whitequark/parser'
spec.license = 'MIT'
spec.has_rdoc = 'yard'

spec.files = `git ls-files`.split($/) + %w(
lib/parser/lexer.rb
Expand Down

0 comments on commit c3d33dd

Please sign in to comment.