placemat 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/placemat +3 -0
- data/bin/setup +7 -0
- data/lib/placemat/OptionParser.rb +16 -0
- data/lib/placemat/PlmatToHTML_Converter.rb +25 -0
- data/lib/placemat/version.rb +3 -0
- data/lib/placemat.rb +16 -0
- data/placemat.gemspec +23 -0
- data/samples/test.html +18 -0
- data/samples/test.plmat +18 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5698ae436886a8773163733ec43cd87045c13b78
|
4
|
+
data.tar.gz: 4a0fb502e11f919eeb4c8b417de2ddbf51b4b66c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 21cc4c2f6d289dabe1da1935afb265fd14aa3af15b91fd6d219fac5dcdcbdbd108fad3928e8b1106c251445328ba1ef48eec1b35468ceefd228db2ef721aba95
|
7
|
+
data.tar.gz: 9b2d01d0b85e4b826629249ee404df64112a29c5b098164f17fc34aecd35028d71a292a21891be24d9064b827aad5195ab2329b4f2f80b7f8d272112f2664ae3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 william-index
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Placemat
|
2
|
+
|
3
|
+
Placemat is a robust (maybe?) pre-processing language exclusively for HTML tables. This current version is 100% useless, this is just document setup to get things into version control with git, setup a huboard, and so forge
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
Or install it yourself as:
|
10
|
+
|
11
|
+
$ gem install placemat
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
Currently Placemat will just duplicate the .plmat file it is pointed to with the .html instruction, so... dont use it. :)
|
16
|
+
|
17
|
+
## Development
|
18
|
+
|
19
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
20
|
+
|
21
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/william-index/placemat/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "placemat"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/placemat
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
hash_options = {}
|
2
|
+
OptionParser.new do |opts|
|
3
|
+
opts.banner = "Usage: your_app [options]"
|
4
|
+
opts.on('-c [ARG]', '--compile [ARG]', "Specify a .plmat file to compile") do |plmat|
|
5
|
+
plmat_parser = PlmatToHTML_Converter.new
|
6
|
+
plmat_parser.compile(plmat)
|
7
|
+
end
|
8
|
+
opts.on('--version', 'Display the version') do
|
9
|
+
puts "0.0.0"
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
opts.on('-h', '--help', 'Display this help') do
|
13
|
+
puts opts
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
end.parse!
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# TODO clean up all this formatting and use prooper naming conventions
|
2
|
+
# TODO pass file name to class and then get contents
|
3
|
+
# TODO output file should use same name as the input
|
4
|
+
# Parse order of operations should probably be
|
5
|
+
# remove all comments
|
6
|
+
# pull up tabbed lines
|
7
|
+
# split apart multple tables
|
8
|
+
# * for each table
|
9
|
+
# split into rows
|
10
|
+
# remove trailing whitespace from
|
11
|
+
# split into cells
|
12
|
+
# * for each cell
|
13
|
+
# pull out arguments
|
14
|
+
# remove trailing spaces
|
15
|
+
# apply arguments
|
16
|
+
|
17
|
+
class PlmatToHTML_Converter
|
18
|
+
def compile(plmat)
|
19
|
+
file = File.open(plmat, "rb")
|
20
|
+
contents = file.read
|
21
|
+
generator = FileGenerator.new
|
22
|
+
plmat = plmat.slice(0..(plmat.index('.')-1))
|
23
|
+
generator.output(contents, plmat+".html")
|
24
|
+
end
|
25
|
+
end
|
data/lib/placemat.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "placemat/version"
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
|
5
|
+
class FileGenerator
|
6
|
+
|
7
|
+
def output(contents, filename = "output.html")
|
8
|
+
out_file = File.new(filename, "w")
|
9
|
+
out_file.puts(contents)
|
10
|
+
out_file.close
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
require "placemat/PlmatToHTML_Converter"
|
16
|
+
require "placemat/OptionParser"
|
data/placemat.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'placemat/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "placemat"
|
8
|
+
spec.version = Placemat::VERSION
|
9
|
+
spec.authors = ["William Anderson"]
|
10
|
+
spec.email = ["thewilliamanderson@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Converts placemat markdown files into html tables.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.executables = ["placemat"]
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency 'rspec'
|
23
|
+
end
|
data/samples/test.html
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Customer ID|First Name |Last Name |email ; all rows above a line of pure hyphens (-) are treated as th
|
2
|
+
-------------------------------------------------------------------------- ; Content after a semi-colon on any line should be ignored
|
3
|
+
0001 |William Anderson ::c2 |thewilliamanderson@gmail.com ; ::arguments passes arguments to the cell, c[int] indicates colspan
|
4
|
+
0002 ::r2|John |Doe |johndoe@example.com ; the r[int] argument indicates row span
|
5
|
+
::X|Scrooge |McDuck |scrooge@moneybin.net ; the "X" argument means that the cell should not be rendered (aka, its a placeholder)
|
6
|
+
0003 |William ::.class#id|Anderson |thewilliamanderson@gmail.com ; haml syntax style for class and id appends
|
7
|
+
Multiple commands can be given after each with or without spaces
|
8
|
+
lines starting with a tab are concatenated to the previous line with
|
9
|
+
a space between them
|
10
|
+
::c4&.legal &r2 ; Multiple arguments can be passed with the &, and spaces are removed from the argument block
|
11
|
+
; Any line that starts with a semi-colon should be ignored ; trailing white space should also be removed
|
12
|
+
0004
|
13
|
+
| Donald
|
14
|
+
| Duck
|
15
|
+
| donald.duck@gonavy.gov ::.blue
|
16
|
+
|
17
|
+
; a blank line denotes a new table
|
18
|
+
just one cell here
|
data/samples/test.plmat
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Customer ID|First Name |Last Name |email ; all rows above a line of pure hyphens (-) are treated as th
|
2
|
+
-------------------------------------------------------------------------- ; Content after a semi-colon on any line should be ignored
|
3
|
+
0001 |William Anderson ::c2 |thewilliamanderson@gmail.com ; ::arguments passes arguments to the cell, c[int] indicates colspan
|
4
|
+
0002 ::r2|John |Doe |johndoe@example.com ; the r[int] argument indicates row span
|
5
|
+
::X|Scrooge |McDuck |scrooge@moneybin.net ; the "X" argument means that the cell should not be rendered (aka, its a placeholder)
|
6
|
+
0003 |William ::.class#id|Anderson |thewilliamanderson@gmail.com ; haml syntax style for class and id appends
|
7
|
+
Multiple commands can be given after each with or without spaces
|
8
|
+
lines starting with a tab are concatenated to the previous line with
|
9
|
+
a space between them
|
10
|
+
::c4&.legal &r2 ; Multiple arguments can be passed with the &, and spaces are removed from the argument block
|
11
|
+
; Any line that starts with a semi-colon should be ignored ; trailing white space should also be removed
|
12
|
+
0004
|
13
|
+
| Donald
|
14
|
+
| Duck
|
15
|
+
| donald.duck@gonavy.gov ::.blue
|
16
|
+
|
17
|
+
; a blank line denotes a new table
|
18
|
+
just one cell here
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: placemat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- William Anderson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- thewilliamanderson@gmail.com
|
58
|
+
executables:
|
59
|
+
- placemat
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .travis.yml
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/placemat
|
72
|
+
- bin/setup
|
73
|
+
- lib/placemat.rb
|
74
|
+
- lib/placemat/OptionParser.rb
|
75
|
+
- lib/placemat/PlmatToHTML_Converter.rb
|
76
|
+
- lib/placemat/version.rb
|
77
|
+
- placemat.gemspec
|
78
|
+
- samples/test.html
|
79
|
+
- samples/test.plmat
|
80
|
+
homepage: ''
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.0.14
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Converts placemat markdown files into html tables.
|
104
|
+
test_files: []
|