Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mustdown

1,324 views

Published on

Slides of the talk I gave at Paris.rb on 12/11/2012.

Published in: Technology
  • Be the first to comment

Mustdown

  1. 1. MustdownSimon Courtois - @happynoff
  2. 2. Mustache name: Github slogan: Social Coding (for all) Object url: http://github.com <h1>The {{name}} company</h1> <p>Slogan: {{slogan}}</p> <p>Site: {{url}}</p> <h1>The Github company</h1> <p>Slogan: Social Coding (for all)</p> Mustache <p>Site: http://github.com</p> HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  3. 3. Mustache name: Github slogan: Social Coding (for all) url: http://github.com projects: - title: Hubot url: https://github.com/github/hubot Object - title: Gollum url: https://github.com/github/gollum <h1>The {{name}} company</h1> <p>Slogan: {{slogan}}</p> <h1>The Github company</h1> <p>Site: {{url}}</p> <p>Slogan: Social Coding (for all)</p> <ul> {{#projects}} <p>Site: http://github.com</p> <li>{{title}}: {{url}}</li> {{/projects}} <ul> </ul> <li>Hubot: https://github.com/github/hubot</li> <li>Gollum: https://github.com/github/gollum</li> Mustache </ul> HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  4. 4. Mustache ActiveRecord company = Company.where(name: Github).first template = <<-END Ruby <h1>The {{name}} company</h1> <p>Slogan: {{slogan}}</p> <p>Site: {{url}}</p> <h1>The Github company</h1> <ul> {{#projects}} <p>Slogan: Social Coding (for all)</p> <li>{{title}}: {{url}}</li> {{/projects}} <p>Site: http://github.com</p> </ul> <ul> END <li>Hubot: https://github.com/github/hubot</li> <li>Gollum: https://github.com/github/gollum</li> Mustache.render(template, company) </ul> HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  5. 5. Markdown # The Github company Markdown Slogan: Social Coding (for all) Site: [Github](http://github.com) * Hubot * Gollum <h1>The Github company</h1> <p>Slogan: Social Coding (for all)</p> <p>Site: <a href=”http://github.com”>Github</a></p> <ul> <li>Hubot</li> <li>Gollum</li> </ul> HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  6. 6. Mustdown name: Github slogan: Social Coding (for all) url: http://github.com projects: - title: Hubot url: https://github.com/github/hubot Object - title: Gollum url: https://github.com/github/gollum # The {{name}} company Slogan: {{slogan}} <h1>The Github company</h1> Site: {{url}} <p>Slogan: Social Coding (for all)</p> {{#projects}} <p>Site: http://github.com</p> * {{title}}: {{url}} {{/projects}} <ul> <li>Hubot: https://github.com/github/hubot</li> Mustdown <li>Gollum: https://github.com/github/gollum</li> </ul> HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  7. 7. Mustdown - helpers class CompaniesController < ApplicationController def show Controller @company = Company.where(name: Github).first @template = <<-END # The {{name}} company Slogan: {{slogan}} Site: {{url}} {{#projects}} * {{title}}: {{url}} {{/projects}} <h1>The Github company</h1> END <p>Slogan: Social Coding (for all)</p> end end <p>Site: http://github.com</p> <ul> <li>Hubot: https://github.com/github/hubot</li># app/views/companies/show.html.erb <li>Gollum: https://github.com/github/gollum</li><%= mustdown @template, @company %> </ul> View HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  8. 8. Mustdown - helpers class CompaniesController < ApplicationController def show Controller @company = Company.where(name: Github).first end end en: companies: en.yml show: text: | # The {{name}} company Slogan: {{slogan}} <h1>The Github company</h1> Site: {{url}} <p>Slogan: Social Coding (for all)</p> {{#projects}} * {{title}}: {{url}} <p>Site: http://github.com</p> {{/projects}} <ul> <li>Hubot: https://github.com/github/hubot</li># app/views/companies/show.html.erb <li>Gollum: https://github.com/github/gollum</li><%= mustdown t(‘.text’), @company %> </ul> View HTMLgithub: simonc/mustdown http://slidesha.re/mustdown
  9. 9. Mustdown - helpers <%= mustdown template, object %> <%= mustache template, object %> <%= markdown template %>github: simonc/mustdown http://slidesha.re/mustdown
  10. 10. Installation gem mustdown redcarpet mustache http://github.com/simonc/mustdowngithub: simonc/mustdown http://slidesha.re/mustdown
  11. 11. Configuration $ rails generate mustdown:install # config/initializers/mustdown.rb Mustdown.configure do |config| config.markdown_extensions = { no_intra_emphasis: true, tables: true, fenced_code_blocks: true, autolink: true, strikethrough: true } config.renderer_options = { no_styles: true, safe_links_only: true } endgithub: simonc/mustdown http://slidesha.re/mustdown
  12. 12. Configuration <%= markdown template, { autolink: false }, { no_links: true } %> <%= mustdown template, object, { autolink: false }, { no_links: true } %>github: simonc/mustdown http://slidesha.re/mustdown
  13. 13. Mustdown - TODO Rails Tests Tests Tests !github: simonc/mustdown http://slidesha.re/mustdown
  14. 14. Questions ?github: simonc/mustdown http://slidesha.re/mustdown
  15. 15. Merci ! @happynoffgithub: simonc/mustdown http://slidesha.re/mustdown

×