textigniter 0.0.3 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. Textigniter
2
2
 
3
- Textigniter is a command line tool used to generate static websites. The main point of configuration is the config.yml that is set up in a textigniter initialized directory. Textigniter comes default with textile, liquid, less, and coffee-script as parsers to output static content.
3
+ Textigniter is a command line tool used to generate static websites. Textigniter uses the power of "Textile":http://redcloth.org/ ("Markdown":http://kramdown.rubyforge.org/ is optional...), "Liquid":http://liquidmarkup.org/, "LESS CSS":http://lesscss.org/, and "Coffee Script":http://jashkenas.github.com/coffee-script/ for parsing different files and outputting "HTML5":http://www.html5rocks.com/en/ powered websites (Obviously you'll need to know HTML5, textigniter just helps with a development philosophy).
4
4
 
5
5
  h2. Installation
6
6
 
@@ -13,16 +13,67 @@ The default parser gem's will be downloaded as well.
13
13
  h2. Usage
14
14
 
15
15
  @textigniter init@
16
+
16
17
  @textigniter init directory@
17
18
 
18
19
  Passing the init option initializes a new textigniter environment in your current directory. You can pass a second option to specify a directory that you want to install textigniter in.
19
20
 
20
21
  @textigniter build@
21
22
 
22
- Passing the build option will make textigniter parse the _.textigniter_ directory and output the static html to _public_html_
23
+ Passing the build option will make textigniter parse the _.textigniter_ directory and output the static html to _output_
23
24
 
24
25
  @textignier scrub@
25
- When you pass the scrub option, all textigniter related files and folders will be removed. This will also remove _public_html_. If you have files not related to textigniter specifically in the _public_html_ folder, you should back them up if you do not want to lose them.
26
+
27
+ When you pass the scrub option, all textigniter related files and folders will be removed. This will also remove _output_. If you have files not related to textigniter specifically in the _output_ folder, you should back them up if you do not want to lose them.
26
28
 
27
29
  @textigniter help@
28
- Passing help on the command line will print out usage of _textigniter_
30
+
31
+ Passing help on the command line will print out usage of _textigniter_
32
+
33
+ h2. Configuration
34
+
35
+ You can add anything you wish to _config.yml_ as long as it follows YAML format. Anything added to this file is available in the template. Look under the Template heading to find out more.
36
+
37
+ h2. Content
38
+
39
+ Content is stored in text files instead of a database. You can find a default _index.textile_ and _about.textile_ under the _.textigniter/content_ folder.
40
+ Your folder structure will determine your site structure. If you wanted a link that was _yoursite.com/articles/textigniter_, your folder and file structure would be _.textigniter/content/articles/textigniter.textile_. If you decide to use markdown instead of textile, make sure to update _config.yml_ with the correct _text_parser_ and change your file extensions from _.textile_ to _.markdown_.
41
+
42
+ These text files are broken down into a meta section and sections delimited by @-- content@, @-- variable_name@. The meta is parsed with YAML and the other sections are parsed with Textile. You can use any variable name you want for the text section and they'll be available to the template parser. This is true for the meta section as well. An example file could look something like this:
43
+
44
+ @title: Textigniter@
45
+ @slug: textigniter@
46
+ @tags: static, content, html5@
47
+ @author: Kaleb Heitzman@
48
+ @-- content@
49
+ @h1. This is textigniter powered@
50
+ @-- sidebar@
51
+ @h3. This is some sidebar content@
52
+
53
+ The following variables would be available in the template according to the code above: {{ title }}, {{ slug }}, {{ tags }}, {{ author }}, {{ content }}, {{ sidebar }}.
54
+
55
+ h2. Templates
56
+
57
+ Textigniter uses _liquid_ templates. Anything that goes in liquid can go in textigniter. Checkout the "liquid documentation.":https://github.com/Shopify/liquid/wiki/Liquid-for-Designers
58
+
59
+ Anything in _config.yml_ and the textile(markdown) file is available to the template. For example, _site_name_ is declared in the config file and is available in the template file as {{ site_name }}
60
+
61
+ h2. Styles
62
+
63
+ Styles are parsed via less. You can create .less files under _.textigniter/styles_ with a .less extension and they will automatically be parsed.
64
+
65
+ See the "LESS usage documentation":http://lesscss.org/#synopsis for more information.
66
+
67
+ h2. Scripts
68
+
69
+ Scripts are parsed via coffeescript. You can create .coffeescript files under _.textigniter/scripts_ with a .coffeescript extension and they will automatically be parsed.
70
+
71
+ See the "CoffeeScript homepage":http://jashkenas.github.com/coffee-script/ for more information.
72
+
73
+ h2. Philosophy
74
+
75
+ HTML5 is the rising up comer and with it come many advantages that in my opinion make databases overused for a majority of websites (Bloggers/Brochure Sites). Most dynamic content doesn't need pulled from a database anymore because it can processed with Javascript and XML, i.e Twitter feeds. Static Site Generators can really excel in this area.
76
+
77
+ A moment of honesty. Modular systems are awesome but systems are not created equal. Textigniter has been created with this in mind. Textigniter uses "Textile":http://redcloth.org/ ("Markdown":http://kramdown.rubyforge.org/ is optional...), "Liquid":http://liquidmarkup.org/, "LESS CSS":http://lesscss.org/, and "Coffee Script":http://jashkenas.github.com/coffee-script/ for parsing different files and outputting static content.
78
+
79
+ Static content mixed with the power of Javascript and HTML5 is more than enough for a majority of users who want easily maintainable websites.
@@ -1,5 +1,6 @@
1
1
  title: About
