Graphiclious 0.1.0 → 0.1.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.
- data/README.txt +1 -0
- data/doc/extern.gif +0 -0
- data/doc/index.html +42 -9
- data/doc/screenshots/original/{cornflower.html → 01-blue-style-1.html} +5 -5
- data/doc/screenshots/original/{blue-style-1.jpg → 01-blue-style-1.jpg} +0 -0
- data/doc/screenshots/original/{blue-style-1.html → 02-cornflower.html} +5 -5
- data/doc/screenshots/original/{cornflower.jpg → 02-cornflower.jpg} +0 -0
- data/doc/screenshots/original/{sample-graph.html → 03-sample-graph.html} +5 -5
- data/doc/screenshots/original/{sample-graph.jpg → 03-sample-graph.jpg} +0 -0
- data/doc/screenshots/original/04-basic-style-js.html +37 -0
- data/doc/screenshots/original/04-basic-style-js.jpg +0 -0
- data/doc/screenshots/original/05-custom-style.html +37 -0
- data/doc/screenshots/original/05-custom-style.jpg +0 -0
- data/doc/screenshots/original/06-custom-style-js.html +37 -0
- data/doc/screenshots/original/06-custom-style-js.jpg +0 -0
- data/doc/screenshots/original/07-user-interface.html +37 -0
- data/doc/screenshots/original/07-user-interface.jpg +0 -0
- data/doc/screenshots/original/{custom-style.html → 08-ftp-upload.html} +5 -5
- data/doc/screenshots/original/08-ftp-upload.jpg +0 -0
- data/doc/screenshots/thumb.html +22 -10
- data/doc/screenshots/thumb/{t_blue-style-1.jpg → t_01-blue-style-1.jpg} +0 -0
- data/doc/screenshots/thumb/{t_cornflower.jpg → t_02-cornflower.jpg} +0 -0
- data/doc/screenshots/thumb/{t_sample-graph.jpg → t_03-sample-graph.jpg} +0 -0
- data/doc/screenshots/thumb/t_04-basic-style-js.jpg +0 -0
- data/doc/screenshots/thumb/t_05-custom-style.jpg +0 -0
- data/doc/screenshots/thumb/t_06-custom-style-js.jpg +0 -0
- data/doc/screenshots/thumb/t_07-user-interface.jpg +0 -0
- data/doc/screenshots/thumb/t_08-ftp-upload.jpg +0 -0
- data/doc/style.css +7 -4
- data/javascript/cloud.js +236 -0
- data/javascript/index.htm +24 -0
- data/javascript/link.js +25 -0
- data/javascript/style.css +52 -0
- data/lib/graphiclious.rb +6 -1
- data/lib/graphiclious/delicious2yaml.rb +75 -16
- data/lib/graphiclious/environment.rb +14 -1
- data/lib/graphiclious/ftp_browser.rb +53 -0
- data/lib/graphiclious/gui.rb +78 -24
- data/lib/graphiclious/help.rb +1 -0
- data/lib/graphiclious/version.rb +1 -1
- data/lib/graphiclious/yaml-links2html.rb +79 -64
- data/lib/graphiclious/yaml-links2js.rb +159 -0
- metadata +36 -19
- data/doc/screenshots/original/custom-style.jpg +0 -0
- data/doc/screenshots/original/user-interface.html +0 -37
- data/doc/screenshots/original/user-interface.jpg +0 -0
- data/doc/screenshots/thumb/t_custom-style.jpg +0 -0
- data/doc/screenshots/thumb/t_user-interface.jpg +0 -0
@@ -23,14 +23,27 @@ begin
|
|
23
23
|
# Try to find lib directory of this specific Graphiclious gem version
|
24
24
|
def findGraphicliousDirectory
|
25
25
|
graphicliousGemDir = "Graphiclious-#{Graphiclious.version}"
|
26
|
+
puts "Gempath: " + Gem::path.to_s
|
26
27
|
all = Gem::path.collect { |gempath|
|
27
28
|
File.join(gempath, 'gems', graphicliousGemDir)
|
28
29
|
}.select { |f|
|
29
30
|
File.directory?(f)
|
30
31
|
}
|
31
|
-
all.
|
32
|
+
return all.first unless all.empty?
|
33
|
+
puts "Checking $LOAD_PATH"
|
34
|
+
$LOAD_PATH.each do
|
35
|
+
|d|
|
36
|
+
if /graphiclious.lib$/ =~ d
|
37
|
+
return d[0..-5].gsub(/\\/, '/');
|
38
|
+
end
|
39
|
+
end
|
40
|
+
return '.'
|
32
41
|
end
|
33
42
|
GRAPHICLIOUS_PATH = findGraphicliousDirectory
|
34
43
|
rescue LoadError
|
35
44
|
GRAPHICLIOUS_PATH = '.'
|
36
45
|
end
|
46
|
+
puts "Set GRAPHICLIOUS_PATH to : #{GRAPHICLIOUS_PATH}"
|
47
|
+
|
48
|
+
STYLES_FOLDER = File.join(GRAPHICLIOUS_PATH, "styles")
|
49
|
+
JS_TEMPLATES_FOLDER = File.join(GRAPHICLIOUS_PATH, "javascript")
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
## $Id: ftp_browser.rb 73 2004-12-17 16:22:13Z Sascha $
|
3
|
+
|
4
|
+
require 'piggy-core/options'
|
5
|
+
require 'piggy-gui/ftp_browser_widget'
|
6
|
+
|
7
|
+
class FtpBrowserApi
|
8
|
+
def initialize(options_file, subdir)
|
9
|
+
@options_file = options_file
|
10
|
+
@options = load_options
|
11
|
+
@options.localDestinationPath = File.join(File.dirname(@options_file), subdir)
|
12
|
+
@options.ftpConnectionTimeout = 600 unless @options.ftpConnectionTimeout > 600
|
13
|
+
@options.ftpTransferTimeout = 2000 unless @options.ftpTransferTimeout > 2000
|
14
|
+
end
|
15
|
+
|
16
|
+
def run main_win
|
17
|
+
uploadDialog = FtpBrowserDialog.new(main_win, @options)
|
18
|
+
uploadDialog.execute
|
19
|
+
save_options
|
20
|
+
end
|
21
|
+
|
22
|
+
def load_options
|
23
|
+
return PiggyOptions.new unless File.exists?(@options_file)
|
24
|
+
begin
|
25
|
+
config = File.open(@options_file) { |io| YAML.load(io) }
|
26
|
+
if config.class == Array
|
27
|
+
options = config.detect{ |entry| entry.class == PiggyOptions }
|
28
|
+
else
|
29
|
+
options = config
|
30
|
+
end
|
31
|
+
options.initializeNilsWithDefault
|
32
|
+
rescue StandardError => ex
|
33
|
+
puts('Configuration error, options.yaml ignored: ' + ex.message)
|
34
|
+
options = PiggyOptions.new
|
35
|
+
end
|
36
|
+
return options
|
37
|
+
end
|
38
|
+
|
39
|
+
def save_options
|
40
|
+
begin
|
41
|
+
if File.exists?(@options_file)
|
42
|
+
File.rename(@options_file, "#{@options_file}.bak")
|
43
|
+
end
|
44
|
+
File.open(@options_file, 'w') { |out|
|
45
|
+
YAML.dump(@options, out)
|
46
|
+
}
|
47
|
+
puts "Options saved to #{@options_file}"
|
48
|
+
rescue StandardError => ex
|
49
|
+
puts "Options could not be saved to #{@options_file}: " + ex.message
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
data/lib/graphiclious/gui.rb
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
require 'graphiclious/require_fox'
|
5
5
|
require 'graphiclious/delicious2yaml'
|
6
|
-
require 'graphiclious/yaml-links2html'
|
6
|
+
require 'graphiclious/yaml-links2html'
|
7
|
+
require 'graphiclious/yaml-links2js'
|
7
8
|
|
8
9
|
class GraphicliousMainWindow < Fox::FXMainWindow
|
9
10
|
include Fox
|
@@ -16,6 +17,13 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
16
17
|
@style = style
|
17
18
|
@stylesFolder = YamlLinksToHtml::STYLES_FOLDER
|
18
19
|
@workingDir = Dir.getwd
|
20
|
+
@is_ftp_enabled = false
|
21
|
+
begin
|
22
|
+
require 'graphiclious/ftp_browser'
|
23
|
+
@is_ftp_enabled = true
|
24
|
+
rescue LoadError => bang
|
25
|
+
puts("Ftp browser not installed: " + bang + "\n-\n")
|
26
|
+
end
|
19
27
|
initView
|
20
28
|
updateUserList
|
21
29
|
updateStylesList
|
@@ -63,8 +71,8 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
63
71
|
wdFrame.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
64
72
|
noPaddingForFrame(wdFrame)
|
65
73
|
@workingDirTextField = FXTextField.new(wdFrame,
|
66
|
-
|
67
|
-
|
74
|
+
32, nil, 0,
|
75
|
+
TEXTFIELD_NORMAL)
|
68
76
|
@workingDirTextField.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
69
77
|
@workingDirTextField.setText(@workingDir)
|
70
78
|
wdChooseButton = newButton(wdFrame, '..')
|
@@ -72,24 +80,24 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
72
80
|
|
73
81
|
FXLabel.new(userAndPasswordFrame, "Enter User:")
|
74
82
|
@userTextField = newCombobox(userAndPasswordFrame, 32,
|
75
|
-
|
76
|
-
|
83
|
+
10.size,
|
84
|
+
nil, 0, COMBOBOX_INSERT_LAST)
|
77
85
|
@userTextField.setFrameStyle(FRAME_SUNKEN|FRAME_THICK)
|
78
86
|
@userTextField.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
79
87
|
|
80
88
|
# input password
|
81
89
|
FXLabel.new(userAndPasswordFrame, "Password:")
|
82
90
|
@passwordTextField = FXTextField.new(userAndPasswordFrame,
|
83
|
-
|
84
|
-
|
91
|
+
32, nil, 0,
|
92
|
+
TEXTFIELD_NORMAL|TEXTFIELD_PASSWD)
|
85
93
|
@passwordTextField.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
86
94
|
@passwordTextField.setText(@password) if @password
|
87
95
|
|
88
96
|
# input style
|
89
97
|
FXLabel.new(userAndPasswordFrame, "Style:")
|
90
98
|
@styleTextField = newCombobox(userAndPasswordFrame, 32,
|
91
|
-
|
92
|
-
|
99
|
+
10,
|
100
|
+
nil, 0, COMBOBOX_INSERT_LAST)
|
93
101
|
@styleTextField.setFrameStyle(FRAME_SUNKEN|FRAME_THICK)
|
94
102
|
@styleTextField.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
95
103
|
|
@@ -104,8 +112,8 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
104
112
|
fetchFrame.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
105
113
|
|
106
114
|
@fetchMode = newCombobox(fetchFrame, 10,
|
107
|
-
|
108
|
-
|
115
|
+
Delicious2Yaml::MODES.size,
|
116
|
+
nil, 0, COMBOBOX_STATIC)
|
109
117
|
@fetchMode.setFrameStyle(FRAME_SUNKEN|FRAME_THICK)
|
110
118
|
modeKeys = Delicious2Yaml::MODES.keys.sort {|m1, m2| m1.to_s <=> m2.to_s}
|
111
119
|
modeKeys.each { |m| @fetchMode.appendItem(Delicious2Yaml::MODES[m]) }
|
@@ -117,6 +125,7 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
117
125
|
noPaddingForFrame(generateFrame)
|
118
126
|
generateFrame.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
119
127
|
|
128
|
+
@checkDiff = newCheckBox(generateFrame, 'restrict to difference')
|
120
129
|
@checkDelicious = newCheckBox(generateFrame, 'Link to del.icio.us')
|
121
130
|
@checkBundles = newCheckBox(generateFrame, 'Include bundles')
|
122
131
|
@checkGraphViews = newCheckBox(generateFrame, 'Include graph views')
|
@@ -129,16 +138,24 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
129
138
|
@checkIncludePrivate.setCheck(false)
|
130
139
|
@checkReallyIncludePrivate.setCheck(false)
|
131
140
|
|
141
|
+
@checkJs = newCheckBox(generateFrame, 'javascript')
|
142
|
+
@checkJs.setCheck(false)
|
143
|
+
@checkJs.connect(SEL_COMMAND, method(:onCheckJs))
|
144
|
+
|
132
145
|
# buttons
|
133
146
|
buttonFrame = newFrame(FXHorizontalFrame.new(basicFrame))
|
134
147
|
buttonFrame.setPackingHints(PACK_UNIFORM_WIDTH)
|
135
148
|
okButton = newButton(buttonFrame, 'Ok')
|
136
149
|
okButton.connect(SEL_COMMAND, method(:onCmdOk))
|
150
|
+
if @is_ftp_enabled
|
151
|
+
ftpButton = newButton(buttonFrame, 'Upload')
|
152
|
+
ftpButton.connect(SEL_COMMAND, method(:onUpload))
|
153
|
+
end
|
137
154
|
cancelButton = newButton(buttonFrame, 'Cancel')
|
138
155
|
cancelButton.connect(SEL_COMMAND, method(:onCmdQuit))
|
139
156
|
|
140
157
|
@cmdOutput = FXText.new(basicFrame, nil, 0,
|
141
|
-
|
158
|
+
TEXT_READONLY|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
|
142
159
|
@cmdOutput.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
143
160
|
end
|
144
161
|
|
@@ -150,6 +167,10 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
150
167
|
@checkGenerate.setCheck(bool ? true : false)
|
151
168
|
end
|
152
169
|
|
170
|
+
def setOptionCheckDiff(bool)
|
171
|
+
@checkDiff.setCheck(bool ? true : false)
|
172
|
+
end
|
173
|
+
|
153
174
|
def setOptionDelicious(bool)
|
154
175
|
@checkDelicious.setCheck(bool ? true : false)
|
155
176
|
end
|
@@ -166,6 +187,10 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
166
187
|
@checkGraphThumbs.setCheck(bool ? true : false)
|
167
188
|
end
|
168
189
|
|
190
|
+
def setOptionJavasript(bool)
|
191
|
+
@checkJs.setCheck(bool ? true : false)
|
192
|
+
end
|
193
|
+
|
169
194
|
def create
|
170
195
|
resize(340, 400)
|
171
196
|
place(PLACEMENT_SCREEN)
|
@@ -184,7 +209,6 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
184
209
|
|userDir|
|
185
210
|
File.basename(userDir)
|
186
211
|
}
|
187
|
-
@userTextField
|
188
212
|
cachedUsers.each { |m| @userTextField.appendItem(m) }
|
189
213
|
@userTextField.setText(@user ? @user : cachedUsers.first)
|
190
214
|
end
|
@@ -232,17 +256,27 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
232
256
|
end
|
233
257
|
if @checkGenerate.checked?
|
234
258
|
appendText("-Start generation-\n")
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
259
|
+
if @checkJs.checked?
|
260
|
+
jsExporter = YamlLinksToJavascript.new
|
261
|
+
jsExporter.set_protocol_block(outputBlock)
|
262
|
+
jsExporter.set_working_dir(File.join(@workingDir, @user))
|
263
|
+
jsExporter.write_only_diff_tags = @checkDiff.checked?
|
264
|
+
jsExporter.include_private = @checkIncludePrivate.checked? && @checkReallyIncludePrivate.checked?
|
265
|
+
jsExporter.run
|
266
|
+
else
|
267
|
+
exporter = YamlLinksToHtml.new
|
268
|
+
exporter.set_protocol_block(outputBlock)
|
269
|
+
exporter.set_working_dir(@workingDir)
|
270
|
+
exporter.set_user(@user)
|
271
|
+
exporter.set_style(@style)
|
272
|
+
exporter.link_to_delicious_if_possible = @checkDelicious.checked?
|
273
|
+
exporter.use_bundles = @checkBundles.checked?
|
274
|
+
exporter.build_graph_thumbs = @checkGraphThumbs.checked?
|
275
|
+
exporter.include_graph_views = @checkGraphViews.checked?
|
276
|
+
exporter.write_only_diff_tags = @checkDiff.checked?
|
277
|
+
exporter.include_private = @checkIncludePrivate.checked? && @checkReallyIncludePrivate.checked?
|
278
|
+
exporter.run
|
279
|
+
end
|
246
280
|
appendText("-Done generation-\n")
|
247
281
|
end
|
248
282
|
appendText("-Done-\n")
|
@@ -254,6 +288,26 @@ class GraphicliousMainWindow < Fox::FXMainWindow
|
|
254
288
|
|
255
289
|
end
|
256
290
|
|
291
|
+
def onCheckJs(sender, sel, ptr)
|
292
|
+
dependent_checks = [
|
293
|
+
@checkBundles,
|
294
|
+
@checkDiff,
|
295
|
+
@checkDelicious,
|
296
|
+
@checkGraphThumbs,
|
297
|
+
@checkGraphViews]
|
298
|
+
if @checkJs.checked?
|
299
|
+
dependent_checks.each{ |c| c.disable }
|
300
|
+
else
|
301
|
+
dependent_checks.each{ |c| c.enable }
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
def onUpload(sender, sel, ptr)
|
306
|
+
return unless @is_ftp_enabled
|
307
|
+
option_file = File.join(@workingDir, @user, 'ftp.yaml')
|
308
|
+
FtpBrowserApi.new(option_file, @checkJs.checked? ? 'js' : 'html').run(self)
|
309
|
+
end
|
310
|
+
|
257
311
|
def onCmdQuit(sender, sel, ptr)
|
258
312
|
getApp.exit(0)
|
259
313
|
end
|
data/lib/graphiclious/help.rb
CHANGED
@@ -10,6 +10,7 @@ module Graphiclious
|
|
10
10
|
"--delicious/-d prefer links to del.icio.us\n" <<
|
11
11
|
"--gui/-g will start a graphical user interface\n" <<
|
12
12
|
"--help/-h will display this text\n" <<
|
13
|
+
"--nomap/-m do not include image map with graph-view" <<
|
13
14
|
"--noupdate/-l do not connect to del.icio.us\n" <<
|
14
15
|
"--nohtml/-o ommit html generation\n" <<
|
15
16
|
"--password/-p specify password for given user\n" <<
|
data/lib/graphiclious/version.rb
CHANGED
@@ -8,11 +8,10 @@ require 'graphiclious/url_graph'
|
|
8
8
|
|
9
9
|
class YamlLinksToHtml
|
10
10
|
DEL_ICIO_US_URL = "http://del.icio.us"
|
11
|
-
STYLES_FOLDER = File.join(GRAPHICLIOUS_PATH, "styles")
|
12
11
|
MAX_STYLES_IN_CLOUD = 10
|
13
12
|
CLOUD_STYLES = (1..MAX_STYLES_IN_CLOUD).collect{ |size| 'cloud-' + size.to_s }
|
14
13
|
|
15
|
-
attr_accessor(:link_to_delicious_if_possible, :use_bundles, :include_graph_views, :build_graph_thumbs, :include_private)
|
14
|
+
attr_accessor(:write_only_diff_tags, :link_to_delicious_if_possible, :use_bundles, :include_graph_views, :build_graph_thumbs, :include_private)
|
16
15
|
|
17
16
|
# Lazy require things which some users won't use
|
18
17
|
def check_prerequisites
|
@@ -45,6 +44,7 @@ class YamlLinksToHtml
|
|
45
44
|
def set_user(user)
|
46
45
|
@user = user
|
47
46
|
@input_file = File.join(@working_dir, @user, 'delicious.yaml')
|
47
|
+
@diff_file = File.join(@working_dir, @user, 'delicious.diff.yaml')
|
48
48
|
@html_output_path = File.join(@working_dir, @user, 'html')
|
49
49
|
@bundles_file = File.join(@working_dir, @user, 'bundles.yaml')
|
50
50
|
end
|
@@ -56,6 +56,8 @@ class YamlLinksToHtml
|
|
56
56
|
|
57
57
|
def initialize
|
58
58
|
@include_private = false
|
59
|
+
@write_only_diff_tags = true
|
60
|
+
@diff_tags = Set.new
|
59
61
|
@working_dir = Dir.getwd
|
60
62
|
set_style(YamlLinksToHtml.guess_styles[0])
|
61
63
|
set_user(YamlLinksToHtml.guess_users_within(@working_dir)[0])
|
@@ -98,7 +100,7 @@ class YamlLinksToHtml
|
|
98
100
|
end
|
99
101
|
|
100
102
|
def downscale(val)
|
101
|
-
|
103
|
+
(2 * Math.log(val)).round
|
102
104
|
end
|
103
105
|
|
104
106
|
def get_cloud_style(val, maxval)
|
@@ -232,6 +234,14 @@ class YamlLinksToHtml
|
|
232
234
|
end
|
233
235
|
|
234
236
|
def load_links
|
237
|
+
if(@write_only_diff_tags)
|
238
|
+
@diff_tags = Set.new
|
239
|
+
diff = File.open(@diff_file, 'r') { |io| YAML.load(io) }
|
240
|
+
diff.keys.each { |k|
|
241
|
+
diff[k]['tags'].each {|t| @diff_tags.add(t) }
|
242
|
+
}
|
243
|
+
end
|
244
|
+
|
235
245
|
# load yaml-file containing links as a hash
|
236
246
|
cache = File.open(@input_file, 'r') { |io|
|
237
247
|
YAML.load(io)
|
@@ -244,9 +254,10 @@ class YamlLinksToHtml
|
|
244
254
|
@links_by_edge = Hash.new
|
245
255
|
links.each do
|
246
256
|
|link|
|
247
|
-
tagsOfLink = link['tags']
|
257
|
+
tagsOfLink = link['tags'].reject { |t| t =~ /^for:/ }
|
258
|
+
link['tags'] = tagsOfLink
|
248
259
|
n = tagsOfLink.size - 1
|
249
|
-
|
260
|
+
(0..n).each do
|
250
261
|
|i|
|
251
262
|
tag = tagsOfLink[i]
|
252
263
|
unless @links_by_tag.has_key?(tag)
|
@@ -254,7 +265,7 @@ class YamlLinksToHtml
|
|
254
265
|
@tag_graph.add_vertex(tag)
|
255
266
|
end
|
256
267
|
@links_by_tag[tag].push(link)
|
257
|
-
|
268
|
+
(i+1..n).each do
|
258
269
|
|j|
|
259
270
|
otherTag = tagsOfLink[j]
|
260
271
|
# write_line_on_protokol "\t#{tag}<->#{otherTag}"
|
@@ -370,41 +381,43 @@ class YamlLinksToHtml
|
|
370
381
|
def write_single_tag_files
|
371
382
|
@links_by_tag.keys.sort.each do
|
372
383
|
|tag|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
list = @links_by_tag[tag].select { |l| l['tags'].size == 1 }
|
390
|
-
unless list.empty?
|
391
|
-
fp.puts("<h3>Links with the single tag #{tag}</h3>")
|
392
|
-
fp.puts('<ul>')
|
393
|
-
sorted_links(list).each do
|
394
|
-
|link|
|
395
|
-
fp.puts('<li>')
|
396
|
-
write_link_on(link, fp, [tag])
|
397
|
-
fp.puts('</li>')
|
384
|
+
if !@write_only_diff_tags or @diff_tags.include?(tag)
|
385
|
+
File.open(File.join(@html_output_path, UrlGraph.node_url(tag)), 'w') do
|
386
|
+
|fp|
|
387
|
+
write_html_head_on(fp)
|
388
|
+
fp.puts "<h1>Tag: #{tag}</h1>"
|
389
|
+
link_index_on(fp, 'none', @bundles)
|
390
|
+
fp.puts '<div class="main">'
|
391
|
+
fp.puts "<h3>Subcategories for tag #{tag}</h3>"
|
392
|
+
subcloud = @tag_graph.adjacent_vertices(tag).sort
|
393
|
+
max_num_links = subcloud.collect{ |n| @links_by_edge[UrlGraph.edge_name(tag, n)].size }.max
|
394
|
+
subcloud.each do
|
395
|
+
|neighbor|
|
396
|
+
edge_name = UrlGraph.edge_name(tag, neighbor)
|
397
|
+
edgePage = UrlGraph.edge_url(tag, neighbor)
|
398
|
+
style = get_cloud_style(@links_by_edge[edge_name].size, max_num_links)
|
399
|
+
fp.puts(UrlGraph.intern_ankor(UrlGraph.edge_url(tag, neighbor), neighbor, style))
|
398
400
|
end
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
401
|
+
list = @links_by_tag[tag].select { |l| l['tags'].size == 1 }
|
402
|
+
unless list.empty?
|
403
|
+
fp.puts("<h3>Links with the single tag #{tag}</h3>")
|
404
|
+
fp.puts('<ul>')
|
405
|
+
sorted_links(list).each do
|
406
|
+
|link|
|
407
|
+
fp.puts('<li>')
|
408
|
+
write_link_on(link, fp, [tag])
|
409
|
+
fp.puts('</li>')
|
410
|
+
end
|
411
|
+
fp.puts('</ul>')
|
412
|
+
end
|
413
|
+
if @link_to_delicious_if_possible
|
414
|
+
fp.puts("<h3>#{UrlGraph.ankor(DEL_ICIO_US_URL, 'del.icio.us')} links with tag #{tag}</h3>")
|
415
|
+
fp.puts(UrlGraph.ankor(delicious_user_url(tag), "#{@user}"))
|
416
|
+
fp.puts(UrlGraph.ankor(delicious_tag_url(tag), "all"))
|
417
|
+
end
|
418
|
+
fp.puts '</div>'
|
419
|
+
write_html_tail_on(fp)
|
405
420
|
end
|
406
|
-
fp.puts '</div>'
|
407
|
-
write_html_tail_on(fp)
|
408
421
|
end
|
409
422
|
end
|
410
423
|
write_line_on_protokol "Wrote one html-file for each tag to directory #{@html_output_path}."
|
@@ -414,32 +427,34 @@ class YamlLinksToHtml
|
|
414
427
|
# Create one Html-File for each edge between two tags
|
415
428
|
@tag_graph.each_edge do
|
416
429
|
|tag1,tag2|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
430
|
+
if !@write_only_diff_tags or (@diff_tags.include?(tag1) and @diff_tags.include?(tag2))
|
431
|
+
edge_name = UrlGraph.edge_name(tag1, tag2)
|
432
|
+
edge_url = UrlGraph.edge_url(tag1, tag2)
|
433
|
+
File.open(File.join(@html_output_path, edge_url), 'w') do
|
434
|
+
|fp|
|
435
|
+
write_html_head_on(fp)
|
436
|
+
fp.puts "<h1>Tags: #{tag1} AND #{tag2}</h1>"
|
437
|
+
link_index_on(fp, 'none', @bundles)
|
438
|
+
fp.puts '<div class="main">'
|
439
|
+
ankor1 = UrlGraph.node_ankor(tag1)
|
440
|
+
ankor2 = UrlGraph.node_ankor(tag2)
|
441
|
+
fp.puts "<h3>Links for tag combination #{ankor1}/#{ankor2}</h3>"
|
442
|
+
fp.puts '<ul>'
|
443
|
+
sorted_links(@links_by_edge[edge_name]).each do
|
444
|
+
|link|
|
445
|
+
fp.puts('<li>')
|
446
|
+
write_link_on(link, fp, [tag1, tag2])
|
447
|
+
fp.puts('<br></li>')
|
448
|
+
end
|
449
|
+
fp.puts '</ul>'
|
450
|
+
if @link_to_delicious_if_possible
|
451
|
+
fp.puts("<h3>#{UrlGraph.ankor(DEL_ICIO_US_URL, 'del.icio.us')} links with tag combination #{ankor1}/#{ankor2}</h3>")
|
452
|
+
fp.puts(UrlGraph.ankor(delicious_user_url(tag1, tag2), @user))
|
453
|
+
fp.puts(UrlGraph.ankor(delicious_tag_url(tag1, tag2), 'all'))
|
454
|
+
end
|
455
|
+
fp.puts '</div>'
|
456
|
+
write_html_tail_on(fp)
|
440
457
|
end
|
441
|
-
fp.puts '</div>'
|
442
|
-
write_html_tail_on(fp)
|
443
458
|
end
|
444
459
|
end
|
445
460
|
write_line_on_protokol "Wrote one html-file for each combination of two tags to directory #{@html_output_path}."
|