Pimki 1.4.092 → 1.5.092

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/pimki.rb CHANGED
@@ -9,76 +9,17 @@ end
9
9
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "libraries")
10
10
  begin
11
11
  require 'rubygems'
12
- require 'madeleine'
13
- require 'redcloth'
14
- require 'bluecloth'
12
+ require_gem 'madeleine'
13
+ require_gem 'BlueCloth'
15
14
  require_gem 'rubyzip'
16
15
  require 'zip/zip'
17
16
 
18
17
  rescue LoadError => detail
19
18
  # no rubygems, so load from the libraries directory
20
19
  p detail
21
- require 'redcloth'
22
20
  require 'bluecloth'
23
21
  require 'zip/zip'
24
22
  end
25
-
26
- ### RedCloth Modifications:
27
- # Remove the "caps" spanning:
28
- RedCloth::GLYPHS.delete_if { |glyph| glyph[1] =~ /class=\"caps\"/ }
29
- # Fix missing hard_break
30
- if RedCloth::VERSION == '3.0.0'
31
- class RedCloth #{{{
32
- def to_html( *rules )
33
- rules = @rules if rules.empty?
34
- # make our working copy
35
- text = self.dup
36
-
37
- @urlrefs = {}
38
- @shelf = []
39
- textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
40
- :block_textile_prefix, :inline_textile_image, :inline_textile_link,
41
- :inline_textile_code, :inline_textile_span, :inline_textile_glyphs]
42
- markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
43
- :block_markdown_bq, :block_markdown_lists,
44
- :inline_markdown_reflink, :inline_markdown_link]
45
- @rules = rules.collect do |rule|
46
- case rule
47
- when :markdown
48
- markdown_rules
49
- when :textile
50
- textile_rules
51
- else
52
- rule
53
- end
54
- end.flatten
55
-
56
- # standard clean up
57
- incoming_entities text
58
- clean_white_space text
59
-
60
- # start processor
61
- pre_list = rip_offtags text
62
- refs text
63
- blocks text
64
- inline text
65
- smooth_offtags text, pre_list
66
-
67
- retrieve text
68
- hard_break text # PIMKI: this is the missing bit!
69
-
70
- text.gsub!( /<\/?notextile>/, '' )
71
- text.gsub!( /x%x%/, '&#38;' )
72
- text.strip!
73
- text
74
- end
75
- end #}}}
76
- else
77
- # Redcloth v3.0.0 can handle markdown, so BlueCloth is only required if we
78
- # have an earlier redcloth version.
79
- require 'BlueCloth'
80
- end
81
-
82
23
  # }}}
83
24
 
84
25
  # Handle command-line options: {{{
@@ -105,7 +46,8 @@ OPTIONS = {
105
46
  :server_type => fork_available ? Daemon : SimpleServer,
106
47
  :port => 2500,
107
48
  :storage => "#{Dir.pwd}/storage",
108
- :pdflatex => pdflatex_available
49
+ :pdflatex => pdflatex_available,
50
+ :redcloth => '2.0.11'
109
51
  }
110
52
 
111
53
  ARGV.options do |opts|
@@ -116,13 +58,18 @@ ARGV.options do |opts|
116
58
 
117
59
  opts.on("-p", "--port=port", Integer,
118
60
  "Runs Instiki on the specified port.",
119
- "Default: 2500") { |OPTIONS[:port]| }
61
+ "Default: 2500\n") { |OPTIONS[:port]| }
120
62
  opts.on("-s", "--simple", "--simple-server",
121
- "Forces Instiki not to run as a Daemon if fork is available."
63
+ "Forces Instiki not to run as a Daemon if fork is available.\n"
122
64
  ) { OPTIONS[:server_type] = SimpleServer }
123
65
  opts.on("-t", "--storage=storage", String,
124
66
  "Makes Instiki use the specified directory for storage.",
125
- "Default: [cwd]/storage/[port]") { |OPTIONS[:storage]| }
67
+ "Default: [cwd]/storage/[port]\n") { |OPTIONS[:storage]| }
68
+ opts.on("-r", "--redcloth VERSION", Integer,
69
+ "Makes Instiki use the specified RedCloth version.",
70
+ "You can specify major version only (2 or 3)",
71
+ "Default: 2.0.11\n") { |OPTIONS[:redcloth]| }
72
+
126
73
 
127
74
  opts.separator ""
128
75
 
@@ -135,6 +82,73 @@ end
135
82
  Socket.do_not_reverse_lookup = true
136
83
  #}}}
137
84
 
