mastalk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/mastalk.rb +35 -0
  3. metadata +65 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6a36e22db1b9ffc82ca721924fbe1c3af6025fe
4
+ data.tar.gz: edcb2c18aa95cc3860e2a60058f07faced8e64e9
5
+ SHA512:
6
+ metadata.gz: 8da90de22674f6d2f80ff0912923f3ad7d2b0daa0c29d96909f303cc7c117217d6138189f56cf57f03fbb22071b26a334bc9e21e0397e858397a78391f45026e
7
+ data.tar.gz: 2295ff7113cc326e4a227f4ea5e647bea476e6221b09e4be88817d4920019233172c96d89bfd0f1899f18913447e5762e03724643237fb0d372c0e577c2bcbfe
data/lib/mastalk.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'kramdown'
2
+ require_relative 'mastalk/extensions'
3
+
4
+ module Mastalk
5
+ # Document class to preprocess
6
+ # mastalk specific syntax
7
+ class Document
8
+ include Mastalk::Extensions
9
+
10
+ attr_reader :source
11
+
12
+ def initialize(source)
13
+ @source = source.dup
14
+ end
15
+
16
+ def to_html
17
+ kramdown.to_html
18
+ end
19
+
20
+ private
21
+
22
+ def kramdown
23
+ Kramdown::Document.new(preprocess(source))
24
+ end
25
+
26
+ def preprocess(source)
27
+ extensions.map do |regex, block|
28
+ if source.match(regex)
29
+ source.gsub!(regex, block.call(Regexp.last_match.captures.first))
30
+ end
31
+ end
32
+ source
33
+ end
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mastalk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Douglas Roper
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2010-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: kramdown
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.5.0
33
+ description: Mastalk markdown extension language
34
+ email: dougdroper@gmail.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - lib/mastalk.rb
40
+ homepage: http://rubygems.org/
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 2.2.2
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: mastalk
64
+ test_files: []
65
+ has_rdoc: