https://github.com/sixarm/sixarm_ruby_html
SixArm.com » Unix » HTML helpers for layouts, lists, tables, etc.
https://github.com/sixarm/sixarm_ruby_html
extensions gem html ruby
Last synced: 4 months ago
JSON representation
SixArm.com » Unix » HTML helpers for layouts, lists, tables, etc.
- Host: GitHub
- URL: https://github.com/sixarm/sixarm_ruby_html
- Owner: SixArm
- License: other
- Created: 2010-05-25T18:23:40.000Z (about 16 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T09:19:03.000Z (about 1 year ago)
- Last Synced: 2025-04-14T10:29:42.387Z (about 1 year ago)
- Topics: extensions, gem, html, ruby
- Language: Ruby
- Homepage: http://sixarm.com
- Size: 391 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# SixArm.com → Ruby →
HTML utility methods to generate lists, tables, etc.
* Doc:
* Gem:
* Repo:
## Introduction
HTML utility methods to generate well-formed HTML for tables, lists, etc.
This is typically to render Ruby objects, such as arrays, as HTML output.
For docs go to
Want to help? We're happy to get pull requests.
## Install
### Gem
To install this gem in your shell or terminal:
gem install sixarm_ruby_html
### Gemfile
To add this gem to your Gemfile:
gem 'sixarm_ruby_html'
### Require
To require the gem in your code:
require 'sixarm_ruby_html'
## Table Methods
* table - Builds an HTML table from the supplied parameters: string CSS: ID, Class; array of strings: Headers, Footers; array of array of string: Rows
* tables - Builds one or more HTML tables from a supplied array of arrays (each sub-array holding the params specified for the table method)
* thead - Builds the thead section of a table from an array of strings
* th - Returns a TH table cell
* ths - Returns a string of TH table cells
* tbody - Builds the tbody section of a table from an array of arrays of strings (each sub-array becomes a table row)
* tr - Returns a TR table row
* trs - Returns a string of TR table rows
* td - Returns a TD table cell
* tds - Returns a string of TD table cells
* tfoot - Builds the tfoot section of a table from an array of strings
## Table Examples
headers = ['a','b','c']
footers = ['x','y','z']
rows=[['d','e,'f']]
table(:id=>'foo', :class=>'bar', :headers=>headers, :footers=>footers, :rows=>rows)
=>
a
b
c
d
e
f
x
y
z
## List Methods
* ul - Builds an HTML unordered list from an array of strings or Enumerables
* uls - Builds one or more HTML unordered lists from an array of arrays of strings or Enumerables (sub-arrays can be a mix of both)
* li - Returns an LI item
* lis - Returns a string of LI items
## List Examples
ul(['a','b','c']) =>
- a
- b
- c
uls(['a','b','c'],['d','e','f'],[1,2,3]) =>
- a
- b
- c
- d
- e
- f
- 1
- 2
- 3
## Misc Methods
* comment - Return the text parameter wrapped in an HTML comment
* wrap - Return the text parameter wrapped in a tag pair
## Misc Examples
comment('the following comes from') =>
wrap('foo', 'bar') =>
foo