Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/soveran/hypertext
Hypertext authoring with Ruby
https://github.com/soveran/hypertext
Last synced: 3 months ago
JSON representation
Hypertext authoring with Ruby
- Host: GitHub
- URL: https://github.com/soveran/hypertext
- Owner: soveran
- License: mit
- Created: 2021-03-06T20:24:57.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T21:08:58.000Z (over 3 years ago)
- Last Synced: 2024-07-21T06:23:58.512Z (4 months ago)
- Language: Ruby
- Size: 9.77 KB
- Stars: 12
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING
- License: LICENSE
Awesome Lists containing this project
README
Hypertext
=========Hypertext authoring
Description
-----------Hypertext allows you to write HTML from Ruby.
Usage
-----A basic example would look like this:
```ruby
html = Hypertext.new do |h|
h.tag :div, "data-index-number" => 123, class: "greeting" do
h.tag :h1 do
h.text "hello world"
endh.tag :hr
h.tag :p do
h.text "nice to meet you"
end
end
endputs html.to_s
#
#
# hello world
#
#
#
# nice to meet you
#
#
```DSL
---As an experimental feature, Hypertext provides a DSL for
describing an HTML document in a way that resembles
[Markaby](https://github.com/markaby/markaby).```ruby
require "hypertext"
require "hypertext/dsl"person_name = "Foo Bar"
html = Hypertext::DSL.new do
form action: "/", method: "post" do
input name: "person[name]", value: person_name
input type: "submit"
end
endputs html.to_s
#
#
#
#
```Installation
------------```
$ gem install hypertext
```