mymedia-wiki 0.3.1 → 0.4.0

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: 83e5dff7b2ac21fb8a5fb7569f55de4a22170c945c4880ff6d89f34dae8439f2
4
- data.tar.gz: 39d452802b52c4f0af4eb6eace72b145ca92307b02564972671a95b95d4b64dd
3
+ metadata.gz: 81fac9c285e97ffd22bc008d834ab169c5a124bec8197070f7afde531159cac1
4
+ data.tar.gz: 1c28af4dfe8098e6d0cf321f2ef9f22397b7f93ef8ab467930ae843ae84d5d5f
5
5
  SHA512:
6
- metadata.gz: dffc85b5f0bea3de17e74ed0a9caec120fc14ab3a908ed83a70900bedfdca8f638b6f888198582a779cdcdcd086241e2c92b107d5ad2868f52500e42181d768a
7
- data.tar.gz: 6f6c539845d29ca4e2ab5eb0076c54e79c741c33359b5e0ca3167a9a581a320d73ad584414ce024f7c6ea73ddece8c79bb62c93624e4aa1104bb34a8091f887b
6
+ metadata.gz: fb6fbb12dec7a46d580ee9a1cdc295cc6bd0c2fc11bc7e564ca35ae2eea0b3f90680fe0c3ec2d2694340a7a289f0935cc0296631ca1952790fd8737f48e6d7b6
7
+ data.tar.gz: 6562512cc0dcfd51427bb1b1d293092027dd560c6685cba772bcc388d0ced71335741bea280aea833944dc5e3d89a03e4eab04a1bda47bc93967e0d902cc5fca
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/mymedia-wiki.rb CHANGED
@@ -8,7 +8,7 @@ require 'mymedia-pages'
8
8
  class MyMediaWikiError < Exception
9
9
  end
10
10
 
11
- class MyMediaWiki < MyMediaPages
11
+ class MyMediaWikiBase < MyMediaPages
12
12
  include RXFileIOModule
13
13
 
14
14
  def initialize(media_type: media_type='wiki',
@@ -126,4 +126,52 @@ class MyMediaWiki < MyMediaPages
126
126
  copy_publish filename
127
127
  end
128
128
 
129
+
130
+ end
131
+
132
+ class MyMediaWiki < MyMediaWikiBase
133
+
134
+ def initialize(config: nil, newpg_url: '', log: nil, debug: false)
135
+
136
+ @url4new = newpg_url
137
+ super(config: config, log: log, debug: debug)
138
+ end
139
+
140
+ def writecopy_publish(raws)
141
+
142
+ # The content to be published might contain 1 or more wiki link
143
+ # e.g. [[topic2022]] or [[topic2022url|topic2022
144
+ # Here, the link will be transformed to an actual hyperlink which points
145
+ # to a valid wiki page
146
+
147
+ s = raws.gsub(/\[\[([^\]]+)\]\]/) do |x|
148
+
149
+ puts 'x: ' + x.inspect if @debug
150
+ title = $1
151
+ puts 'searching for title ' + title.inspect if @debug
152
+
153
+ # does the title exist?
154
+ r = find_title(title)
155
+
156
+ puts 'r: ' + r.inspect if @debug
157
+
158
+ if r then
159
+ '<a href="' + '/wiki/' + r.title[/^#{title}/i] + '">' + title +'</a>'
160
+ else
161
+ '<a href="' + url4new + escape(title) + '" class="new" title="' \
162
+ + title + ' (page does not exist)">' + title + '</a>'
163
+ end
164
+
165
+ end
166
+
167
+ super(s)
168
+
169
+ end
170
+
171
+ private
172
+
173
+ def find_title(s)
174
+ find /^#{s} (?=#)/i
175
+ end
176
+
129
177
  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.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  y9Yuu5WqjuJZ3NtesI/X2BMzO5Pq/vyXzvVcAv1v2VnVoWoodKFBNGzwA+Lgs+aV
36
36
  5FkMbZJFlcCYg1dUZxGwV5OV
37
37
  -----END CERTIFICATE-----
38
- date: 2022-03-21 00:00:00.000000000 Z
38
+ date: 2022-04-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: mymedia-pages
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '0.5'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.5.3
49
+ version: 0.5.4
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,7 +56,7 @@ dependencies:
56
56
  version: '0.5'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.5.3
59
+ version: 0.5.4
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
metadata.gz.sig CHANGED
Binary file