typedown 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -92,6 +92,24 @@ parser.
92
92
  puts doc.to_html
93
93
 
94
94
 
95
+ Section.sectionize might be nice for extracting headlines
96
+ or TOCs.
97
+
98
+ require 'typedown'
99
+
100
+ root = Typedown::Section.sectionize content
101
+ puts root.title
102
+ puts root.body.to_markdown
103
+
104
+ root.subsections.each do |s|
105
+ puts root.title
106
+ s.subsections.each do |t|
107
+ puts s.title
108
+ # puts s.body.to_markdown
109
+ # puts s.body.to_html
110
+ end
111
+ end
112
+
95
113
  == LICENSE:
96
114
 
97
115
  (The MIT License)
data/Rakefile CHANGED
@@ -1,6 +1,4 @@
1
1
  require 'rubygems'
2
- gem 'hoe', '>= 2.1.0'
3
- require 'hoe'
4
2
  require 'fileutils'
5
3
  require './lib/typedown'
6
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -1,5 +1,4 @@
1
1
 
2
-
3
2
  module Typedown
4
3
  class Section < String
5
4
  def initialize title, body
@@ -16,11 +15,11 @@ module Typedown
16
15
  end
17
16
 
18
17
  def title
19
- @title
18
+ @title || ""
20
19
  end
21
20
 
22
21
  def body
23
- b = Document.new @body
22
+ b = Document.new(@body || "")
24
23
  b << "\n\n"
25
24
  subsections.each do |s|
26
25
  b << s.doc
@@ -35,7 +34,7 @@ module Typedown
35
34
  end
36
35
 
37
36
  def subsections
38
- @sections
37
+ @sections || []
39
38
  end
40
39
 
41
40
  def self.sectionize body, title = nil
@@ -63,7 +62,7 @@ module Typedown
63
62
  end
64
63
  end
65
64
 
66
- [ body.strip, sections ]
65
+ [ body, sections ]
67
66
  end
68
67
  end
69
68
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typedown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - wrimle
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-13 00:00:00 +02:00
18
+ date: 2010-08-16 00:00:00 +02:00
19
19
  default_executable: typedown
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,6 @@ extensions: []
43
43
  extra_rdoc_files:
44
44
  - README.rdoc
45
45
  files:
46
- - History.txt
47
46
  - Manifest.txt
48
47
  - README.rdoc
49
48
  - Rakefile
@@ -59,7 +58,6 @@ files:
59
58
  - test/helper.rb
60
59
  - test/test_document.rb
61
60
  - test/test_section.rb
62
- - typedown.gemspec
63
61
  has_rdoc: true
64
62
  homepage: http://github.com/wrimle/typedown
65
63
  licenses: []
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- === 0.0.1 2010-08-12
2
-
3
- * 1 major enhancement:
4
- * Initial release
data/typedown.gemspec DELETED
@@ -1,63 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{typedown}
8
- s.version = "0.0.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["wrimle"]
12
- s.date = %q{2010-08-13}
13
- s.default_executable = %q{typedown}
14
- s.description = %q{Typedown is a markdown preprocessor which forwards it's output to a markdown parser. Presently bluecloth}
15
- s.email = %q{rmyrland@gmail.com}
16
- s.executables = ["typedown"]
17
- s.extra_rdoc_files = [
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- "History.txt",
22
- "Manifest.txt",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "bin/typedown",
27
- "lib/typedown.rb",
28
- "lib/typedown/document.rb",
29
- "lib/typedown/section.rb",
30
- "script/console",
31
- "script/destroy",
32
- "script/generate",
33
- "test/data/example.tpd",
34
- "test/helper.rb",
35
- "test/test_document.rb",
36
- "test/test_section.rb",
37
- "typedown.gemspec"
38
- ]
39
- s.homepage = %q{http://github.com/wrimle/typedown}
40
- s.rdoc_options = ["--charset=UTF-8"]
41
- s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.7}
43
- s.summary = %q{A markdown dialect optimized for fast typing on mobile devices}
44
- s.test_files = [
45
- "test/test_document.rb",
46
- "test/helper.rb",
47
- "test/test_section.rb"
48
- ]
49
-
50
- if s.respond_to? :specification_version then
51
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
- s.specification_version = 3
53
-
54
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
- s.add_runtime_dependency(%q<bluecloth>, [">= 2.0.7"])
56
- else
57
- s.add_dependency(%q<bluecloth>, [">= 2.0.7"])
58
- end
59
- else
60
- s.add_dependency(%q<bluecloth>, [">= 2.0.7"])
61
- end
62
- end
63
-