dapper-dan
Stable Version: 0.4.0 (Inferno Anger)
dapper-dan is a block-style domain specific language for generating HTML documents.
The DSL is used very similarly to any Ruby DSL, where blocks of logic determine the output.
In 'dapper-dan's case the idea is that 'dapper-dan' methods are given blocks, which represent children nodes.
Using 'dapper-dan' means not having to learn a 3rd abstraction layer, and still getting features like validation.
Examples
Dapper Dan is really easy to use, I've made sure of it. The easiest way to use Dapper Dan is to write a Ruby file! Here, I'll show you:
# A really small web page in Dapper Dan
require 'dapper-dan'
include DapperDan
html do
para do
"I love programming!"
end
para do
strong "I really love using Ruby!"
end
para do
"But I #{strong 'really'} like making web applications."
end
end
Installing
Requirements
- Ruby 1.8.7, Ruby 1.9.2, Rubinius 2.0.0, JRuby
- RubyGems 1.6.7 or better
- [Optional] Rails 3.0 or better
Installing this fun gem is as simple as installing any other gem:
gem install dapper-dan
or adding it to your Gemfile:
gem "dapper-dan", "0.4.0"
Testing
To make sure you did everything right, just do the following:
$ gem list | grep dapper
> dapper-dan (0.4.0)
Issues & Documentation
To read more about Dapper Dan feel free to visit the Wiki, and contribute if you can! Having a problem with Dapper Dan? Think something should be added? Make an Issue and tell us.
Changelog
v0.4.0 (Inferno Anger)
- Rewrote a lot of the DSL
- Worked in validation and checking concepts
- Added a lot more documentation
v0.3.0 (Inferno Greed)
- Adding the really awesome "tag attributes" features
- Working in thea bility to have boolean tag attribute values
- Fixing a really bad bug that cut off the other contents.
- Finalizing the to_html feature
- Working on to_html, and getting the tags just right
v0.2.0 (Inferno Gluttony)
- Having gotten the whole thing working I've added the crud for each tag.
- Fleshing out the structure of the program's path
- Adding a simple to_html, that does nothing so far
- Rewriting the crap out of the entire thing
- Adding all new tag class structure
- Adding the basics of a tag
- Stripping out all the working code down to the basics
- Removing all documentation
Contributing
- Fork the repository
- Clone the repository locally, or edit via Github
- Create a new branch using the Git Flow Standard conventions
- Commit often and when important
- DO NOT CHANGE ANY OF THESE (without making a new branch for that change):
*.gemspecRakefile.rvmrc.gitignore- Any part of the git history
- Write tests specifically for the changes you've made, if no test exist
- Push your feature or hotfix branch to Github.
- Make a Pull Request
Credits
- Michael Richter, for keeping on me to learn more.
- Each of my students, for allowing me to learn by teaching.
- My best developer friends: zzak, steveklabnik, ashbb, and many more!
License
Copyright (c) 2011 Kurtis Rainbolt-Greene
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.