mymedia-pages 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mymedia-pages.rb +17 -25
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f834ec33b619e8053d6eeb55162ef595fac462be
|
4
|
+
data.tar.gz: 6c6106a093a5de4ba9b95c39567ea2f121c0b5ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01584f4e2e53d549b070db08041501f7ec140f33c23d871fedfbd08de1353bd17ea56a885c83dc13a596e3d1cc59b26cf5835dc8a63d4a8eefb42816b69b4a2c
|
7
|
+
data.tar.gz: 2c942b296afa097b80018ba10e37a9ff273ddbb4e1539c3fd2fbbcb0edb5c386dcdf7ab6b588667d6f3dda47b314f7769922be0efbaa697d6a9aad7f7795ceae
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-pages.rb
CHANGED
@@ -21,16 +21,16 @@ class MyMediaPages < MyMedia::Base
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def copy_publish(filename, raw_msg='')
|
24
|
-
|
24
|
+
|
25
25
|
@filename = filename
|
26
26
|
src_path = File.join(@media_src, filename)
|
27
27
|
|
28
|
-
if File.basename(src_path)[/[
|
28
|
+
if File.basename(src_path)[/[a-z]\d{6}T\d{4}\.(?:html)/] then
|
29
29
|
return file_publish(src_path, raw_msg)
|
30
30
|
end
|
31
31
|
|
32
32
|
file_publish(src_path, raw_msg) do |destination, raw_destination|
|
33
|
-
|
33
|
+
|
34
34
|
ext = File.extname(src_path)
|
35
35
|
|
36
36
|
if ext[/\.(?:md|txt)/] then
|
@@ -48,20 +48,12 @@ class MyMediaPages < MyMedia::Base
|
|
48
48
|
|
49
49
|
doc = xml(File.open(src_path, 'r').read, relative_path, filename)
|
50
50
|
|
51
|
-
|
52
51
|
modify_xml(doc, raw_dest_xml)
|
53
52
|
modify_xml(doc, dest_xml)
|
54
53
|
|
55
|
-
|
54
|
+
File.write raw_destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
|
56
55
|
|
57
|
-
File.write
|
58
|
-
Nokogiri::XSLT(basic_xsl)\
|
59
|
-
.transform(Nokogiri::XML(File.read raw_dest_xml))
|
60
|
-
|
61
|
-
xsl = File.read "#{@home}/#{@www}/xsl/#{@public_type}.xsl"
|
62
|
-
|
63
|
-
File.write destination,
|
64
|
-
Nokogiri::XSLT(xsl).transform(Nokogiri::XML(File.read dest_xml))
|
56
|
+
File.write destination, xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
|
65
57
|
|
66
58
|
html_filename = File.basename(src_path).sub(/(?:md|txt)$/,'html')
|
67
59
|
xml_filename = html_filename.sub(/html$/,'xml')
|
@@ -82,7 +74,7 @@ class MyMediaPages < MyMedia::Base
|
|
82
74
|
raw_msg = File.read(destination)[/<title>([^<]+)<\/title>/,1]
|
83
75
|
end
|
84
76
|
|
85
|
-
if not File.basename(src_path)[/[
|
77
|
+
if not File.basename(src_path)[/[a-z]\d{6}T\d{4}\.(?:html|md|txt)/] then
|
86
78
|
|
87
79
|
FileUtils.cp destination, @home + "/#{@public_type}/" + html_filename
|
88
80
|
|
@@ -94,9 +86,7 @@ class MyMediaPages < MyMedia::Base
|
|
94
86
|
x_filename = @static_html == true ? html_filename : xml_filename
|
95
87
|
target_url = [@website, @public_type, x_filename].join('/')
|
96
88
|
|
97
|
-
publish_dynarex(static_filepath, {title: raw_msg, url: target_url })
|
98
|
-
|
99
|
-
|
89
|
+
publish_dynarex(static_filepath, {title: raw_msg, url: target_url })
|
100
90
|
|
101
91
|
end
|
102
92
|
|
@@ -150,16 +140,14 @@ class MyMediaPages < MyMedia::Base
|
|
150
140
|
|
151
141
|
|
152
142
|
def modify_xml(docx, filepath, xslpath='r/')
|
153
|
-
|
154
|
-
doc = docx.
|
155
|
-
|
143
|
+
|
144
|
+
doc = Rexle.new docx.xml pretty: false
|
156
145
|
raw_msg = microblog_title(doc)
|
157
|
-
|
146
|
+
|
158
147
|
doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') \
|
159
148
|
+ ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
|
160
|
-
|
161
|
-
|
162
|
-
File.write filepath, doc.xml(pretty: true)
|
149
|
+
yield(doc) if block_given?
|
150
|
+
File.write filepath, doc.xml(declaration: true, pretty: false)
|
163
151
|
end
|
164
152
|
|
165
153
|
def xml(raw_buffer, filename, original_file)
|
@@ -208,5 +196,9 @@ class MyMediaPages < MyMedia::Base
|
|
208
196
|
return Rexle.new(a)
|
209
197
|
end
|
210
198
|
|
211
|
-
|
199
|
+
def xsltproc(xslpath, xmlpath)
|
200
|
+
|
201
|
+
Nokogiri::XSLT(File.open(xslpath))\
|
202
|
+
.transform(Nokogiri::XML(File.open(xmlpath))).to_xhtml(indent: 0)
|
203
|
+
end
|
212
204
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymedia-pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
R8qQYTqUH5uyN1gXTamDXNnXrSWNIRgATqBFU0Rk4ia1O2X6/oMnJctbKR+A3n78
|
32
32
|
zZLvJwXE0u524g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-02-
|
34
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mymedia
|
metadata.gz.sig
CHANGED
Binary file
|