mbrao 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +6 -0
  2. data/.travis-gemfile +13 -0
  3. data/.travis.yml +8 -0
  4. data/.yardopts +1 -0
  5. data/Gemfile +21 -0
  6. data/README.md +60 -0
  7. data/Rakefile +11 -0
  8. data/doc/ActionView/Template/Handlers/MbraoTemplate.html +568 -0
  9. data/doc/ActionView/Template/Handlers.html +125 -0
  10. data/doc/HTML/Pipeline/KramdownFilter.html +354 -0
  11. data/doc/HTML/Pipeline.html +140 -0
  12. data/doc/HTML.html +125 -0
  13. data/doc/Mbrao/Author.html +1402 -0
  14. data/doc/Mbrao/Content.html +4779 -0
  15. data/doc/Mbrao/ContentPublicInterface.html +658 -0
  16. data/doc/Mbrao/Exceptions/InvalidDate.html +133 -0
  17. data/doc/Mbrao/Exceptions/InvalidMetadata.html +133 -0
  18. data/doc/Mbrao/Exceptions/Parsing.html +133 -0
  19. data/doc/Mbrao/Exceptions/Rendering.html +133 -0
  20. data/doc/Mbrao/Exceptions/UnavailableLocalization.html +133 -0
  21. data/doc/Mbrao/Exceptions/Unimplemented.html +133 -0
  22. data/doc/Mbrao/Exceptions/UnknownEngine.html +133 -0
  23. data/doc/Mbrao/Exceptions.html +125 -0
  24. data/doc/Mbrao/Parser.html +418 -0
  25. data/doc/Mbrao/ParsingEngines/Base.html +658 -0
  26. data/doc/Mbrao/ParsingEngines/PlainText.html +571 -0
  27. data/doc/Mbrao/ParsingEngines.html +127 -0
  28. data/doc/Mbrao/PublicInterface/ClassMethods.html +1727 -0
  29. data/doc/Mbrao/PublicInterface.html +134 -0
  30. data/doc/Mbrao/RenderingEngines/Base.html +280 -0
  31. data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +873 -0
  32. data/doc/Mbrao/RenderingEngines.html +127 -0
  33. data/doc/Mbrao/Validations/ClassMethods.html +692 -0
  34. data/doc/Mbrao/Validations.html +134 -0
  35. data/doc/Mbrao/Version.html +189 -0
  36. data/doc/Mbrao.html +130 -0
  37. data/doc/_index.html +395 -0
  38. data/doc/class_list.html +53 -0
  39. data/doc/css/common.css +1 -0
  40. data/doc/css/full_list.css +57 -0
  41. data/doc/css/style.css +338 -0
  42. data/doc/file.README.html +135 -0
  43. data/doc/file_list.html +55 -0
  44. data/doc/frames.html +28 -0
  45. data/doc/index.html +135 -0
  46. data/doc/js/app.js +214 -0
  47. data/doc/js/full_list.js +173 -0
  48. data/doc/js/jquery.js +4 -0
  49. data/doc/method_list.html +516 -0
  50. data/doc/top-level-namespace.html +112 -0
  51. data/lib/mbrao/author.rb +61 -0
  52. data/lib/mbrao/content.rb +300 -0
  53. data/lib/mbrao/exceptions.rb +38 -0
  54. data/lib/mbrao/integrations/rails.rb +51 -0
  55. data/lib/mbrao/parser.rb +276 -0
  56. data/lib/mbrao/parsing_engines/base.rb +51 -0
  57. data/lib/mbrao/parsing_engines/plain_text.rb +187 -0
  58. data/lib/mbrao/rendering_engines/base.rb +22 -0
  59. data/lib/mbrao/rendering_engines/html_pipeline.rb +147 -0
  60. data/lib/mbrao/version.rb +25 -0
  61. data/lib/mbrao.rb +24 -0
  62. data/mbrao.gemspec +31 -0
  63. data/spec/coverage_helper.rb +17 -0
  64. data/spec/mbrao/author_spec.rb +62 -0
  65. data/spec/mbrao/content_spec.rb +280 -0
  66. data/spec/mbrao/integrations/rails_spec.rb +92 -0
  67. data/spec/mbrao/parser_spec.rb +269 -0
  68. data/spec/mbrao/parsing_engines/base_spec.rb +52 -0
  69. data/spec/mbrao/parsing_engines/plain_text_spec.rb +141 -0
  70. data/spec/mbrao/rendering_engines/base_spec.rb +17 -0
  71. data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +128 -0
  72. data/spec/spec_helper.rb +15 -0
  73. metadata +195 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ Gemfile.lock
