mymedia_snippets 0.1.0

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: 6a49040050b673123f53d4893e1d83bf58aa5f18
4
+ data.tar.gz: 52406eae7685279729ded542adb75c35c638dfb8
5
+ SHA512:
6
+ metadata.gz: b7369f0087230e096901bfadeb737fad2632986a33c8540e2a12b70709805b33f1cf8e37532c6b4aead9b84bceaf2574d22ff8ed0698a26b3ff5e29916476a7f
7
+ data.tar.gz: d224519a9f46968a7411c6cf3589523e90c1530da41b78a7f855f80c26923f1ff8f448190535731539d57e13b35e2b63417d618c4e399a33590950f738fca74c
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia_snippets.rb
4
+
5
+ require 'coderay'
6
+ require 'mymedia-pages'
7
+
8
+
9
+ class MyMediaSnippets < MyMediaPages
10
+
11
+ def initialize(media_type: 'snippets', config: 'mymedia.conf',
12
+ css_href: '/snippets/coderay_ruby.css', lang: :ruby)
13
+
14
+ super(media_type: media_type, config: config)
15
+
16
+ @css_href = css_href
17
+ @lang = lang
18
+
19
+ end
20
+
21
+ def modify_xml(doc,filepath)
22
+
23
+ super do |doc|
24
+
25
+ r = doc.root.xpath('//pre/code')
26
+
27
+ r.each do |node|
28
+
29
+ parent = node.parent
30
+
31
+ xml = CodeRay.scan(node.text.unescape, @lang).div(:css => :class)
32
+
33
+ doc_code = Rexle.new(xml.sub('code>',"code>\n"))
34
+ parent.insert_before doc_code.root
35
+ parent.delete
36
+ end
37
+
38
+ doc
39
+ end
40
+
41
+ end
42
+
43
+ def add_css_js(xml)
44
+ xml.link({rel: 'stylesheet', type: 'text/css', \
45
+ href: @css_href, media: 'screen, projection, tv'},'')
46
+ end
47
+
48
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia_snippets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MDkxNjA5NDYyOVoXDTE2MDkxNTA5NDYyOVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBALPQP555D/pnMh9uh19Q2OWiBHcgO5qWbeDW/wp+5/YZXQZR2+XpwU7WeAKv
19
+ eflh/44LBVYjCk4mAy/kghQWHZ2C7bvF5/lPlsYarnmUYQp54Pf/3F8q3/Yha2CS
20
+ ZN1Hy5OuD5ctP8STjZBuz+lIGGVg6HGitYou1XLJvi/kQxJV92ryYtJtK+TqgwRm
21
+ CJ8sBo8EiCxfIRaPeYqvmCnMBGazN6TQ8ismN5YpjAZWAYB1ZV+2ZGrrsLAqx8xu
22
+ lDNihy3osE6c03c981U4/JP1H8bxnhGArmWxs8Ui5/22n1JHjyhIYI4R12kpWKiG
23
+ pHoGHv8hBltgBx4ZglhirkDxOwUCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQU7JkbhMUWwr7ZglQJPQHtjM9Sfe0wJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAk2HPe0+b
27
+ N2IPv+ALCTxbyn1TtM8W0e4RbilILdQXsvks46Mhpwqevj/oUz5B650jk6V8gwqA
28
+ 9VZs354xICK3O8rPT/XQegVtoFfINwtbC9nAn9+iTG7yUC7zPw0NTq+NpdlgwRpd
29
+ antlirAI/nuf15Ao48L+rBSFnpkfpbeEAmcHJUQgQaZxHKIHIaNPva21p/E67o4F
30
+ PXniXau/3+KULKxWgFo4jXXAd22ROv5EZMdO2zgw8zisl5kJnbBuf0gQh33K6tPm
31
+ H4ILHeNYSKdukhr07mqrb3uXO2RrBPXayX5yEjWVpell5m36qT1hEnYbMiwoEAzW
32
+ 19aShbv1oedmjA==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-09-16 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: mymedia-pages
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.11
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.11
56
+ - !ruby/object:Gem::Dependency
57
+ name: coderay
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.1'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.1.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.1'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.1.0
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/mymedia_snippets.rb
83
+ homepage: https://github.com/jrobertson/mymedia_snippets
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.4.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: A MyMedia gem for publishing code snippets
107
+ test_files: []
metadata.gz.sig ADDED
Binary file