All Projects → pete → Hoshi

pete / Hoshi

First-class views for Ruby.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Hoshi

Jaymock
Minimal fake JSON test data generator.
Stars: ✭ 28 (-31.71%)
Mutual labels:  generator
Sao
⚔ Futuristic scaffolding tool
Stars: ✭ 966 (+2256.1%)
Mutual labels:  generator
Chasm
A CHaracter Aware Splitting Method for producing password candidates.
Stars: ✭ 37 (-9.76%)
Mutual labels:  generator
Catalyst
Typescript NodeJS Microservices Boilerplate with Generator CLI - Moleculer, GraphQL, REST, OAuth2, Jaeger, Grafana, Prometheus, Ory Hydra, Ory Keto w/ Access Control middleware, Moleculer-DB GraphQL mixin, Pug, Redis, sibling client repo (login, persistance layer, react-native-web, ios, android)
Stars: ✭ 30 (-26.83%)
Mutual labels:  generator
Rispa Cli
Modular project management
Stars: ✭ 30 (-26.83%)
Mutual labels:  generator
Renew
Mix task to create mix projects that builds into Docker containers.
Stars: ✭ 33 (-19.51%)
Mutual labels:  generator
Swiftproject
🏆 Generate Swift project with necessary toolings
Stars: ✭ 27 (-34.15%)
Mutual labels:  generator
Generator
Rails-inspired generator system that provides scaffolding for your apps
Stars: ✭ 1,000 (+2339.02%)
Mutual labels:  generator
Generator Angular Auto Admin Loopback
Generator for automatic CRUD angular backend for loopback apps and apis
Stars: ✭ 32 (-21.95%)
Mutual labels:  generator
Ultra light wizard
No time to manage a wizard state machine, session variables, or complicated controllers? Use ultra light wizard!! A RESTful session-less validation-friendly simple multi-step form approach in Rails.
Stars: ✭ 35 (-14.63%)
Mutual labels:  generator
Git Changelog
Automatic Changelog generator using Jinja2 templates.
Stars: ✭ 30 (-26.83%)
Mutual labels:  generator
Ansible Schema Generator
Generate JSON schema for language servers from Ansible module documentation
Stars: ✭ 30 (-26.83%)
Mutual labels:  generator
Swift Template
A template based module generator for Swift projects.
Stars: ✭ 34 (-17.07%)
Mutual labels:  generator
Generator Express Es6
Yeoman generator for Express.js
Stars: ✭ 28 (-31.71%)
Mutual labels:  generator
Papogen
Use Sass/CSS + Pug + Node.js to generate beautiful static website.
Stars: ✭ 37 (-9.76%)
Mutual labels:  generator
Larawiz
Larawiz is a easy project scaffolder for Laravel
Stars: ✭ 28 (-31.71%)
Mutual labels:  generator
Jsontocodable
A generating tool from Raw JSON to Codable (Swift4) text written in Swift4.
Stars: ✭ 33 (-19.51%)
Mutual labels:  generator
Ncform
🍻 ncform, a very nice configuration generation way to develop forms ( vue, json-schema, form, generator )
Stars: ✭ 1,009 (+2360.98%)
Mutual labels:  generator
Ultimate Page Builder
📦 Ultimate Page Builder for WordPress
Stars: ✭ 39 (-4.88%)
Mutual labels:  generator
Trezor Qrenc
⚠️ OBSOLETE. DO NOT USE!
Stars: ✭ 34 (-17.07%)
Mutual labels:  generator

= Hoshi

== Summary

Hoshi is a library for creating real, first-class HTML/XML views. It is a generator, so unlike template libraries, you can take advantage of mixins, inheritance, and all the other wonderful features of Ruby's object system.

In addition to HTML5 and plain XML, Hoshi supports RSS2 and SVG, as well as some older standards like HTML4 and XHTML1. (If you need anything more specific, it is easy to extend, and if you want to contribute, patches are welcome.)

Hoshi is designed to: * Generate clean HTML/XML with minimal effort * Be simple, to avoid bugs and keep it easy to use, understand, and modify * Take full advantage of Ruby's object sytem * Be more readable and easier to write than bare HTML

It was initially inspired by (and partially modeled on) Markaby, but the implementation is more straightforward so the semantics are cleaner (e.g., no instance_eval, meaning scope inside blocks supplied to tags has no gotcha's).

See doc/LICENSE for the license, doc/examples for examples. See test/ for the tests, and run rake test to execute them. (The tests take a fraction of a second to execute.)

== Installation

You can install via rubygems,

gem install hoshi

or by downloading from github (http://github.com/pete/hoshi).

== Usage

These examples Also, there is a program included called html2hoshi (and associated lib/html2hoshi.rb; see Hoshi.from_html) that takes HTML as input and converts it to Ruby code using Hoshi.

=== Class-based

These should be fairly straightforward:

require 'hoshi'

class Trivial < Hoshi::View :html5 def show doctype html { head { title "Hello, world!" link rel: 'stylesheet', href: '/css/hoshi.css' }

    body {
      h1 "Hello, world!"
      p "This is a greeting to the world."
    }
  }
  render
end

end

puts Trivial.new.show

You can get a little more complicated:

require 'hoshi' require 'cgi'

module Layout def main_page(t) doctype html { head { title t script(type: 'text/javascript') { raw "alert("Hi, I'm some javascript, I suppose.");" } }

    body {
      h1 t, class: 'page_title'

      yield
    }
  }
end

def list_page(t)
  main_page(t) {
    ul {
      yield
    }
  }
end

end

class Fibonacci < Hoshi::View :xhtml1 include Layout

def list_page(n)
  super("Fibonacci: f(0)..f(#{n})") {
    fib_upto(n).map { |i| li i.to_s }
  }
  CGI.pretty(render)
end

private

def fib_upto n
  a = Array.new(n) 
  
  0.upto(n) { |i|
    a[i] = 
      if i < 2
        1
      else
        a[i - 1] + a[i - 2]
      end
  }

  a
end

end

puts Fibonacci.new.list_page(n)

=== Block-based

For simpler cases where you just need to produce a little markup. Useful for small scripts.

require 'hoshi'

str = Hoshi::View::HTML5.build { doctype html { head { title "Hello, world!" link rel: 'stylesheet', href: '/css/hoshi.css' }

  body {
    h1 "Hello, world!"
    p "This is a greeting to the world."
  }
}

}

puts str

== Bugs

There needs to be some work done on correcting the tags; I suspect I'm missing or miscategorizing some of them. If you come across a case where Hoshi emits invalid HTML/XML/etc., please let me know.

That's the only known bug likely to affect you. See doc/TODO for a more detailed roadmap.

== Credits

Author: Pete Elmore, Rekka Labs -- ( pete(a)debu.gs )

The initial design is pretty heavily indebted to: _why the lucky stiff's Markaby library

Simple block version: Nolan Darilek -- (nolan(a)thewordnerd.info)

Friends that have reported bugs: Lars Lethonen, opsangeles -- ( http://opsangeles.com/ ) Hunter, Spore Labs -- ( https://github.com/madhermit )

The guys that paid me to do the initial version: AT&T Interactive. (Now yp.com; they have changed names and owners.)

The company that covers development now: Rekka Labs -- http://rekka.io/ (Yes, you can hire us.)

Also, I guess I should credit Attractive Eighties Women (http://attractiveeightieswomen.com/), since I was blasting them the whole time I was developing this. Like, over and over. I couldn't stop listening.

== Home page

http://debu.gs/hoshi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].