85
+ # RedCloth + Modifications: {{{
86
+ begin
87
+ require_gem 'RedCloth', "~> #{OPTIONS[:redcloth]}"
88
+
89
+ rescue LoadError => detail
90
+ if OPTIONS[:redcloth] < '3'
91
+ require 'redcloth_2.0.11'
92
+ else
93
+ require 'redcloth'
94
+ end
95
+ end
96
+
97
+ # Remove the "caps" spanning:
98
+ RedCloth::GLYPHS.delete_if { |glyph| glyph[1] =~ /class=\"caps\"/ }
99
+
100
+ # Fix missing hard_break in RedCloth 3.0.0/1
101
+ if ['3.0.0', '3.0.1'].include? RedCloth::VERSION
102
+ class RedCloth #{{{
103
+ # Attempts at fixing the list blocks recognition:
104
+ #BLOCKS_GROUP_RE = /(^([#*> ])(?:[^\n]|\n+|\n(?!\n|\Z))+)|((?:[^\n]+|\n+ +|\n(?![#*\n]|\Z))+)/m
105
+
106
+ def to_html( *rules ) #{{{
107
+ rules = @rules if rules.empty?
108
+ # make our working copy
109
+ text = self.dup
110
+
111
+ @urlrefs = {}
112
+ @shelf = []
113
+ textile_rules = [:refs_textile, :block_textile_table, :block_textile_lists,
114
+ :block_textile_prefix, :inline_textile_image, :inline_textile_link,
115
+ :inline_textile_code, :inline_textile_span, :inline_textile_glyphs]
116
+ markdown_rules = [:refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule,
117
+ :block_markdown_bq, :block_markdown_lists,
118
+ :inline_markdown_reflink, :inline_markdown_link]
119
+ @rules = rules.collect do |rule|
120
+ case rule
121
+ when :markdown
122
+ markdown_rules
123
+ when :textile
124
+ textile_rules
125
+ else
126
+ rule
127
+ end
128
+ end.flatten
129
+
130
+ # standard clean up
131
+ incoming_entities text
132
+ clean_white_space text
133
+
134
+ # start processor
135
+ pre_list = rip_offtags text
136
+ refs text
137
+ blocks text
138
+ inline text
139
+ smooth_offtags text, pre_list
140
+
141
+ retrieve text
142
+ hard_break text # PIMKI: this is the missing bit!
143
+
144
+ text.gsub!( /<\/?notextile>/, '' )
145
+ text.gsub!( /x%x%/, '&#38;' )
146
+ text.strip!
147
+ text
148
+ end #}}}
149
+ end #}}}
150
+ end #}}}
151
+
138
152
  # Start the application: {{{
139
153
  storage_dir = OPTIONS[:storage] + "/" + OPTIONS[:port].to_s
140
154
  require 'fileutils'
@@ -143,12 +157,13 @@ WikiService.storage_path = storage_dir
143
157
 
144
158
  WikiController.template_root = "#{cdir}/app/views/"
145
159
 
146
- trap "INT" do
147
- WebControllerServer::the_active_server.shutdown
148
- end
149
- trap "TERM" do
160
+ on_exit = lambda {
150
161
  WebControllerServer::the_active_server.shutdown
151
- end
162
+ MadeleineService.request_stop
163
+ }
164
+
165
+ trap "INT", on_exit
166
+ trap "TERM", on_exit
152
167
 
153
168
  WebControllerServer.new(OPTIONS[:port], OPTIONS[:server_type], "#{cdir}/app/controllers/")
154
169
 
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.8.4
3
3
  specification_version: 1
4
4
  name: Pimki
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.4.092
7
- date: 2005-01-16
8
- summary: A Personal Information Manager (PIM) based on the Wiki technology of Instiki.
6
+ version: 1.5.092
7
+ date: 2005-02-02
8
+ summary: "A Personal Information Manager (PIM) based on Instiki's Wiki technology."
9
9
  require_paths:
10
10
  - libraries
11
11
  email: assaph@gmail.com
12
12
  homepage: http://pimki.rubyforge.org
13
13
  rubyforge_project: pimki
14
- description: "Pimki in a Personal Information Manager based on the Wiki technology of Instiki. Besides all the rich features and excellent look of Instiki, a few features have been added, such as: a personal blog, todo lists, graphical mapping, quick-links and others."
14
+ description: "Pimki in a Personal Information Manager based on Instiki's Wiki technology. Besides all the rich features and excellent look of Instiki, a few features have been added, such as: a personal blog, todo lists, graphical mapping, quick-links, advanced search and others."
15
15
  autorequire:
16
16
  default_executable: pimki.rb
17
17
  bindir: "."
@@ -78,6 +78,7 @@ files:
78
78
  - app/views/top.rhtml
79
79
  - app/views/wiki
80
80
  - app/views/wiki_words_help.rhtml
81
+ - app/views/wiki/adv_search.rhtml
81
82
  - app/views/wiki/authors.rhtml
82
83
  - app/views/wiki/bliki.rhtml
83
84
  - app/views/wiki/bliki_edit.rhtml
@@ -114,6 +115,7 @@ files:
114
115
  - libraries/madeleine
115
116
  - libraries/madeleine_service.rb
116
117
  - libraries/rdocsupport.rb
118
+ - libraries/redcloth_2.0.11.rb
117
119
  - libraries/redcloth_for_tex.rb
118
120
  - libraries/redcloth_for_tex_test.rb
119
121
  - libraries/view_helper.rb
@@ -141,7 +143,7 @@ dependencies:
141
143
  -
142
144
  - ">="
143
145
  - !ruby/object:Gem::Version
144
- version: 3.0.0
146
+ version: 2.0.11
145
147
  version:
146
148
  - !ruby/object:Gem::Dependency
147
149
  name: BlueCloth