mymedia-pages 0.5.1 → 0.5.4
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 +36 -15
- data.tar.gz.sig +0 -0
- 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: c090792550a9c690e5c798257f4e750070236fdcec48c9be467a8fb463aefb83
|
4
|
+
data.tar.gz: 15c98cd42e3fa859737c1529d58e2a240f546e170d635d19c36ba941d4f7a2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1401804769832c5b3e006051fc3df5e8fcf7800845816afe00b86e94fd28cf76fae4ed782e20454fec52274e81595c361a903c753d7594426b0a2690dd15d903
|
7
|
+
data.tar.gz: fc928b7156eaf1ea0a8495efe815d77d7bcbf801c5c2522561c5e1b0cf2b981993fa6a1746ade38921b9e843d906357a4b326954dbc0262868271573db20e75b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-pages.rb
CHANGED
@@ -6,21 +6,34 @@
|
|
6
6
|
require 'mymedia'
|
7
7
|
require 'martile'
|
8
8
|
require 'kramdown'
|
9
|
+
require 'rxfileio'
|
9
10
|
|
10
11
|
|
11
12
|
module PageReader
|
12
|
-
include
|
13
|
+
include RXFRead
|
13
14
|
|
14
15
|
# read the source file
|
15
16
|
#
|
16
|
-
def read(
|
17
|
-
|
17
|
+
def read(raw_filename)
|
18
|
+
|
19
|
+
filename = raw_filename.gsub(/ +/,'_')#.gsub(/'/,'%27')
|
20
|
+
FileX.read File.join(@media_src, filename)
|
21
|
+
|
18
22
|
end
|
19
23
|
|
20
24
|
# view the published file
|
21
25
|
#
|
22
|
-
def view(
|
23
|
-
|
26
|
+
def view(s)
|
27
|
+
|
28
|
+
filepath = if s.count('/') > 1 then
|
29
|
+
# archived file
|
30
|
+
File.join(@home, @www, @public_type, s + '.html')
|
31
|
+
else
|
32
|
+
# static file
|
33
|
+
File.join(@home, @public_type, s)
|
34
|
+
end
|
35
|
+
|
36
|
+
FileX.read(filepath)
|
24
37
|
end
|
25
38
|
|
26
39
|
end
|
@@ -29,7 +42,6 @@ class MyMediaPagesError < Exception
|
|
29
42
|
end
|
30
43
|
|
31
44
|
class MyMediaPages < MyMedia::Base
|
32
|
-
include RXFHelperModule
|
33
45
|
include MyMedia::IndexReader
|
34
46
|
include PageReader
|
35
47
|
|
@@ -50,7 +62,7 @@ class MyMediaPages < MyMedia::Base
|
|
50
62
|
|
51
63
|
@log.info 'MyMediaPagesinside copy_publish' if @log
|
52
64
|
@filename = filename
|
53
|
-
src_path = File.join(
|
65
|
+
src_path = File.join(filename)
|
54
66
|
|
55
67
|
if File.basename(src_path)[/[a-z]\d{6}T\d{4}\.(?:html)/] then
|
56
68
|
return file_publish(src_path, raw_msg)
|
@@ -66,7 +78,7 @@ class MyMediaPages < MyMedia::Base
|
|
66
78
|
dest_xml = destination.sub(/html$/,'xml')
|
67
79
|
x_destination = raw_destination.sub(/\.html$/,ext)
|
68
80
|
|
69
|
-
|
81
|
+
puts "src: %s dest: %s" % [src_path, x_destination] if @debug
|
70
82
|
FileX.cp src_path, x_destination
|
71
83
|
|
72
84
|
source = x_destination[/\/r\/#{@public_type}.*/]
|
@@ -84,13 +96,13 @@ class MyMediaPages < MyMedia::Base
|
|
84
96
|
@log.info 'mymedia_pages/copy_publish: after modify_xml' if @log
|
85
97
|
|
86
98
|
FileX.write raw_destination,
|
87
|
-
xsltproc(
|
88
|
-
|
99
|
+
xsltproc(File.join(@home, 'r', 'xsl', @public_type + '.xsl'),
|
100
|
+
raw_dest_xml)
|
89
101
|
FileX.write destination,
|
90
|
-
xsltproc(
|
102
|
+
xsltproc(File.join(@home, @www, 'xsl', @public_type + '.xsl'),
|
103
|
+
dest_xml)
|
91
104
|
|
92
|
-
html_filename = basename(@media_src, src_path)
|
93
|
-
.sub(/(?:md|txt)$/,'html')
|
105
|
+
html_filename = basename(@media_src, src_path).sub(/(?:md|txt)$/,'html')
|
94
106
|
|
95
107
|
|
96
108
|
xml_filename = html_filename.sub(/html$/,'xml')
|
@@ -114,7 +126,7 @@ class MyMediaPages < MyMedia::Base
|
|
114
126
|
|
115
127
|
else
|
116
128
|
|
117
|
-
html_filename = basename(
|
129
|
+
html_filename = basename(src_path)
|
118
130
|
|
119
131
|
if html_filename =~ /\// then
|
120
132
|
FileX.mkdir_p File.dirname(html_filename)
|
@@ -145,6 +157,7 @@ class MyMediaPages < MyMedia::Base
|
|
145
157
|
'before publish_dynarex'
|
146
158
|
end
|
147
159
|
|
160
|
+
target_url.sub!(/\.html$/,'') if @omit_html_ext
|
148
161
|
publish_dynarex(static_filepath, {title: raw_msg, url: target_url })
|
149
162
|
|
150
163
|
end
|
@@ -198,6 +211,10 @@ class MyMediaPages < MyMedia::Base
|
|
198
211
|
|
199
212
|
def modify_xml(docx, filepath, xslpath='r/')
|
200
213
|
|
214
|
+
if @debug then
|
215
|
+
'mymedia_pages: inside modify_xml: docx.xml: ' + docx.xml.inspect
|
216
|
+
end
|
217
|
+
|
201
218
|
if @log then
|
202
219
|
@log.info 'mymedia_pages: inside modify_xml: docx.xml: ' + docx.xml.inspect
|
203
220
|
end
|
@@ -256,7 +273,7 @@ class MyMediaPages < MyMedia::Base
|
|
256
273
|
xml.access access if access
|
257
274
|
xml.source_url filename
|
258
275
|
xml.source_file File.basename(filename)
|
259
|
-
xml.original_file original_file
|
276
|
+
xml.original_file File.basename(original_file)
|
260
277
|
xml.published Time.now.strftime("%d-%m-%Y %H:%M")
|
261
278
|
xml.filetitle original_file[/.*(?=\.\w+$)/]
|
262
279
|
end
|
@@ -274,6 +291,10 @@ class MyMediaPages < MyMedia::Base
|
|
274
291
|
|
275
292
|
def xsltproc(xslpath, xmlpath)
|
276
293
|
|
294
|
+
if not FileX.exists? xslpath then
|
295
|
+
raise MyMediaPagesError, 'Missing file - ' + xslpath
|
296
|
+
end
|
297
|
+
|
277
298
|
Nokogiri::XSLT(FileX.read(xslpath))\
|
278
299
|
.transform(Nokogiri::XML(FileX.read(xmlpath))).to_xhtml(indent: 0)
|
279
300
|
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.5.
|
4
|
+
version: 0.5.4
|
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-21 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.5.0
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
46
|
version: '0.5'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.5.2
|
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.5.0
|
57
54
|
- - "~>"
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0.5'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.5.2
|
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
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: '2.3'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.3.
|
89
|
+
version: 2.3.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: '2.3'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 2.3.
|
99
|
+
version: 2.3.2
|
100
100
|
description:
|
101
101
|
email: digital.robertson@gmail.com
|
102
102
|
executables: []
|
@@ -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
|