2
2
  slug: about
3
+ template: about
3
4
  -- content
4
5
  This is a sample about page generated by "textigniter":http://github.com/kalebheitzman/textigniter
5
6
  -- sidebar
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>{{ title }}</title>
5
+ </head>
6
+ <body>
7
+ {{ content }}
8
+
9
+ {{ sidebar }}
10
+ </body>
11
+ </html>
@@ -1,8 +1,4 @@
1
1
  site_name: "Textigniter"
2
2
  site_description: "A textigniter powered website"
3
- textigniter_environment: ".textigniter"
4
- output_environment: "public_html"
5
- text_parser: textile
6
- template_parser: liquid
7
- style_parser: less
8
- script_parser: coffeescript
3
+ output_environment: "output"
4
+ text_parser: textile
data/lib/textigniter.rb CHANGED
@@ -33,7 +33,7 @@ class Textigniter
33
33
  $config = YAML::load(File.dirname(__FILE__) + '/skeleton/config.yml')
34
34
  end
35
35
  # Store textigniter enviornment path in a global
36
- $twd = Dir::pwd + "/#{$config['textigniter_environment']}"
36
+ $twd = Dir::pwd + "/.textigniter"
37
37
  # Store output environment path in a global
38
38
  $owd = Dir::pwd + "/#{$config['output_environment']}"
39
39
 
@@ -1,10 +1,10 @@
1
1
  # The Build class searches through the textigniter enviornment
2
- # (Default: /.textigniter) and parses through text files, stylesheets, and
2
+ # (Default: /.textigniter) and parses through text files, stylesheets, and
3
3
  # javascripts with filters that correlate to the extension of the file. The
4
- # parsed content is then rendered to the output directory
4
+ # parsed content is then rendered to the output directory
5
5
  # (Default: /public_html)
6
6
  class Textigniter::Build
7
-
7
+
8
8
  def initialize
9
9
  # Output a start message
10
10
  STDOUT.puts "Building static content".yellow_on_black
@@ -30,27 +30,27 @@ class Textigniter::Build
30
30
  # Render scripts to file
31
31
  RenderFiles.new.render(script_items, 'js')
32
32
  end
33
-
33
+
34
34
  # Create a build list to pass to parsers
35
35
  def build_list(format)
36
36
  # switch on format
37
37
  case format
38
38
  when 'html'
39
39
  # Create the html list
40
- build_list = Dir.glob($twd + "/content/**/*.#{$config['text_parser']}")
41
-
40
+ build_list = Dir.glob($twd + "/content/**/*")
41
+
42
42
  when 'styles'