2
+ tester.rb
3
+ coverage/
4
+ pkg/
5
+ .idea/
6
+ .yardoc/
data/.travis-gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+ #
3
+ # This file is part of the mbrao gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
4
+ # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
5
+ #
6
+
7
+ source "http://rubygems.org"
8
+
9
+ gemspec
10
+
11
+ # Testing
12
+ gem "rspec", "~> 2.12.0"
13
+ gem "rake", "~> 10.0.3"
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ script: bundle exec rake spec
6
+ gemfile: .travis-gemfile
7
+ notifications:
8
+ email: false
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -m markdown --verbose
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ #
3
+ # This file is part of the mbrao gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
4
+ # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
5
+ #
6
+
7
+ source "http://rubygems.org"
8
+
9
+ gemspec
10
+
11
+ # Testing
12
+ gem "rspec", "~> 2.13.0"
13
+ gem "rake", "~> 10.0.3"
14
+ gem "actionpack", "~> 3.2.12"
15
+
16
+ # Documentation
17
+ gem "simplecov", ">= 0.7.1"
18
+ gem "pry", ">= 0"
19
+ gem "yard", ">= 0.8.5"
20
+ gem "kramdown", ">= 0.14.2"
21
+ gem "github-markup", ">= 0.7.5"
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # Introduction
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/mbrao.png)](http://badge.fury.io/rb/mbrao)
4
+ [![Dependency Status](https://gemnasium.com/ShogunPanda/mbrao.png?travis)](https://gemnasium.com/ShogunPanda/mbrao)
5
+ [![Build Status](https://secure.travis-ci.org/ShogunPanda/mbrao.png?branch=master)](https://travis-ci.org/ShogunPanda/mbrao)
6
+ [![Code Climate](https://codeclimate.com/github/ShogunPanda/mbrao.png)](https://codeclimate.com/github/ShogunPanda/mbrao)
7
+
8
+ A content parser and renderer with embedded metadata support.
9
+
10
+ http://sw.cow.tc/mbrao
11
+
12
+ http://rdoc.info/gems/mbrao
13
+
14
+ # Introduction
15
+
16
+ mbrao is a content parser and renderer framework for managing posts which have both metadata and content.
17
+
18
+ First of all a big thanks to the [metadown](https://github.com/steveklabnik/metadown) project which gave me the final idea.
19
+
20
+ ## Usage
21
+
22
+ Using mbrao is pretty simple. First of all you have to parse a file with a parsing engine:
23
+
24
+ `content = Mbrao::Parser.parse(File.read("/your/content.txt")`
25
+
26
+ The default is a plain text reader. This engine reads a text file and parse metadata embedded between `{{metadata}}` and `{{/metadata}}` tag in YAML format.
27
+
28
+ The method above will return a `Content` object which you can use in your code. This object has builtin support for title, body and tags metadata; all with locale support.
29
+
30
+ There is also locale filtering. See documentation for more information.
31
+
32
+ At the end, you can render the content using any engine of your choice:
33
+
34
+ `Mbrao::Parser.render(content)`
35
+
36
+ The default is a [html-pipeline](https://github.com/jch/html-pipeline) renderer with [kramdown](http://kramdown.rubyforge.org/) support.
37
+
38
+ ## Ruby on Rails support
39
+
40
+ mbrao has support for integrations with other frameworks. Builtin there is support for Ruby on Rails integration.
41
+
42
+ By including `gem mbrao` in your `Gemfile` you'll get automatic rendering of `emt` file.
43
+
44
+ You can customize the rendering engine used by including the `engine` metadata. Also, your controller will get a new `mbrao_content` helper method with the parsed content.
45
+
46
+ ## Contributing to mbrao
47
+
48
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
49
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
50
+ * Fork the project.
51
+ * Start a feature/bugfix branch.
52
+ * Commit and push until you are happy with your contribution.
53
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
54
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
55
+
56
+ ## Copyright
57
+
58
+ Copyright (C) 2013 and above Shogun (shogun_panda@me.com).
59
+
60
+ Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+ #
3
+ # This file is part of the mbrao gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
4
+ # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
5
+ #
6
+
7
+ require "bundler/gem_tasks"
8
+ require "rspec/core/rake_task"
9
+
10
+ RSpec::Core::RakeTask.new("spec")
11
+ RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }