mymedia-wiki 0.1.1 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1337add2c5360146f9dbd8cb01138dfae353d0e7c43fd6d7753e2c2e33de1238
4
- data.tar.gz: cd8e59cf8212a7f0dbf35e17b1d591c3da667b5190622c9b114698816acda05b
3
+ metadata.gz: 5bc0c4c39b3155ff566883d1591a7d3b086e25628902e50a9049eecc78e19c83
4
+ data.tar.gz: 42221f01061d15c6fac9d2d82312f3d0038a3cbb7cb8ed9294e5d83e0729d36b
5
5
  SHA512:
6
- metadata.gz: c6aa290f5f8b2e1675dfeec187e4de5f78120c354151226b4f503bd2639b32712c314f0384a4c99de47c28418d42d899cc5294a7f427ca15b570824d56860789
7
- data.tar.gz: 49fbdd7d7917a9d690362abd31884226f60239b7871ed426aab076b3938b0eb1a1312cde6167d5211d5266011c1c19209794cdc5d87993e4f0011b1a53a2fa10
6
+ metadata.gz: fc9584925927356cb9b39c7954c372ecbacf2e23edba6af69710ed9716289bbae06bc3497d5ba53867b4761daf1ec8ab93e709da3da6631cbd37200793dfb48f
7
+ data.tar.gz: d65e82bb025de66e83a72299b751fd7d73e8c5f5349446031892c30f7d626e6e5810da13cd1ba020268d7d588f7480ccc46a46fa2451bd5e4464ba18a39b8609
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-wiki.rb CHANGED
@@ -9,16 +9,17 @@ class MyMediaWikiError < Exception
9
9
  end
10
10
 
11
11
  class MyMediaWiki < MyMediaPages
12
+ include RXFileIOModule
12
13
 
13
14
  def initialize(media_type: media_type='wiki',
14
15
  public_type: @public_type=media_type, ext: '.(html|md|txt)',
15
16
  config: nil, log: nil, debug: false)
16
-
17
+
17
18
  super(media_type: media_type, public_type: @public_type=media_type,
18
19
  ext: '.(html|md|txt)', config: config, log: log, debug: debug)
19
-
20
- end
21
-
20
+
21
+ end
22
+
22
23
  def copy_publish(filename, raw_msg='')
23
24
 
24
25
  @log.info 'MyMediaWiki inside copy_publish' if @log
@@ -27,14 +28,14 @@ class MyMediaWiki < MyMediaPages
27
28
 
28
29
  html_filename = basename(@media_src, src_path).sub(/(?:md|txt)$/,'html')
29
30
 
30
- FileUtils.mkdir_p File.dirname(@home + "/#{@public_type}/" + html_filename)
31
+ FileX.mkdir_p File.dirname(@home + "/#{@public_type}/" + html_filename)
31
32
  #FileUtils.write html, @home + "/#{@public_type}/" + html_filename
32
33
  public_path = "#{@public_type}/" + html_filename
33
34
 
34
35
  ext = File.extname(src_path)
35
36
 
36
37
  raw_destination = "%s/r/%s" % [@home, public_path]
37
- FileUtils.mkdir_p File.dirname(raw_destination)
38
+ FileX.mkdir_p File.dirname(raw_destination)
38
39
  raw_dest_xml = raw_destination.sub(/html$/,'xml')
39
40
 
40
41
  destination = File.join(@home, public_path)
@@ -48,7 +49,7 @@ class MyMediaWiki < MyMediaPages
48
49
  puts '@public_type: ' + @public_type.inspect
49
50
  end
50
51
 
51
- FileUtils.cp src_path, x_destination
52
+ FileX.cp src_path, x_destination
52
53
 
53
54
  source = x_destination[/\/r\/#{@public_type}.*/]
54
55
 
@@ -56,30 +57,53 @@ class MyMediaWiki < MyMediaPages
56
57
  s = @website + source
57
58
  relative_path = s[/https?:\/\/[^\/]+([^$]+)/,1]
58
59
 
59
- src_content = File.read src_path
60
+ src_content = FileX.read src_path
60
61
  doc = xml(src_content, relative_path, filename)
61
62
 
62
63
  return unless doc
63
64
 
64
65
  modify_xml(doc, raw_dest_xml)
65
66
 
67
+ tags = doc.root.xpath('summary/tags/tag/text()')
68
+ raw_msg = "%s %s" % [doc.root.text('summary/title'),
69
+ tags.map {|x| "#%s" % x }.join(' ')]
70
+
66
71
  @log.info 'mymedia-wiki/copy_publish: after modify_xml' if @log
67
72
 
68
- File.write destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl",
73
+ FileX.write destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl",
69
74
  raw_dest_xml)
70
75
 
71
76
  target_url = [@website, @public_type, html_filename].join('/')
72
77
 
78
+ json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
79
+ publish_dxlite(json_filepath, {title: raw_msg, url: target_url})
80
+ =begin
73
81
  msg = "%s %s" % [target_url, raw_msg ]
74
82
  sps_message = ['publish', @public_type,
75
83
  target_url, raw_msg]
76
84
 
77
85
  send_message(msg: sps_message.join(' '))
78
-
86
+ =end
79
87
  [raw_msg, target_url]
80
88
 
81
89
  end
82
-
83
90
 
84
- end
91
+ def writecopy_publish(raws)
92
+
93
+ s = raws.strip.gsub(/\r/,'')
85
94
 
95
+ title = escape(s.lines[0].chomp)
96
+ filename = title + '.txt'
97
+ FileX.write File.join(@media_src, filename), s
98
+
99
+ copy_publish filename
100
+ end
101
+
102
+ private
103
+
104
+ def escape(s)
105
+ s.gsub(/ +/,'_')#.gsub(/'/,'%27')
106
+ end
107
+
108
+
109
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mymedia-wiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,28 +35,28 @@ cert_chain:
35
35
  y9Yuu5WqjuJZ3NtesI/X2BMzO5Pq/vyXzvVcAv1v2VnVoWoodKFBNGzwA+Lgs+aV
36
36
  5FkMbZJFlcCYg1dUZxGwV5OV
37
37
  -----END CERTIFICATE-----
38
- date: 2021-12-13 00:00:00.000000000 Z
38
+ date: 2022-03-06 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: mymedia-pages
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.3'
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.3'
56
+ version: '0.5'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.5.1
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
@@ -83,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.7.10
86
+ rubygems_version: 3.2.22
88
87
  signing_key:
89
88
  specification_version: 4
90
89
  summary: Transforms a kind of Markdown document using Kramdown and XSLT.
metadata.gz.sig CHANGED
Binary file