43
43
  # Create the style list
44
- build_list = Dir.glob($twd + "/styles/**/*.#{$config['style_parser']}")
44
+ build_list = Dir.glob($twd + "/styles/**/*")
45
45
 
46
46
  when 'scripts'
47
47
  # Create the script list
48
- build_list = Dir.glob($twd + "/scripts/**/*.#{$config['script_parser']}")
49
-
48
+ build_list = Dir.glob($twd + "/scripts/**/*")
49
+
50
50
  end
51
51
  # Return the list
52
- return build_list
53
- end
52
+ return build_list
53
+ end
54
54
 
55
55
  end
56
56
 
@@ -3,7 +3,7 @@ class Textigniter::Build::ScriptParser
3
3
 
4
4
  def process(build_list)
5
5
  # Output message
6
- STDOUT.puts "Parsing ".yellow_on_black + "[#{$config['script_parser']}]".blue_on_black + " scripts ".yellow_on_black + "[OK]".green_on_black
6
+ STDOUT.puts "Parsing ".yellow_on_black + "[coffeescript]".blue_on_black + " scripts ".yellow_on_black + "[OK]".green_on_black
7
7
  # create array to store processed items in
8
8
  items = Array.new
9
9
  # process the build list
@@ -18,7 +18,7 @@ class Textigniter::Build::ScriptParser
18
18
  directory = File.dirname(f).sub($twd,$owd) + '/'
19
19
  @h['directory'] = directory
20
20
  # get the file name
21
- @h['filename'] = File.basename(f, ".#{$config['script_parser']}")
21
+ @h['filename'] = File.basename(f, ".coffeescript}")
22
22
  # parse the content
23
23
  @h['output'] = parse(contents)
24
24
  # push processed item onto the array
@@ -29,17 +29,10 @@ class Textigniter::Build::ScriptParser
29
29
  end
30
30
 
31
31
  def parse(content)
32
- case $config['script_parser']
33
- when "coffeescript"
34
- # require coffee-script gem
35
- require 'coffee-script'
36
- # return the output
37
- return CoffeeScript.compile content
38
-
39
- else
40
- return content
41
-
42
- end
32
+ # require coffee-script gem
33
+ require 'coffee-script'
34
+ # return the output
35
+ return CoffeeScript.compile content
43
36
  end
44
37
 
45
38
  end
@@ -3,7 +3,7 @@ class Textigniter::Build::StyleParser
3
3
 
4
4
  def process(build_list)
5
5
  # Output message
6
- STDOUT.puts "Parsing ".yellow_on_black + "[#{$config['style_parser']}]".blue_on_black + " styles ".yellow_on_black + "[OK]".green_on_black
6
+ STDOUT.puts "Parsing ".yellow_on_black + "[less]".blue_on_black + " styles ".yellow_on_black + "[OK]".green_on_black
7
7
  # create array to store processed items in
8
8
  items = Array.new
9
9
  # process the build list
@@ -18,7 +18,7 @@ class Textigniter::Build::StyleParser
18
18
  directory = File.dirname(f).sub($twd,$owd) + '/'
19
19
  @h['directory'] = directory
20
20
  # get the file name
21
- @h['filename'] = File.basename(f, ".#{$config['style_parser']}")
21
+ @h['filename'] = File.basename(f, ".less")
22
22
  # parse the content
23
23
  @h['output'] = parse(contents)
24
24
  # push processed item onto the array
@@ -29,21 +29,14 @@ class Textigniter::Build::StyleParser
29
29
  end
30
30
 
31
31
  def parse(content)
32
- case $config['style_parser']
33
- when "less"
34
- # require less gem
35
- require 'less'
36
- # instantiate the parser
37
- parser = Less::Parser.new
38
- # parse the content
39
- tree = parser.parse(content)
40
- # return the output
41
- return tree.to_css
42
-
43
- else
44
- return content
45
-
46
- end
32
+ # require less gem
33
+ require 'less'
34
+ # instantiate the parser
35
+ parser = Less::Parser.new
36
+ # parse the content
37
+ tree = parser.parse(content)
38
+ # return the output
39
+ return tree.to_css
47
40
  end
48
41
 
49
42
  end
@@ -3,13 +3,13 @@ class Textigniter::Build::TemplateParser
3
3
 
4
4
  def process(item_list)
5
5
  # Output message
6
- STDOUT.puts "Parsing ".yellow_on_black + "[#{$config['template_parser']}]".blue_on_black + " templates ".yellow_on_black + "[OK]".green_on_black
6
+ STDOUT.puts "Parsing ".yellow_on_black + "[liquid]".blue_on_black + " templates ".yellow_on_black + "[OK]".green_on_black
7
7
  # create an array to store processed templates
8
8
  items = Array.new
9
9
  # iterate through the item list and parse templates
10
10
  item_list.each do |item|
11
11
  # specifiy the template
12
- file = File.open(Dir::pwd + '/.textigniter/layouts/' + item['template'] + '.' + $config['template_parser'], 'rb')
12
+ file = File.open(Dir::pwd + "/.textigniter/layouts/" + item['template'] + '.liquid', 'rb')
13
13
  # load the template
14
14
  template_from_file = file.read
15
15
  # render the output
@@ -22,26 +22,13 @@ class Textigniter::Build::TemplateParser
22
22
  end
23
23
 
24
24
  def parse(content, item)
25
- case $config['template_parser']
26
- when "liquid"
27
- require 'liquid'
28
- #parse the template
29
- template = Liquid::Template.parse(content)
30
- # render the template
31
- output = template.render(item)
32
- # return the output
33
- return output
34
-
35
- else
36
- require 'liquid'
37
- #parse the template
38
- template = Liquid::Template.parse(content)
39
- # render the template
40
- output = template.render(item)
41
- # return the output
42
- return output
43
-
44
- end
25
+ require 'liquid'
26
+ #parse the template
27
+ template = Liquid::Template.parse(content)
28
+ # render the template
29
+ output = template.render(item)
30
+ # return the output
31
+ return output
45
32
  end
46
33
 
47
34
  end
@@ -22,14 +22,18 @@ class Textigniter::Build::TextParser
22
22
  meta.each do |m|
23
23
  @h[m[0]] = m[1]
24
24
  end
25
+ # add config to the mix
26
+ $config.each do |c|
27
+ @h[c[0]] = c[1]
28
+ end
25
29
  # get the slug if it exists else calculate
26
30
  unless @h.has_key? 'slug'
27
31
  @h['slug'] = File.basename(f, '.textile')
28
32
  end
29
33
  # the write directory
30
34
  directory = File.dirname(f).sub($twd,$owd) + '/' + @h['slug']
31
- directory = directory.sub('public_html/content', 'public_html')
32
- directory = directory.sub('public_html/index', 'public_html') + '/'
35
+ directory = directory.sub("#{$config['output_environment']}/content", "#{$config['output_environment']}")
36
+ directory = directory.sub("#{$config['output_environment']}/index", "#{$config['output_environment']}") + '/'
33
37
  @h['directory'] = directory
34
38
  # get the template if exists else default
35
39
  unless @h.has_key? 'template'
@@ -58,6 +62,16 @@ class Textigniter::Build::TextParser
58
62
  require 'RedCloth'
59
63
  return RedCloth.new(content).to_html
60
64
 
65
+ when "markdown"
66
+ require 'kramdown'
67
+ return Kramdown::Document.new(content).to_html
68
+
69
+ when "html"
70
+ return content
71
+
72
+ when "txt"
73
+ return content
74
+
61
75
  else
62
76
  require 'RedCloth'
63
77
  return RedCloth.new(content).to_html
@@ -21,7 +21,7 @@ class Textigniter::Scrub
21
21
  cwd = Dir::pwd + '/'
22
22
  # Scrub the directory, no turning back
23
23
  scrub_directory(cwd + '.textigniter')
24
- scrub_directory(cwd + 'public_html')
24
+ scrub_directory(cwd + "#{$config['output_environment']}")
25
25
  # Files to delete as well
