dokuwiki 1.1 → 1.3
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
- data/CHANGELOG.md +8 -0
- data/lib/dokuwiki.rb +18 -13
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbbc62f3ad854a8ce431488a5d2a41c9693c7fa1d072e4413e4be4d79596b45f
|
4
|
+
data.tar.gz: 2e18e0bbbb54312f2c3c0d19ccce3426199994f7395dcbc486d96dbe1670ac0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 319c5f9d2526537add900357a46a3257a75c2d70065caf050569c9d29b04ecef8d87bf10d06524b1f1dc61d4a704cb1a6bd1846a6b5e8531810e0d216845287e
|
7
|
+
data.tar.gz: 8c7f5f37defffe8931d79b66c7e40a046060193c1668271124e175b5775bf849b1477a93655677057c27866eee684781669af34c26bb1918ea577a06f1a0f984
|
data/CHANGELOG.md
CHANGED
data/lib/dokuwiki.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# = dokuwiki.rb
|
4
4
|
#
|
@@ -14,7 +14,6 @@
|
|
14
14
|
require 'rubygems'
|
15
15
|
require 'http-cookie'
|
16
16
|
require 'mechanize'
|
17
|
-
require 'pp'
|
18
17
|
|
19
18
|
# Module for accessing DokuWiki
|
20
19
|
module DokuWiki
|
@@ -27,6 +26,7 @@ module DokuWiki
|
|
27
26
|
# DokuWiki.upload_dir
|
28
27
|
# DokuWiki.wait_second
|
29
28
|
# DokuWiki.namespace( wikipath )
|
29
|
+
# DokuWiki.export_url( wikipath )
|
30
30
|
# DokuWiki.edit_url( wikipath )
|
31
31
|
# DokuWiki.get( url )
|
32
32
|
# DokuWiki.login( wikipath, user, pass )
|
@@ -44,9 +44,9 @@ module DokuWiki
|
|
44
44
|
#
|
45
45
|
class DokuWikiAccess
|
46
46
|
# extension for files in dokuwiki syntax
|
47
|
-
EXTENSION = 'wiki'
|
47
|
+
EXTENSION = 'wiki'
|
48
48
|
# filename for cookie cache
|
49
|
-
COOKIES = 'cookies.txt'
|
49
|
+
COOKIES = 'cookies.txt'
|
50
50
|
|
51
51
|
# directory for media download cache
|
52
52
|
attr_accessor :media_dir
|
@@ -89,6 +89,11 @@ module DokuWiki
|
|
89
89
|
wikipath.gsub( ':', '%3A' ).freeze
|
90
90
|
end
|
91
91
|
|
92
|
+
# make export url
|
93
|
+
def export_url( wikipath )
|
94
|
+
"#{@dokuwiki_page_url}#{wikipath}&do=export_raw"
|
95
|
+
end
|
96
|
+
|
92
97
|
# make edit url
|
93
98
|
def edit_url( wikipath )
|
94
99
|
"#{@dokuwiki_page_url}#{wikipath}&do=edit"
|
@@ -158,11 +163,10 @@ module DokuWiki
|
|
158
163
|
|
159
164
|
# save wiki source to file
|
160
165
|
def save_wiki_source( page, filename )
|
161
|
-
|
162
|
-
wikitext =
|
166
|
+
wikitext = ''
|
167
|
+
wikitext = page.body \
|
168
|
+
if page.header[ 'content-type' ].include?( 'text/plain' )
|
163
169
|
file_put_contents( filename, wikitext )
|
164
|
-
button = f.button_with( name: 'do[draftdel]' )
|
165
|
-
@agent.submit( f, button )
|
166
170
|
end
|
167
171
|
|
168
172
|
# save wiki body to file
|
@@ -185,18 +189,19 @@ module DokuWiki
|
|
185
189
|
# save wiki path to file
|
186
190
|
def save_wiki_path( wikipath )
|
187
191
|
filename = wikipath.split( ':' ).last
|
188
|
-
|
189
|
-
|
192
|
+
extension = filename.split( '.' ).last
|
193
|
+
case extension
|
194
|
+
when 'jpg', 'jpeg', 'png', 'svg', 'pdf', 'csv', 'txt', '.text'
|
190
195
|
url = @dokuwiki_media_url + wikipath
|
191
196
|
save_wiki_media( filename, url )
|
192
|
-
when
|
197
|
+
when 'css'
|
193
198
|
url = @dokuwiki_css_url + wikipath.sub( /[.]css$/, '' )
|
194
199
|
save_wiki_media( filename, url )
|
195
|
-
when
|
200
|
+
when 'html'
|
196
201
|
url = @dokuwiki_page_url + wikipath.sub( /[.]html$/, '' )
|
197
202
|
save_wiki_body( filename, url )
|
198
203
|
else
|
199
|
-
url =
|
204
|
+
url = export_url( wikipath )
|
200
205
|
filename << ".#{EXTENSION}"
|
201
206
|
page = get( url )
|
202
207
|
save_wiki_source( page, filename )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dokuwiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dirk Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-cookie
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
|
-
rubygems_version: 3.
|
85
|
+
rubygems_version: 3.4.19
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: access DokuWiki server
|