linklist 0.0.0a

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ = The MIT License
2
+
3
+ # Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,26 @@
1
+ = Abstract
2
+
3
+ Linklist[http://CodaSet.Com/Joerg-W-Mittag/Link-List/] is just a
4
+ simple script to convert a text file with one URI per line into a
5
+ static HTML page containing links to those URIs.
6
+
7
+ ---
8
+
9
+ = What
10
+
11
+ This program converts a text file with one URI per line into a
12
+ static HTML page containing links to those URIs.
13
+
14
+ = Installation
15
+
16
+ gem install linklist
17
+
18
+ = Usage
19
+
20
+ linklist -i input.txt -o output.html
21
+
22
+ = License
23
+
24
+ Linklist is licensed under the {MIT X11 License}[http://CodaSet.Com/Joerg-W-Mittag/Link-List/source/master/blob/LICENSE.rdoc].
25
+
26
+ :include: LICENSE.rdoc
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ # vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si
3
+
4
+ # Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>
5
+ # This code is licensed under the terms of the MIT License (see LICENSE.rdoc)
6
+
7
+ require 'optparse'
8
+ require 'linklist'
9
+
10
+ module Linklist
11
+ class Main
12
+ def initialize args
13
+ @args = args
14
+ @options = {input: $stdin, output: $stdout}
15
+ @option_parser = OptionParser.new do |opts|
16
+ opts.banner = 'Usage: linklist -t <TITLE> -i <INPUT> -o <OUTPUT>'
17
+ opts.on '-t', '--title [TITLE]', 'Use title instead of "URIs"' do |title|
18
+ @options[:title] = title
19
+ end
20
+ opts.on '-i', '--input [INPUTFILE]', 'Use Filename instead of STDIN' do |file|
21
+ @options[:input] = open file
22
+ end
23
+ opts.on '-o', '--output [OUTPUTFILE]', 'Use Filename instead of STDOUT' do |file|
24
+ @options[:output] = open file, 'w'
25
+ end
26
+ end
27
+ end
28
+
29
+ def run!
30
+ @option_parser.parse! @args
31
+ uris = TextParser.new.parse @options[:input].gets nil
32
+ output = HtmlFormatter.new.format uris, @options[:title]
33
+ @options[:output].puts output
34
+ ensure
35
+ @options[:input].close
36
+ @options[:output].close
37
+ end
38
+
39
+ def self.run!
40
+ new(ARGV).run!
41
+ end
42
+
43
+ run!
44
+ end
45
+ end
@@ -0,0 +1,7 @@
1
+ # vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si
2
+
3
+ # Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>
4
+ # This code is licensed under the terms of the MIT License (see LICENSE.rdoc)
5
+
6
+ require 'linklist/text_parser'
7
+ require 'linklist/html_formatter'
@@ -0,0 +1,39 @@
1
+ # vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si
2
+
3
+ # Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>
4
+ # This code is licensed under the terms of the MIT License (see LICENSE.rdoc)
5
+
6
+ module Linklist
7
+ class HtmlFormatter
8
+ def format(uris = {}, title = 'URIs')
9
+ output = <<-"HERE"
10
+ <!DOCTYPE html>
11
+ <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='de' lang='de'>
12
+ <head>
13
+ <meta http-equiv='Content-type' content='text/html; charset=UTF-8' />
14
+ <title>#{title}</title>
15
+ <meta http-equiv='content-language' content='de' />
16
+ </head>
17
+ <body>
18
+ <section>
19
+ <header>
20
+ <h1>#{title}</h1>
21
+ </header>
22
+ <ul>
23
+ HERE
24
+ uris.each do |title, target|
25
+ output << "\t"*4 << "<li>\n"
26
+ output << "\t"*5 << "<a target='_blank' \n"
27
+ output << "\t"*6 << "href='#{target}'>\n"
28
+ output << "\t"*6 << title << "\n"
29
+ output << "\t"*4 << "</li>\n"
30
+ end
31
+ return output << <<-'HERE'
32
+ </ul>
33
+ </section>
34
+ </body>
35
+ </html>
36
+ HERE
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ # vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si
2
+
3
+ # Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>
4
+ # This code is licensed under the terms of the MIT License (see LICENSE.rdoc)
5
+
6
+ require 'cgi'
7
+ require 'uri'
8
+
9
+ module Linklist
10
+ class TextParser
11
+ def parse(uris_text)
12
+ uris_text.lines.inject({}) { |uris, uri|
13
+ uris[CGI.escapeHTML(uri.chomp)] = URI.escape(uri.chomp)
14
+ uris
15
+ }
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: linklist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0a
5
+ platform: ruby
6
+ authors:
7
+ - "J\xC3\xB6rg W Mittag"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-18 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: jscruggs-metric_fu
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.5
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rdoc
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.4.3
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: reek
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.2.4
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: roodi
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.0.1
54
+ version:
55
+ description: |
56
+ Linklist is just a simple script to convert a text file with one
57
+ URI per line into a static HTML page containing links to those
58
+ URIs.
59
+
60
+ email: JoergWMittag+Link-List@GoogleMail.Com
61
+ executables:
62
+ - linklist
63
+ extensions: []
64
+
65
+ extra_rdoc_files:
66
+ - LICENSE.rdoc
67
+ - README.rdoc
68
+ files:
69
+ - LICENSE.rdoc
70
+ - README.rdoc
71
+ - bin/linklist
72
+ - lib/linklist.rb
73
+ - lib/linklist/html_formatter.rb
74
+ - lib/linklist/text_parser.rb
75
+ has_rdoc: true
76
+ homepage: http://CodaSet.Com/Joerg-W-Mittag/Link-List/
77
+ licenses:
78
+ - MIT X11 License (see LICENSE.rdoc)
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --all
82
+ - --charset=UTF-8
83
+ - --line-numbers
84
+ - --webcvs=http://CodaSet.Com/Joerg-W-Mittag/Link-List/source/master/blob/%s
85
+ - --include='C:/Users/JRGWMI~1/Downloads/repos/link-list'
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ version: 1.9.1
93
+ version:
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.5
99
+ version:
100
+ requirements: []
101
+
102
+ rubyforge_project: Linklist
103
+ rubygems_version: 1.3.5
104
+ signing_key:
105
+ specification_version: 3
106
+ summary: Convert a text file with URIs into static HTML
107
+ test_files: []
108
+