marklar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: da332cbf6ed7738b5a76133618580ae1620593f6
4
+ data.tar.gz: 511eca42414acce6b5a15d1169b16fbedf6cda18
5
+ SHA512:
6
+ metadata.gz: b94b5fbfe648ab045856c825c1cfc939efd3ae8ebfe4240c5e3b22f6ab2f9fe07eb009e69d4539f2910c352e35243c62c7d9a514dd4e3c5f70a1520836b281d1
7
+ data.tar.gz: a075efb4e61235622ea5198f2dfaf872760907813820c5744dacd33ddaf93738bcba5e4294364a43f9fbe823021e62fa1038de95b88c012557f0b536733c8a80
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in marklar.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mike MacDonald
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ Marklar
2
+ ===
3
+
4
+ Marklar is a [Rack](http://github.com/rack/rack)-based minimalist [MarkDown](http://en.wikipedia.org/wiki/Markdown) preview tool.
5
+
6
+ A demonstration is running at [marklar.herokuapp.com](http://marklar.herokuapp.com/).
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ gem install marklar
12
+
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Run `marklar`. It takes any arguments that `rackup` could take.
18
+
19
+ Navigate to the server (default: `localhost:9292`), and enter markdown on the left. It will render on the right.
20
+
21
+ Wipe hands on pants.
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
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 new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/marklar ADDED
@@ -0,0 +1,6 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'rack'
4
+
5
+ Dir.chdir File.dirname(File.realpath(__FILE__))+'/../'
6
+ Rack::Server.start
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ require 'marklar'
2
+
3
+ static = Rack::Static.new nil, urls: ['/assets/'], root: 'lib', index: 'assets/index.html'
4
+ run Rack::Cascade.new [static, Marklar]
@@ -0,0 +1,14 @@
1
+ body,html {
2
+ height: 98%;
3
+ }
4
+
5
+ #input {
6
+ width: 49%;
7
+ height: 100%;
8
+ }
9
+ #output {
10
+ width: 50%;
11
+ height: 100%;
12
+ float: right;
13
+ overflow: auto;
14
+ }
@@ -0,0 +1,37 @@
1
+ (function () {
2
+ 'use strict';
3
+ var input;
4
+
5
+ function markdown() {
6
+ var xhr, postData;
7
+
8
+ xhr = new XMLHttpRequest();
9
+ postData = new FormData();
10
+ postData.append('data', this.value);
11
+ xhr.onload = function () {
12
+ document.getElementById('output').innerHTML = this.responseText;
13
+ };
14
+ xhr.open("POST", '/', true);
15
+ xhr.send(postData);
16
+ }
17
+
18
+ function debounce(func, delay) {
19
+ var timeout;
20
+
21
+ return function () {
22
+ var that = this, args = arguments;
23
+
24
+ clearTimeout(timeout);
25
+ timeout = setTimeout(function () {
26
+ timeout = null;
27
+ func.apply(that, args);
28
+ }, delay);
29
+ };
30
+ }
31
+
32
+ input = document.getElementById('input');
33
+
34
+ input.addEventListener('input', debounce(markdown, 500));
35
+
36
+ markdown.call(input);
37
+ }).call(this);
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel='stylesheet' type='text/css' href='assets/application.css'></link>
5
+ <title>Marklar</title>
6
+ </head>
7
+ <body>
8
+ <textarea id='input'>
9
+ Marklar
10
+ ===
11
+
12
+ Marklar is a [Rack](http://github.com/rack/rack)-based minimalist [MarkDown](http://en.wikipedia.org/wiki/Markdown) preview tool.</textarea>
13
+
14
+ <span id='output'></span>
15
+
16
+ <script src='assets/application.js'></script>
17
+ </body>
18
+ </html>
data/lib/marklar.rb ADDED
@@ -0,0 +1,15 @@
1
+ require "marklar/version"
2
+ require "rack"
3
+ require "redcarpet"
4
+
5
+ module Marklar
6
+
7
+ @markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new, fenced_code_blocks: true)
8
+
9
+ class << self
10
+ def call env
11
+ req = Rack::Request.new(env)
12
+ [200, {'Content-Type' => "text/html" }, [@markdown.render(req[:data].to_s)]] if req.post?
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Marklar
2
+ VERSION = "0.0.1"
3
+ end
data/marklar ADDED
File without changes
data/marklar.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'marklar/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "marklar"
8
+ spec.version = Marklar::VERSION
9
+ spec.authors = ["Mike MacDonald"]
10
+ spec.email = ["crazymykl@gmail.com"]
11
+ spec.description = %q{A minimal Rack app for drafting and previewing Markdown}
12
+ spec.summary = %q{A minimal Rack app for drafting and previewing Markdown}
13
+ spec.homepage = "https://github.com/crazymykl/marklar"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rack"
22
+ spec.add_dependency "redcarpet"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: marklar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mike MacDonald
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: redcarpet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: A minimal Rack app for drafting and previewing Markdown
70
+ email:
71
+ - crazymykl@gmail.com
72
+ executables:
73
+ - marklar
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/marklar
83
+ - config.ru
84
+ - lib/assets/application.css
85
+ - lib/assets/application.js
86
+ - lib/assets/index.html
87
+ - lib/marklar.rb
88
+ - lib/marklar/version.rb
89
+ - marklar
90
+ - marklar.gemspec
91
+ homepage: https://github.com/crazymykl/marklar
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.0.0
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: A minimal Rack app for drafting and previewing Markdown
115
+ test_files: []