rtomayko / rocco

Rocco is Docco in Ruby
MIT License
404 stars 80 forks source link

best way to use rocco programmatically? #102

Open adamwong246 opened 10 years ago

adamwong246 commented 10 years ago

I'd like to call rocco in the compilation of my middleman website but Rocco reads and writes to files and it's an ugly hack ( to me) to write to a temporary file. Is there a nice way to call rocco on a string and to a string?

adamwong246 commented 10 years ago

Answer:

<%= rcc = Rocco.new( 'something.rb', [], {} ) { 
<<EOF
  activate :blog do |blog|
    blog.prefix = "blog"
    # blog.permalink = ":year/:month/:day/:title.html"
    # blog.sources = ":year-:month-:day-:title.html"
    # blog.taglink = "tags/:tag.html"
    # blog.layout = "layout"
    # blog.summary_separator = /(READMORE)/
    # blog.summary_length = 250
    # blog.year_link = ":year.html"
    # blog.month_link = ":year/:month.html"
    # blog.day_link = ":year/:month/:day.html"
    # blog.default_extension = ".markdown"

    blog.tag_template = "tag.html"
    blog.calendar_template = "calendar.html"

    # blog.paginate = true
    # blog.per_page = 10
    # blog.page_link = "page/:num"
  end

  page "/feed.xml", :layout => false
EOF
}.to_html %>