mymedia-pages 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f1212494cddb465a2992c38cf493903ca6228e9e0852d358953207de7cc2c27
4
- data.tar.gz: b19b7b29329da34d44863aa1025d6206c4ecc684beb264b2085101ccdeb828e6
3
+ metadata.gz: c090792550a9c690e5c798257f4e750070236fdcec48c9be467a8fb463aefb83
4
+ data.tar.gz: 15c98cd42e3fa859737c1529d58e2a240f546e170d635d19c36ba941d4f7a2f0
5
5
  SHA512:
6
- metadata.gz: 9404f5def759be60fd1ea4f75c9d37f117065cc4a7ba1adf041d1dce78c61296b64655f36c9553616fd5039eabaadbe63f3870cb1cbae7e0a81c3ff151ced51a
7
- data.tar.gz: 849e0bdc4d0d70909d33a486910609574a324913d997b7bb7d341d6958af1f8e6539948f307d507abb845362223f4ab78927f4b59acf6a2f1cc444d26ee7ad45
6
+ metadata.gz: 1401804769832c5b3e006051fc3df5e8fcf7800845816afe00b86e94fd28cf76fae4ed782e20454fec52274e81595c361a903c753d7594426b0a2690dd15d903
7
+ data.tar.gz: fc928b7156eaf1ea0a8495efe815d77d7bcbf801c5c2522561c5e1b0cf2b981993fa6a1746ade38921b9e843d906357a4b326954dbc0262868271573db20e75b
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-pages.rb CHANGED
@@ -14,14 +14,26 @@ module PageReader
14
14
 
15
15
  # read the source file
16
16
  #
17
- def read(filename)
18
- FileX.read File.join(@media_src, escape(filename))
17
+ def read(raw_filename)
18
+
19
+ filename = raw_filename.gsub(/ +/,'_')#.gsub(/'/,'%27')
20
+ FileX.read File.join(@media_src, filename)
21
+
19
22
  end
20
23
 
21
24
  # view the published file
22
25
  #
23
- def view(filename)
24
- FileX.read File.join(@home, @public_type, filename)
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)
25
37
  end
26
38
 
27
39
  end
@@ -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(@media_src, filename)
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("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
88
-
99
+ xsltproc(File.join(@home, 'r', 'xsl', @public_type + '.xsl'),
100
+ raw_dest_xml)
89
101
  FileX.write destination,
90
- xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
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(@media_src, src_path)
129
+ html_filename = basename(src_path)
118
130
 
119
131
  if html_filename =~ /\// then
120
132
  FileX.mkdir_p File.dirname(html_filename)
@@ -199,6 +211,10 @@ class MyMediaPages < MyMedia::Base
199
211
 
200
212
  def modify_xml(docx, filepath, xslpath='r/')
201
213
 
214
+ if @debug then
215
+ 'mymedia_pages: inside modify_xml: docx.xml: ' + docx.xml.inspect
216
+ end
217
+
202
218
  if @log then
203
219
  @log.info 'mymedia_pages: inside modify_xml: docx.xml: ' + docx.xml.inspect
204
220
  end
@@ -257,7 +273,7 @@ class MyMediaPages < MyMedia::Base
257
273
  xml.access access if access
258
274
  xml.source_url filename
259
275
  xml.source_file File.basename(filename)
260
- xml.original_file original_file
276
+ xml.original_file File.basename(original_file)
261
277
  xml.published Time.now.strftime("%d-%m-%Y %H:%M")
262
278
  xml.filetitle original_file[/.*(?=\.\w+$)/]
263
279
  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.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  jSG8iFV4kJofCyHyfW6zyZy0d22o23Syxam2rIESaal2RPL7gADDTc8XBe/sFeWr
36
36
  A7Ido2/5qg5YDVloSOHTfzZj
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-19 00:00:00.000000000 Z
38
+ date: 2022-03-21 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: mymedia
metadata.gz.sig CHANGED
Binary file