26
26
  files = [ cwd + "README.textile", cwd + "config.yml" ]
27
27
  # Remove files specified
data/textigniter.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.rubygems_version = '1.9.2'
3
3
 
4
4
  s.name = 'textigniter'
5
- s.version = '0.0.3'
5
+ s.version = '0.0.31'
6
6
  s.executables << 'textigniter'
7
7
  s.date = '2011-11-19'
8
8
 
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.extra_rdoc_files = %w[README.textile LICENSE]
22
22
 
23
23
  s.add_dependency('RedCloth', '>= 0')
24
+ s.add_dependency('kramdown', '>= 0')
24
25
  s.add_dependency('liquid', '>= 0')
25
26
  s.add_dependency('less', '>= 0')
26
27
  s.add_dependency('coffee-script', '>= 0')
@@ -38,12 +39,9 @@ Gem::Specification.new do |s|
38
39
  lib/skeleton/.textigniter/content/about.textile
39
40
  lib/skeleton/.textigniter/scripts/functions.coffeescript
40
41
  lib/skeleton/.textigniter/styles/style.less
42
+ lib/skeleton/.textigniter/layouts/about.liquid
41
43
  lib/skeleton/.textigniter/layouts/default.liquid
42
44
  lib/skeleton/.textigniter/layouts/partials
43
- lib/skeleton/public_html/media/README.textile
44
- lib/skeleton/public_html/media/images/README.textile
45
- lib/skeleton/public_html/scripts/README.textile
46
- lib/skeleton/public_html/styles/README.textile
47
45
  lib/textigniter.rb
48
46
  lib/textigniter/build.rb
49
47
  lib/textigniter/help.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textigniter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.31
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: RedCloth
16
- requirement: &70166844060160 !ruby/object:Gem::Requirement
16
+ requirement: &70121931208660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70166844060160
24
+ version_requirements: *70121931208660
25
+ - !ruby/object:Gem::Dependency
26
+ name: kramdown
27
+ requirement: &70121931208140 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70121931208140
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: liquid
27
- requirement: &70166844059620 !ruby/object:Gem::Requirement
38
+ requirement: &70121931207600 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :runtime
34
45
  prerelease: false
35
- version_requirements: *70166844059620
46
+ version_requirements: *70121931207600
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: less
38
- requirement: &70166844059060 !ruby/object:Gem::Requirement
49
+ requirement: &70121931207100 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :runtime
45
56
  prerelease: false
46
- version_requirements: *70166844059060
57
+ version_requirements: *70121931207100
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: coffee-script
49
- requirement: &70166844058580 !ruby/object:Gem::Requirement
60
+ requirement: &70121931206500 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :runtime
56
67
  prerelease: false
57
- version_requirements: *70166844058580
68
+ version_requirements: *70121931206500
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: colored
60
- requirement: &70166844058020 !ruby/object:Gem::Requirement
71
+ requirement: &70121931205820 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,7 +76,7 @@ dependencies:
65
76
  version: '0'
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70166844058020
79
+ version_requirements: *70121931205820
69
80
  description: ! " Textigniter is a lightweight static site generator based on\n
70
81
  \ textile, liquid, less, and coffeescript. Future versions may\n be more modular
71
82
  but let's be honest, I'm pretty partial to\n textile.\n"
@@ -87,11 +98,8 @@ files:
87
98
  - lib/skeleton/.textigniter/content/about.textile
88
99
  - lib/skeleton/.textigniter/scripts/functions.coffeescript
89
100
  - lib/skeleton/.textigniter/styles/style.less
101
+ - lib/skeleton/.textigniter/layouts/about.liquid
90
102
  - lib/skeleton/.textigniter/layouts/default.liquid
91
- - lib/skeleton/public_html/media/README.textile
92
- - lib/skeleton/public_html/media/images/README.textile
93
- - lib/skeleton/public_html/scripts/README.textile
94
- - lib/skeleton/public_html/styles/README.textile
95
103
  - lib/textigniter.rb
96
104
  - lib/textigniter/build.rb
97
105
  - lib/textigniter/help.rb
File without changes
File without changes
File without changes
File without changes