mymedia-pages 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: a11ed7245662312bd00c2819dcbfdca0d9f7b988
4
- data.tar.gz: 67d1a34083a0940f4724df2888cdde16c8e60d3a
3
+ metadata.gz: 89f8c997b5dd0bde2f3a98b90f40329891888113
4
+ data.tar.gz: 6a8956160a8416c3781873e02f747b3a686c9b5c
5
5
  SHA512:
6
- metadata.gz: 2523bd19e79fd919921f51c30ee5739b327baa313d73157d10ae777435847980c28493e9c6647e91ccf174481a84b41be79ea4565572fa9b82c7717f8af34c0f
7
- data.tar.gz: a99dadae12940d2e4c4bb41716666590230727644c5098a0ea67281e7e893ced5fce84ca55f16fb9f1b2416acaa8ff457769f92e287643ba3e47f3ebbfec478e
6
+ metadata.gz: 14cd28b7ef656821c45d27e7a01079250a6a1490b8e1d2aff3f8e8b4b36c0df9ceaac3cd37d3c410bf807b72c04eeccb265628b7fbc990fa360111ccafbb2d37
7
+ data.tar.gz: 6fa0988c11cc2e2547ae0b4a137e674a56b0fb1a67067f3d3921af997cc39f2d9cd6374d171a52d37f0f18136630cb8bcb2b6f7a3196c159892db2354d3af9a6
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-pages.rb CHANGED
@@ -13,6 +13,7 @@ class MyMediaPages < MyMedia::Base
13
13
  super(media_type: 'pages', public_type: @public_type='pages', ext: '.(html|md|txt)', config: config)
14
14
  @media_src = "%s/media/pages" % @home
15
15
  @target_ext = '.html'
16
+ @static_html = true
16
17
 
17
18
  end
18
19
 
@@ -34,17 +35,21 @@ class MyMediaPages < MyMedia::Base
34
35
 
35
36
  if ext[/\.(?:md|txt)/] then
36
37
 
37
- raw_dest_xml = raw_destination.sub(/html$/,'xml')
38
- x_destination = raw_destination.sub(/html$/,ext)
38
+ raw_dest_xml = raw_destination.sub(/html$/,'xml')
39
+ dest_xml = destination.sub(/html$/,'xml')
40
+ x_destination = raw_destination.sub(/\.html$/,ext)
41
+
39
42
  FileUtils.cp src_path, x_destination
40
43
 
41
44
  source = x_destination[/\/r\/#{@public_type}.*/]
42
45
  s = @website + source
46
+
43
47
  relative_path = s[/https?:\/\/[^\/]+([^$]+)/,1]
44
48
 
45
49
  doc = xml(File.open(src_path, 'r').read, relative_path, filename)
46
50
 
47
51
  modify_xml(doc, raw_dest_xml)
52
+ modify_xml(doc, dest_xml,'')
48
53
 
49
54
  basic_xsl = File.read "#{@home}/r/xsl/#{@public_type}.xsl"
50
55
 
@@ -55,7 +60,7 @@ class MyMediaPages < MyMedia::Base
55
60
  xsl = File.read "#{@home}/#{@www}/xsl/#{@public_type}.xsl"
56
61
 
57
62
  File.write destination,
58
- Nokogiri::XSLT(xsl).transform(Nokogiri::XML(File.read raw_dest_xml))
63
+ Nokogiri::XSLT(xsl).transform(Nokogiri::XML(File.read dest_xml))
59
64
 
60
65
  else
61
66
  FileUtils.cp src_path, destination
@@ -65,13 +70,19 @@ class MyMediaPages < MyMedia::Base
65
70
  if not File.basename(src_path)[/[pw]\d{6}T\d{4}\.(?:html|md|txt)/] then
66
71
 
67
72
  html_filename = File.basename(src_path).sub(/(?:md|txt)$/,'html')
73
+ xml_filename = html_filename.sub(/html$/,'xml')
68
74
 
69
75
  FileUtils.cp destination, @home + "/#{@public_type}/" + html_filename
76
+ FileUtils.cp dest_xml, @home + "/#{@public_type}/" + xml_filename
77
+
78
+ static_filepath = @home + "/#{@public_type}/static.xml"
70
79
 
71
- html_filepath = @home + "/#{@public_type}/static.xml"
72
- target_url = [@website, @public_type, html_filename].join('/')
80
+ x_filename = @static_html == true ? html_filename : xml_filename
81
+
82
+
83
+ target_url = [@website, @public_type, x_filename].join('/')
73
84
 
74
- publish_dynarex(html_filepath, {title: html_filename, url: target_url })
85
+ publish_dynarex(static_filepath, {title: x_filename, url: target_url })
75
86
 
76
87
  tags = doc.root.xpath('summary/tags/tag/text()')
77
88
 
@@ -128,10 +139,11 @@ class MyMediaPages < MyMedia::Base
128
139
  end
129
140
 
130
141
 
131
- def modify_xml(doc, filepath)
142
+ def modify_xml(docx, filepath, xslpath='r/')
132
143
 
144
+ doc = docx.clone
133
145
  raw_msg = microblog_title(doc)
134
- doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') + ["href='#{@website}/r/xsl/#{@public_type}.xsl'"]
146
+ doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') + ["href='#{@website}/#{xslpath}xsl/#{@public_type}.xsl'"]
135
147
  doc = yield(doc) if block_given?
136
148
  File.write filepath, doc.xml(pretty: true)
137
149
  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.2
4
+ version: 0.1.3
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: 2014-10-12 00:00:00.000000000 Z
34
+ date: 2014-10-13 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mymedia-blogbase
metadata.gz.sig CHANGED
Binary file