mymedia-pages 0.4.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mymedia-pages.rb +35 -22
- data.tar.gz.sig +1 -2
- metadata +17 -18
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0207dc7910117c8f75b7cd43fa8bfd135c4307e717a0fb58ceadfdf33c6c64d7
|
4
|
+
data.tar.gz: c723f97a07d4b524ff04433153a0d8974863f77960828fe3eb1a6cb36dbfbb06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 976f130bd9311dd2b2c58306f925741ac1647feee540304d2b30980269ee028e25049dff2e350186bd6e222169ac04f8e2592137bfef05dd1b0b2f3f917890f8
|
7
|
+
data.tar.gz: 8fd25e04e36bbb4da21e6b63bc12e880b09fcca664e2a8b4fbe8ac3d4d909b41f20365969bdf2f12db6c7161c4ee48d068065126296c4cf3bc9a22d3a01060ea
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-pages.rb
CHANGED
@@ -6,20 +6,22 @@
|
|
6
6
|
require 'mymedia'
|
7
7
|
require 'martile'
|
8
8
|
require 'kramdown'
|
9
|
+
require 'rxfileio'
|
9
10
|
|
10
11
|
|
11
12
|
module PageReader
|
13
|
+
include RXFRead
|
12
14
|
|
13
15
|
# read the source file
|
14
16
|
#
|
15
17
|
def read(filename)
|
16
|
-
|
18
|
+
FileX.read File.join(@media_src, escape(filename))
|
17
19
|
end
|
18
20
|
|
19
21
|
# view the published file
|
20
22
|
#
|
21
23
|
def view(filename)
|
22
|
-
|
24
|
+
FileX.read File.join(@home, @public_type, filename)
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
@@ -65,13 +67,13 @@ class MyMediaPages < MyMedia::Base
|
|
65
67
|
x_destination = raw_destination.sub(/\.html$/,ext)
|
66
68
|
|
67
69
|
|
68
|
-
|
70
|
+
FileX.cp src_path, x_destination
|
69
71
|
|
70
72
|
source = x_destination[/\/r\/#{@public_type}.*/]
|
71
73
|
s = @website + source
|
72
74
|
|
73
75
|
relative_path = s[/https?:\/\/[^\/]+([^$]+)/,1]
|
74
|
-
src_content =
|
76
|
+
src_content = FileX.read src_path
|
75
77
|
doc = xml(src_content, relative_path, filename)
|
76
78
|
|
77
79
|
return unless doc
|
@@ -81,27 +83,33 @@ class MyMediaPages < MyMedia::Base
|
|
81
83
|
|
82
84
|
@log.info 'mymedia_pages/copy_publish: after modify_xml' if @log
|
83
85
|
|
84
|
-
|
86
|
+
FileX.write raw_destination,
|
87
|
+
xsltproc("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
|
85
88
|
|
86
|
-
|
89
|
+
FileX.write destination,
|
90
|
+
xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
|
87
91
|
|
88
|
-
html_filename = basename(@media_src, src_path)
|
92
|
+
html_filename = basename(@media_src, src_path)\
|
93
|
+
.sub(/(?:md|txt)$/,'html')
|
89
94
|
|
90
95
|
|
91
96
|
xml_filename = html_filename.sub(/html$/,'xml')
|
92
97
|
|
93
|
-
|
94
|
-
|
98
|
+
FileX.mkdir_p File.dirname(File.join(File.dirname(destination),
|
99
|
+
html_filename))
|
100
|
+
FileX.cp destination, File.join(File.dirname(destination),
|
101
|
+
html_filename)
|
95
102
|
|
96
|
-
|
97
|
-
|
103
|
+
FileX.mkdir_p File.dirname( File.join(File.dirname(dest_xml),
|
104
|
+
xml_filename))
|
105
|
+
FileX.cp dest_xml, File.join(File.dirname(dest_xml), xml_filename)
|
98
106
|
|
99
107
|
tags = doc.root.xpath('summary/tags/tag/text()')
|
100
108
|
raw_msg = "%s %s" % [doc.root.text('summary/title'),
|
101
109
|
tags.map {|x| "#%s" % x }.join(' ')]
|
102
110
|
|
103
111
|
|
104
|
-
@log.info "msg: %s tags: %s" % [raw_msg, tags.inspect]if @log
|
112
|
+
@log.info "msg: %s tags: %s" % [raw_msg, tags.inspect] if @log
|
105
113
|
|
106
114
|
|
107
115
|
else
|
@@ -109,20 +117,20 @@ class MyMediaPages < MyMedia::Base
|
|
109
117
|
html_filename = basename(@media_src, src_path)
|
110
118
|
|
111
119
|
if html_filename =~ /\// then
|
112
|
-
|
120
|
+
FileX.mkdir_p File.dirname(html_filename)
|
113
121
|
end
|
114
122
|
|
115
|
-
|
116
|
-
|
123
|
+
FileX.cp src_path, destination
|
124
|
+
FileX.cp src_path, raw_destination
|
117
125
|
|
118
|
-
raw_msg =
|
126
|
+
raw_msg = FileX.read(destination)[/<title>([^<]+)<\/title>/,1]
|
119
127
|
end
|
120
128
|
|
121
129
|
if not File.basename(src_path)[/[a-z]\d{6}T\d{4}\.(?:html|md|txt)/] then
|
122
130
|
|
123
131
|
@log.info 'MyMediaPages::copy_publish before FileUtils' if @log
|
124
|
-
|
125
|
-
|
132
|
+
FileX.mkdir_p File.dirname(@home + "/#{@public_type}/" + html_filename)
|
133
|
+
FileX.cp destination, @home + "/#{@public_type}/" + html_filename
|
126
134
|
|
127
135
|
if xml_filename then
|
128
136
|
FileUtils.cp dest_xml, @home + "/#{@public_type}/" + xml_filename
|
@@ -206,7 +214,7 @@ class MyMediaPages < MyMedia::Base
|
|
206
214
|
+ ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
|
207
215
|
|
208
216
|
yield(doc) if block_given?
|
209
|
-
|
217
|
+
FileX.write filepath, doc.xml(declaration: true, pretty: false)
|
210
218
|
end
|
211
219
|
|
212
220
|
def xml(raw_buffer, filename, original_file)
|
@@ -225,7 +233,8 @@ class MyMediaPages < MyMedia::Base
|
|
225
233
|
|
226
234
|
new_link = x.text.gsub(/\s/,'_')
|
227
235
|
|
228
|
-
x.attributes[:href] = "#{@dynamic_website}/do/#{@public_type}/new/"
|
236
|
+
x.attributes[:href] = "#{@dynamic_website}/do/#{@public_type}/new/" \
|
237
|
+
+ new_link
|
229
238
|
x.attributes[:class] = 'new'
|
230
239
|
x.attributes[:title] = x.text + ' (page does not exist)'
|
231
240
|
end
|
@@ -265,7 +274,11 @@ class MyMediaPages < MyMedia::Base
|
|
265
274
|
|
266
275
|
def xsltproc(xslpath, xmlpath)
|
267
276
|
|
268
|
-
|
269
|
-
|
277
|
+
if not FileX.exists? xslpath then
|
278
|
+
raise MyMediaPagesError, 'Missing file - ' + xslpath
|
279
|
+
end
|
280
|
+
|
281
|
+
Nokogiri::XSLT(FileX.read(xslpath))\
|
282
|
+
.transform(Nokogiri::XML(FileX.read(xmlpath))).to_xhtml(indent: 0)
|
270
283
|
end
|
271
284
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
�
|
2
|
-
� ��'C>2�u�؎Q��Zb�h�xMc�[{+�l��mo"/b�q�l��x�qkG��L� y�ށk�
|
1
|
+
6����3]8GmQ�dMjO6�H����:�~���?sDA�*m�y__f�2.��G���ެ�P4���j|��5��h�O�c����4�{5�}�s�z�?(�]��X�G!("~N>#���΅>�#Jz՞Hx������\V�r'�y��l����D�d�s���8�����l�d������jlv�;vD�[�%�7i����h�ꧽ?�6n�sc?R�s�*)ߘ#�״Ã<9x�9 �f�N��(Wӝ�ܓ�����ޗ;꺮su��Z���رy�#�Y��IE�ehe�s�f��"5�']���()�U��LJ�+O=$��}CAeΠ�\ܸlL9uY}o>s��ml�i7ةL��>&9�a��-�cm�8"��9?
|
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.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,48 +35,48 @@ cert_chain:
|
|
35
35
|
jSG8iFV4kJofCyHyfW6zyZy0d22o23Syxam2rIESaal2RPL7gADDTc8XBe/sFeWr
|
36
36
|
A7Ido2/5qg5YDVloSOHTfzZj
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: mymedia
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.3.0
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
46
|
+
version: '0.5'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.5.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.3.0
|
57
54
|
- - "~>"
|
58
55
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
56
|
+
version: '0.5'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.5.1
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: martile
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.5.0
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
66
|
version: '1.5'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.5.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 1.5.0
|
77
74
|
- - "~>"
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: '1.5'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.5.0
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: kramdown
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
127
|
-
rubygems_version: 2.7.10
|
126
|
+
rubygems_version: 3.2.22
|
128
127
|
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: A MyMedia gem to publish a basic web page
|
metadata.gz.sig
CHANGED
Binary file
|