tiddlywikiutils 0.1.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -0
- data/lib/tiddlywikiutils.rb +52 -0
- metadata +70 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3db7aa13f2b6c338b83660d7b8bdb56b357fe9dffbbb15048098cfedcf3f9668
|
4
|
+
data.tar.gz: f7e7da4d253607935bde8395a1c87297a648e17a417a50a2aec25538341339fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b188d517b56319ac2d88a703b69609f9dea49c231107ea2c9b28d4c07e8e8c46544572aea0a9f805e91cb8c5cda2c84891dc288ca53aa27ab04314180bc64d1
|
7
|
+
data.tar.gz: 222cb67be717af08bc11275cb558c2ec680526344327b823387453e78662f7c4b21f4fe0b99d95228a14b35b8287170a26e3514004d99c76a73077f0bb5edf3a
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
s��ф��jMr0}���O4LPe]��l/��¦���[C�FJ�S�3��xWn+��.�.^$t@�$�Y���c��������=K~�?�U��s69�V��߸aK��d1�;e�]�1�z���ʶ�Spv)�X~��`���n%�k�=m﹑.�Ǡ����m��6EG�Y�ӣ��k3�~�"��yWrs���/�=5E��h�ɟ f��#����zߨo���d\��*����dP��f���#95L�4���K��2>�^ʀ�ajG˦R�G�D�S��N}������m�~@�\b��bE ���,�y���t��V��lw�aY �$�G�Zu�,��6��گ&�:�B�)��/Jlq�f���~��HA"\/�.�P��V���r�#%
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: tiddlywikiutils.rb
|
4
|
+
|
5
|
+
|
6
|
+
class TiddlyWikiUtils
|
7
|
+
|
8
|
+
attr_reader :tiddlers
|
9
|
+
|
10
|
+
def initialize(filepath=nil, debug: false)
|
11
|
+
|
12
|
+
@debug = debug
|
13
|
+
import_html(filepath) if filepath
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def add(title: '', tags: '', body: '', type: 'text/x-markdown')
|
18
|
+
|
19
|
+
time = Time.now.strftime('%Y%M%d%H%M%S%3N')
|
20
|
+
|
21
|
+
tiddler = "<div created='%s' modified='%s' tags='%s' title='%s' \
|
22
|
+
type='%s'>\n<pre>%s</pre>\n</div>" % \
|
23
|
+
[time, time, tags, title, type, body]
|
24
|
+
|
25
|
+
id = @tiddlers.last[/(?<=created=")\d+/]
|
26
|
+
pos = @s =~ /#{id}/
|
27
|
+
pos2 = @s[pos..-1] =~ /<\/div>/
|
28
|
+
|
29
|
+
puts [id, pos, pos2].inspect if @debug
|
30
|
+
puts 'tiddler: ' + tiddler.inspect if @debug
|
31
|
+
|
32
|
+
@s.insert((pos + pos2 + 6), tiddler)
|
33
|
+
:added
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def import_html(filepath)
|
38
|
+
|
39
|
+
@s = File.read filepath
|
40
|
+
a = @s.split(/.*(?=<div created)/)
|
41
|
+
a.shift
|
42
|
+
a.reject! {|x| x =~ / title="\$/}
|
43
|
+
@tiddlers = a[0..-2]
|
44
|
+
@tiddlers << a.last.split(/<\/div>/,2).first
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_html()
|
49
|
+
@s
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tiddlywikiutils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+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
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEACnIaQIkU2wCEPOjT69PGNOob6HMxOzLHOZRhSo9d
|
29
|
+
gWP04NFBgAlxXBN48qmDlecz47ntj0sHRhJzAqKjwY5L8yw9tnTIRn0vnhwIcrww
|
30
|
+
p0IsTTXKYGTShcVH90oc1k8LjkASQZ15gPRuwrZJpWsjvyrgc5eGnxFxqb2YG9il
|
31
|
+
KWG/qxtu6xgH+2MN8n8Yl/B9RffMVgayYbvL1EUWUsn2sxq0Hpm5AumnetYnBEzz
|
32
|
+
eICA/axCv7HHMmMypOwEg9j434VOY8zFuxlSjhvbNinh2qHmfyf6hCX2oMUhchFg
|
33
|
+
c6yezCwIoFxTKFcTXGDnvk6sNRDIzIwb4JSlQIxZ3k0gBeuyKMjo42oKmAAa0h83
|
34
|
+
9/M3zLuNieayrQMO8Z3hoQFpqvlmLHPYUih4TBzrvnjSteXxME9XMezBnRkjoLQz
|
35
|
+
jK2YCUWy+wykoUFTKgZdPYRutXlEGTg5eQ3XlPc5P7TszyHz8P3dgBIGl12dfNXz
|
36
|
+
V+ryMk43a2Pu3rSh4dwudVqJ
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2020-02-23 00:00:00.000000000 Z
|
39
|
+
dependencies: []
|
40
|
+
description:
|
41
|
+
email: james@jamesrobertson.eu
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- lib/tiddlywikiutils.rb
|
47
|
+
homepage: https://github.com/jrobertson/tiddlywikiutils
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.0.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Parses Tiddlers from a TiddlyWiki HTML file, as well as being to add Tiddlers.
|
70
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|