jekyll 3.0.0.pre.beta2 → 3.0.0.pre.beta3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dddf1b38fdc18a72e5eb9b4815ce16cc8064ea4
4
- data.tar.gz: 6d2f3e779033c12dc2b2b0a9565179b5c76a416d
3
+ metadata.gz: b3bfbcb3305b1d99e27d4f8e0b4498a9bd26162e
4
+ data.tar.gz: bce86abbe4ecf82618bb8ab2cfd46c94a82c83e1
5
5
  SHA512:
6
- metadata.gz: 0fe940402be050a4b58839cb7475fbf28fd66750074ca4d56317e9e18c6b1078ef360381a004c3f78f06310ad12ced9e20fc8e4e4b5e124004495fe8f740d904
7
- data.tar.gz: 8e2667ddda7b81528eba778dd3388b19ab6976a2521a57e23d075b6ea93b0bef00fe85f68e55db92e6b6e4d194147502a099ce8a0c36ed124506a438407a4748
6
+ metadata.gz: a35034599b1cf1be9b4194b058a244b070bb7deaac9525068239cfd307f4c4aaa64e7534002b0d517cdf69cbf8855eddea5b8501d91d1b9fd319feec9dc2d423
7
+ data.tar.gz: 0ea6b82be241eb5bbdcf1124e178c510b7450e1c86b27367b8351358236ee51c4b63a4eb9aee2bc62a16094bbdbdc3dc8812f04c1c1936a4750e4e6fa090b1bf
@@ -20,7 +20,7 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs
20
20
  * Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
21
21
  * Take a gander at some existing [Sites](https://wiki.github.com/jekyll/jekyll/sites)
22
22
  * Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
23
- * Have questions? Check out [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/).
23
+ * Have questions? Check out [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/)
24
24
 
25
25
  ## Diving In
26
26
 
data/bin/jekyll CHANGED
@@ -31,6 +31,7 @@ Mercenary.program(:jekyll) do |p|
31
31
  if args.empty?
32
32
  Jekyll.logger.error "A subcommand is required."
33
33
  puts p
34
+ abort
34
35
  else
35
36
  unless p.has_command?(args.first)
36
37
  Jekyll.logger.abort_with "Invalid command. Use --help for more information"
@@ -49,12 +49,19 @@ module Jekyll
49
49
  autoload :Filters, 'jekyll/filters'
50
50
  autoload :FrontmatterDefaults, 'jekyll/frontmatter_defaults'
51
51
  autoload :Layout, 'jekyll/layout'
52
- autoload :LayoutReader, 'jekyll/layout_reader'
52
+ autoload :CollectionReader, 'jekyll/readers/collection_reader'
53
+ autoload :DataReader, 'jekyll/readers/data_reader'
54
+ autoload :LayoutReader, 'jekyll/readers/layout_reader'
55
+ autoload :DraftReader, 'jekyll/readers/draft_reader'
56
+ autoload :PostReader, 'jekyll/readers/post_reader'
57
+ autoload :PageReader, 'jekyll/readers/page_reader'
58
+ autoload :StaticFileReader, 'jekyll/readers/static_file_reader'
53
59
  autoload :LogAdapter, 'jekyll/log_adapter'
54
60
  autoload :Page, 'jekyll/page'
55
61
  autoload :PluginManager, 'jekyll/plugin_manager'
56
62
  autoload :Post, 'jekyll/post'
57
63
  autoload :Publisher, 'jekyll/publisher'
64
+ autoload :Reader, 'jekyll/reader'
58
65
  autoload :Regenerator, 'jekyll/regenerator'
59
66
  autoload :RelatedPosts, 'jekyll/related_posts'
60
67
  autoload :Renderer, 'jekyll/renderer'
@@ -23,7 +23,8 @@ module Jekyll
23
23
  # Build your jekyll site
24
24
  # Continuously watch if `watch` is set to true in the config.
25
25
  def process(options)
26
- Jekyll.logger.log_level = :error if options['quiet']
26
+ # Adjust verbosity quickly
27
+ Jekyll.logger.adjust_verbosity(options)
27
28
 
28
29
  options = configuration_from_options(options)
29
30
  site = Jekyll::Site.new(options)
@@ -36,16 +36,12 @@ module Jekyll
36
36
  end
37
37
 
38
38
  def deprecated_relative_permalinks(site)
39
- contains_deprecated_pages = false
40
- site.pages.each do |page|
41
- if page.uses_relative_permalinks
42
- Jekyll::Deprecator.deprecation_message "'#{page.path}' uses relative" +
43
- " permalinks which will be deprecated in" +
44
- " Jekyll v2.0.0 and beyond."
45
- contains_deprecated_pages = true
46
- end
39
+ if site.config['relative_permalinks']
40
+ Jekyll::Deprecator.deprecation_message "Your site still uses relative" +
41
+ " permalinks, which was removed in" +
42
+ " Jekyll v3.0.0."
43
+ return true
47
44
  end
48
- contains_deprecated_pages
49
45
  end
50
46
 
51
47
  def conflicting_urls(site)
@@ -45,26 +45,15 @@ module Jekyll
45
45
  'host' => '127.0.0.1',
46
46
  'baseurl' => '',
47
47
 
48
- # Backwards-compatibility options
49
- 'relative_permalinks' => false,
50
-
51
48
  # Output Configuration
52
49
  'permalink' => 'date',
53
50
  'paginate_path' => '/page:num',
54
51
  'timezone' => nil, # use the local timezone
55
52
 
56
53
  'quiet' => false,
54
+ 'verbose' => false,
57
55
  'defaults' => [],
58
56
 
59
- 'maruku' => {
60
- 'use_tex' => false,
61
- 'use_divs' => false,
62
- 'png_engine' => 'blahtex',
63
- 'png_dir' => 'images/latex',
64
- 'png_url' => '/images/latex',
65
- 'fenced_code_blocks' => true
66
- },
67
-
68
57
  'rdiscount' => {
69
58
  'extensions' => []
70
59
  },
@@ -99,18 +88,28 @@ module Jekyll
99
88
  reduce({}) { |hsh,(k,v)| hsh.merge(k.to_s => v) }
100
89
  end
101
90
 
91
+ def get_config_value_with_override(config_key, override)
92
+ override[config_key] || self[config_key] || DEFAULTS[config_key]
93
+ end
94
+
102
95
  # Public: Directory of the Jekyll source folder
103
96
  #
104
97
  # override - the command-line options hash
105
98
  #
106
99
  # Returns the path to the Jekyll source directory
107
100
  def source(override)
108
- override['source'] || self['source'] || DEFAULTS['source']
101
+ get_config_value_with_override('source', override)
102
+ end
103
+
104
+ def quiet(override = {})
105
+ get_config_value_with_override('quiet', override)
109
106
  end
107
+ alias_method :quiet?, :quiet
110
108
 
111
- def quiet?(override = {})
112
- override['quiet'] || self['quiet'] || DEFAULTS['quiet']
109
+ def verbose(override = {})
110
+ get_config_value_with_override('verbose', override)
113
111
  end
112
+ alias_method :verbose?, :verbose
114
113
 
115
114
  def safe_load_file(filename)
116
115
  case File.extname(filename)
@@ -130,8 +129,8 @@ module Jekyll
130
129
  #
131
130
  # Returns an Array of config files
132
131
  def config_files(override)
133
- # Be quiet quickly.
134
- Jekyll.logger.log_level = :error if quiet?(override)
132
+ # Adjust verbosity quickly
133
+ Jekyll.logger.adjust_verbosity(:quiet => quiet?(override), :verbose => verbose?(override))
135
134
 
136
135
  # Get configuration from <source>/_config.yml or <source>/<config_file>
137
136
  config_files = override.delete('config')
@@ -257,9 +256,11 @@ module Jekyll
257
256
  end
258
257
 
259
258
  if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku")
260
- Jekyll::Deprecator.deprecation_message "You're using the 'maruku' " +
261
- "Markdown processor. Maruku support has been deprecated and will " +
262
- "be removed in 3.0.0. We recommend you switch to Kramdown."
259
+ Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " +
260
+ "Markdown processor, which has been removed as of 3.0.0. " +
261
+ "We recommend you switch to Kramdown. To do this, replace " +
262
+ "`markdown: maruku` with `markdown: kramdown` in your " +
263
+ "`_config.yml` file."
263
264
  end
264
265
 
265
266
  config
@@ -13,7 +13,6 @@ module Jekyll
13
13
  when 'redcarpet' then RedcarpetParser.new(@config)
14
14
  when 'kramdown' then KramdownParser.new(@config)
15
15
  when 'rdiscount' then RDiscountParser.new(@config)
16
- when 'maruku' then MarukuParser.new(@config)
17
16
  else
18
17
  # So they can't try some tricky bullshit or go down the ancestor chain, I hope.
19
18
  if allowed_custom_class?(@config['markdown'])
@@ -29,7 +28,6 @@ module Jekyll
29
28
 
30
29
  def valid_processors
31
30
  %w[
32
- maruku
33
31
  rdiscount
34
32
  kramdown
35
33
  redcarpet
@@ -39,7 +37,6 @@ module Jekyll
39
37
  def third_party_processors
40
38
  self.class.constants - %w[
41
39
  KramdownParser
42
- MarukuParser
43
40
  RDiscountParser
44
41
  RedcarpetParser
45
42
  PRIORITIES
@@ -56,6 +56,12 @@ module Jekyll
56
56
  end
57
57
 
58
58
  self.data ||= {}
59
+
60
+ unless self.data.is_a?(Hash)
61
+ Jekyll.logger.abort_with "Fatal:", "Invalid YAML front matter in #{File.join(base, name)}"
62
+ end
63
+
64
+ self.data
59
65
  end
60
66
 
61
67
  # Transform the contents based on the content type.
@@ -9,7 +9,7 @@ module Jekyll
9
9
  :error => ::Logger::ERROR
10
10
  }
11
11
 
12
- # Public: Create a new instance of Jekyll's log writer
12
+ # Public: Create a new instance of a log writer
13
13
  #
14
14
  # writer - Logger compatible instance
15
15
  # log_level - (optional, symbol) the log level
@@ -30,7 +30,17 @@ module Jekyll
30
30
  writer.level = LOG_LEVELS.fetch(level)
31
31
  end
32
32
 
33
- # Public: Print a jekyll debug message
33
+ def adjust_verbosity(options = {})
34
+ # Quiet always wins.
35
+ if options[:quiet]
36
+ self.log_level = :error
37
+ elsif options[:verbose]
38
+ self.log_level = :debug
39
+ end
40
+ debug "Logging at level:", LOG_LEVELS.key(writer.level).to_s
41
+ end
42
+
43
+ # Public: Print a debug message
34
44
  #
35
45
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
36
46
  # message - the message detail
@@ -40,7 +50,7 @@ module Jekyll
40
50
  writer.debug(message(topic, message))
41
51
  end
42
52
 
43
- # Public: Print a jekyll message
53
+ # Public: Print a message
44
54
  #
45
55
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
46
56
  # message - the message detail
@@ -50,7 +60,7 @@ module Jekyll
50
60
  writer.info(message(topic, message))
51
61
  end
52
62
 
53
- # Public: Print a jekyll message
63
+ # Public: Print a message
54
64
  #
55
65
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
56
66
  # message - the message detail
@@ -60,7 +70,7 @@ module Jekyll
60
70
  writer.warn(message(topic, message))
61
71
  end
62
72
 
63
- # Public: Print a jekyll error message
73
+ # Public: Print an error message
64
74
  #
65
75
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
66
76
  # message - the message detail
@@ -70,7 +80,7 @@ module Jekyll
70
80
  writer.error(message(topic, message))
71
81
  end
72
82
 
73
- # Public: Print a Jekyll error message and immediately abort the process
83
+ # Public: Print an error message and immediately abort the process
74
84
  #
75
85
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
76
86
  # message - the message detail (can be omitted)
@@ -81,7 +91,7 @@ module Jekyll
81
91
  abort
82
92
  end
83
93
 
84
- # Internal: Build a Jekyll topic method
94
+ # Internal: Build a topic method
85
95
  #
86
96
  # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
87
97
  # message - the message detail
@@ -1,8 +1,8 @@
1
- -# These are the same MIME types that GitHub Pages uses as of 26 January 2014
1
+ # These are the same MIME types that GitHub Pages uses as of 26 January 2014
2
2
 
3
- text/html html htm shtml
3
+ text/html;charset=utf-8 html htm shtml
4
4
  text/css css
5
- text/xml xml rss xsl xsd
5
+ text/xml;charset=utf-8 xml rss xsl xsd
6
6
  image/gif gif
7
7
  image/jpeg jpeg jpg
8
8
  application/x-javascript js
@@ -32,6 +32,7 @@ image/x-ms-bmp bmp
32
32
  application/vnd.ms-fontobject eot
33
33
  application/x-font-ttf ttf
34
34
  application/x-font-woff woff
35
+ application/font-woff2 woff2
35
36
  font/opentype otf
36
37
 
37
38
  application/java-archive jar ear
@@ -52,11 +52,7 @@ module Jekyll
52
52
  # Returns the String permalink or nil if none has been set.
53
53
  def permalink
54
54
  return nil if data.nil? || data['permalink'].nil?
55
- if site.config['relative_permalinks']
56
- File.join(@dir, data['permalink'])
57
- else
58
- data['permalink']
59
- end
55
+ data['permalink']
60
56
  end
61
57
 
62
58
  # The template of the permalink.
@@ -156,9 +152,5 @@ module Jekyll
156
152
  def index?
157
153
  basename == 'index'
158
154
  end
159
-
160
- def uses_relative_permalinks
161
- permalink && !@dir.empty? && site.config['relative_permalinks']
162
- end
163
155
  end
164
156
  end
@@ -0,0 +1,121 @@
1
+ # encoding: UTF-8
2
+ require 'csv'
3
+
4
+ module Jekyll
5
+ class Reader
6
+ attr_reader :site
7
+
8
+ def initialize(site)
9
+ @site = site
10
+ end
11
+
12
+ # Read Site data from disk and load it into internal data structures.
13
+ #
14
+ # Returns nothing.
15
+ def read
16
+ @site.layouts = LayoutReader.new(site).read
17
+ read_directories
18
+ @site.data = DataReader.new(site).read(site.config['data_source'])
19
+ CollectionReader.new(site).read
20
+ end
21
+
22
+ # Recursively traverse directories to find posts, pages and static files
23
+ # that will become part of the site according to the rules in
24
+ # filter_entries.
25
+ #
26
+ # dir - The String relative path of the directory to read. Default: ''.
27
+ #
28
+ # Returns nothing.
29
+ def read_directories(dir = '')
30
+ base = site.in_source_dir(dir)
31
+
32
+ dot = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
33
+ dot_dirs = dot.select{ |file| File.directory?(@site.in_source_dir(base,file)) }
34
+ dot_files = (dot - dot_dirs)
35
+ dot_pages = dot_files.select{ |file| Utils.has_yaml_header?(@site.in_source_dir(base,file)) }
36
+ dot_static_files = dot_files - dot_pages
37
+
38
+ retrieve_posts(dir)
39
+ retrieve_dirs(base, dir, dot_dirs)
40
+ retrieve_pages(dir, dot_pages)
41
+ retrieve_static_files(dir, dot_static_files)
42
+ end
43
+
44
+ # Retrieves all the posts(posts/drafts) from the given directory
45
+ # and add them to the site and sort them.
46
+ #
47
+ # dir - The String representing the directory to retrieve the posts from.
48
+ #
49
+ # Returns nothing.
50
+ def retrieve_posts(dir)
51
+ site.posts.concat(PostReader.new(site).read(dir))
52
+ site.posts.concat(DraftReader.new(site).read(dir)) if site.show_drafts
53
+ site.posts.sort!
54
+ end
55
+
56
+ # Recursively traverse directories with the read_directories function.
57
+ #
58
+ # base - The String representing the site's base directory.
59
+ # dir - The String representing the directory to traverse down.
60
+ # dot_dirs - The Array of subdirectories in the dir.
61
+ #
62
+ # Returns nothing.
63
+ def retrieve_dirs(base, dir, dot_dirs)
64
+ dot_dirs.map { |file|
65
+ dir_path = site.in_source_dir(dir,file)
66
+ rel_path = File.join(dir, file)
67
+ @site.reader.read_directories(rel_path) unless @site.dest.sub(/\/$/, '') == dir_path
68
+ }
69
+ end
70
+
71
+ # Retrieve all the pages from the current directory,
72
+ # add them to the site and sort them.
73
+ #
74
+ # dir - The String representing the directory retrieve the pages from.
75
+ # dot_pages - The Array of pages in the dir.
76
+ #
77
+ # Returns nothing.
78
+ def retrieve_pages(dir, dot_pages)
79
+ site.pages.concat(PageReader.new(site, dir).read(dot_pages))
80
+ site.pages.sort_by!(&:name)
81
+ end
82
+
83
+ # Retrieve all the static files from the current directory,
84
+ # add them to the site and sort them.
85
+ #
86
+ # dir - The directory retrieve the static files from.
87
+ # dot_static_files - The static files in the dir.
88
+ #
89
+ # Returns nothing.
90
+ def retrieve_static_files(dir, dot_static_files)
91
+ site.static_files.concat(StaticFileReader.new(site, dir).read(dot_static_files))
92
+ site.static_files.sort_by!(&:relative_path)
93
+ end
94
+
95
+ # Filter out any files/directories that are hidden or backup files (start
96
+ # with "." or "#" or end with "~"), or contain site content (start with "_"),
97
+ # or are excluded in the site configuration, unless they are web server
98
+ # files such as '.htaccess'.
99
+ #
100
+ # entries - The Array of String file/directory entries to filter.
101
+ # base_directory - The string representing the optional base directory.
102
+ #
103
+ # Returns the Array of filtered entries.
104
+ def filter_entries(entries, base_directory = nil)
105
+ EntryFilter.new(site, base_directory).filter(entries)
106
+ end
107
+
108
+ # Read the entries from a particular directory for processing
109
+ #
110
+ # dir - The String representing the relative path of the directory to read.
111
+ # subfolder - The String representing the directory to read.
112
+ #
113
+ # Returns the list of entries to process
114
+ def get_entries(dir, subfolder)
115
+ base = site.in_source_dir(dir, subfolder)
116
+ return [] unless File.exist?(base)
117
+ entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
118
+ entries.delete_if { |e| File.directory?(site.in_source_dir(base, e)) }
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,19 @@
1
+ module Jekyll
2
+ class CollectionReader
3
+ attr_reader :site, :content
4
+ def initialize(site)
5
+ @site = site
6
+ @content = {}
7
+ end
8
+
9
+ # Read in all collections specified in the configuration
10
+ #
11
+ # Returns nothing.
12
+ def read
13
+ site.collections.each do |_, collection|
14
+ collection.read unless collection.label.eql?('data')
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,69 @@
1
+ module Jekyll
2
+ class DataReader
3
+ attr_reader :site, :content
4
+ def initialize(site)
5
+ @site = site
6
+ @content = {}
7
+ end
8
+
9
+ # Read all the files in <source>/<dir>/_drafts and create a new Draft
10
+ # object with each one.
11
+ #
12
+ # dir - The String relative path of the directory to read.
13
+ #
14
+ # Returns nothing.
15
+ def read(dir)
16
+ base = site.in_source_dir(dir)
17
+ read_data_to(base, @content)
18
+ @content
19
+ end
20
+
21
+ # Read and parse all yaml files under <dir> and add them to the
22
+ # <data> variable.
23
+ #
24
+ # dir - The string absolute path of the directory to read.
25
+ # data - The variable to which data will be added.
26
+ #
27
+ # Returns nothing
28
+ def read_data_to(dir, data)
29
+ return unless File.directory?(dir) && (!site.safe || !File.symlink?(dir))
30
+
31
+ entries = Dir.chdir(dir) do
32
+ Dir['*.{yaml,yml,json,csv}'] + Dir['*'].select { |fn| File.directory?(fn) }
33
+ end
34
+
35
+ entries.each do |entry|
36
+ path = @site.in_source_dir(dir, entry)
37
+ next if File.symlink?(path) && site.safe
38
+
39
+ key = sanitize_filename(File.basename(entry, '.*'))
40
+ if File.directory?(path)
41
+ read_data_to(path, data[key] = {})
42
+ else
43
+ data[key] = read_data_file(path)
44
+ end
45
+ end
46
+ end
47
+
48
+ # Determines how to read a data file.
49
+ #
50
+ # Returns the contents of the data file.
51
+ def read_data_file(path)
52
+ case File.extname(path).downcase
53
+ when '.csv'
54
+ CSV.read(path, {
55
+ :headers => true,
56
+ :encoding => site.config['encoding']
57
+ }).map(&:to_hash)
58
+ else
59
+ SafeYAML.load_file(path)
60
+ end
61
+ end
62
+
63
+ def sanitize_filename(name)
64
+ name.gsub!(/[^\w\s-]+/, '')
65
+ name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
66
+ name.gsub(/\s+/, '_')
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ module Jekyll
2
+ class DraftReader
3
+ attr_reader :site, :unfiltered_content
4
+ def initialize(site)
5
+ @site = site
6
+ @unfiltered_content = Array.new
7
+ end
8
+
9
+ # Read all the files in <source>/<dir>/_drafts and create a new Draft
10
+ # object with each one.
11
+ #
12
+ # dir - The String relative path of the directory to read.
13
+ #
14
+ # Returns nothing.
15
+ def read(dir)
16
+ @unfiltered_content = read_content(dir, '_drafts')
17
+ @unfiltered_content.select{ |draft| site.publisher.publish?(draft) }
18
+ end
19
+
20
+ # Read all the content files from <source>/<dir>/magic_dir
21
+ # and return them with the type klass.
22
+ #
23
+ # dir - The String relative path of the directory to read.
24
+ # magic_dir - The String relative directory to <dir>,
25
+ # looks for content here.
26
+ # klass - The return type of the content.
27
+ #
28
+ # Returns klass type of content files
29
+ def read_content(dir, magic_dir)
30
+ @site.reader.get_entries(dir, magic_dir).map do |entry|
31
+ Draft.new(site, site.source, dir, entry) if Draft.valid?(entry)
32
+ end.reject do |entry|
33
+ entry.nil?
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ module Jekyll
2
+ class PageReader
3
+ attr_reader :site, :dir, :unfiltered_content
4
+ def initialize(site, dir)
5
+ @site = site
6
+ @dir = dir
7
+ @unfiltered_content = Array.new
8
+ end
9
+
10
+ # Read all the files in <source>/<dir>/ for Yaml header and create a new Page
11
+ # object for each file.
12
+ #
13
+ # dir - The String relative path of the directory to read.
14
+ #
15
+ # Returns an array of static pages.
16
+ def read(files)
17
+ files.map{ |page| @unfiltered_content << Page.new(@site, @site.source, @dir, page) }
18
+ @unfiltered_content.select{ |page| site.publisher.publish?(page) }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ module Jekyll
2
+ class PostReader
3
+ attr_reader :site, :unfiltered_content
4
+ def initialize(site)
5
+ @site = site
6
+ @unfiltered_content = Array.new
7
+ end
8
+
9
+ # Read all the files in <source>/<dir>/_posts and create a new Post
10
+ # object with each one.
11
+ #
12
+ # dir - The String relative path of the directory to read.
13
+ #
14
+ # Returns nothing.
15
+ def read(dir)
16
+ @unfiltered_content = read_content(dir, '_posts')
17
+ @unfiltered_content.select{ |post| site.publisher.publish?(post) }
18
+ end
19
+
20
+ # Read all the content files from <source>/<dir>/magic_dir
21
+ # and return them with the type klass.
22
+ #
23
+ # dir - The String relative path of the directory to read.
24
+ # magic_dir - The String relative directory to <dir>,
25
+ # looks for content here.
26
+ # klass - The return type of the content.
27
+ #
28
+ # Returns klass type of content files
29
+ def read_content(dir, magic_dir)
30
+ @site.reader.get_entries(dir, magic_dir).map do |entry|
31
+ Post.new(site, site.source, dir, entry) if Post.valid?(entry)
32
+ end.reject do |entry|
33
+ entry.nil?
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ module Jekyll
2
+ class StaticFileReader
3
+ attr_reader :site, :dir, :unfiltered_content
4
+ def initialize(site, dir)
5
+ @site = site
6
+ @dir = dir
7
+ @unfiltered_content = Array.new
8
+ end
9
+
10
+ # Read all the files in <source>/<dir>/ for Yaml header and create a new Page
11
+ # object for each file.
12
+ #
13
+ # dir - The String relative path of the directory to read.
14
+ #
15
+ # Returns an array of static files.
16
+ def read(files)
17
+ files.map{ |file| @unfiltered_content << StaticFile.new(@site, @site.source, @dir, file)}
18
+ @unfiltered_content
19
+ end
20
+ end
21
+ end
@@ -9,7 +9,7 @@ module Jekyll
9
9
  read_metadata
10
10
 
11
11
  # Initialize cache to an empty hash
12
- @cache = {}
12
+ clear_cache
13
13
  end
14
14
 
15
15
  # Checks if a renderable object needs to be regenerated
@@ -18,16 +18,19 @@ module Jekyll
18
18
  def regenerate?(document)
19
19
  case document
20
20
  when Post, Page
21
- document.asset_file? || document.data['regenerate'] ||
22
- modified?(site.in_source_dir(document.relative_path))
21
+ document.asset_file? || document.data['regenerate'] ||
22
+ source_modified_or_dest_missing?(
23
+ site.in_source_dir(document.relative_path), document.destination(@site.dest)
24
+ )
23
25
  when Document
24
- !document.write? || document.data['regenerate'] || modified?(document.path)
26
+ !document.write? || document.data['regenerate'] ||
27
+ source_modified_or_dest_missing?(
28
+ document.path, document.destination(@site.dest)
29
+ )
25
30
  else
26
- if document.respond_to?(:path)
27
- modified?(document.path)
28
- else
29
- true
30
- end
31
+ source_path = document.respond_to?(:path) ? document.path : nil
32
+ dest_path = document.respond_to?(:destination) ? document.destination(@site.dest) : nil
33
+ source_modified_or_dest_missing?(source_path, dest_path)
31
34
  end
32
35
  end
33
36
 
@@ -56,9 +59,26 @@ module Jekyll
56
59
  # Returns nothing
57
60
  def clear
58
61
  @metadata = {}
62
+ clear_cache
63
+ end
64
+
65
+
66
+ # Clear just the cache
67
+ #
68
+ # Returns nothing
69
+ def clear_cache
59
70
  @cache = {}
60
71
  end
61
72
 
73
+
74
+ # Checks if the source has been modified or the
75
+ # destination is missing
76
+ #
77
+ # returns a boolean
78
+ def source_modified_or_dest_missing?(source_path, dest_path)
79
+ modified?(source_path) || (dest_path and !File.exist?(dest_path))
80
+ end
81
+
62
82
  # Checks if a path's (or one of its dependencies)
63
83
  # mtime has changed
64
84
  #
@@ -66,6 +86,9 @@ module Jekyll
66
86
  def modified?(path)
67
87
  return true if disabled?
68
88
 
89
+ # objects that don't have a path are always regenerated
90
+ return true if path.nil?
91
+
69
92
  # Check for path in cache
70
93
  if cache.has_key? path
71
94
  return cache[path]
@@ -96,7 +119,10 @@ module Jekyll
96
119
  def add_dependency(path, dependency)
97
120
  return if (metadata[path].nil? || @disabled)
98
121
 
99
- metadata[path]["deps"] << dependency unless metadata[path]["deps"].include? dependency
122
+ if !metadata[path]["deps"].include? dependency
123
+ metadata[path]["deps"] << dependency
124
+ add(dependency) unless metadata.include?(dependency)
125
+ end
100
126
  regenerate? dependency
101
127
  end
102
128
 
@@ -42,7 +42,7 @@ module Jekyll
42
42
  end
43
43
 
44
44
  def lsi_related_posts
45
- self.class.lsi.find_related(post.content, 11) - [post]
45
+ self.class.lsi.find_related(post, 11)
46
46
  end
47
47
 
48
48
  def most_recent_posts
@@ -4,13 +4,13 @@ require 'csv'
4
4
  module Jekyll
5
5
  class Site
6
6
  attr_reader :source, :dest, :config
7
- attr_accessor :layouts, :posts, :pages, :static_files,
7
+ attr_accessor :layouts, :posts, :pages, :static_files, :drafts,
8
8
  :exclude, :include, :lsi, :highlighter, :permalink_style,
9
9
  :time, :future, :unpublished, :safe, :plugins, :limit_posts,
10
10
  :show_drafts, :keep_files, :baseurl, :data, :file_read_opts,
11
11
  :gems, :plugin_manager
12
12
 
13
- attr_accessor :converters, :generators
13
+ attr_accessor :converters, :generators, :reader
14
14
  attr_reader :regenerator
15
15
 
16
16
  # Public: Initialize a new Site.
@@ -28,6 +28,8 @@ module Jekyll
28
28
  @source = File.expand_path(config['source']).freeze
29
29
  @dest = File.expand_path(config['destination']).freeze
30
30
 
31
+ @reader = Jekyll::Reader.new(self)
32
+
31
33
  # Initialize incremental regenerator
32
34
  @regenerator = Regenerator.new(self)
33
35
 
@@ -68,6 +70,7 @@ module Jekyll
68
70
  self.static_files = []
69
71
  self.data = {}
70
72
  @collections = nil
73
+ @regenerator.clear_cache()
71
74
 
72
75
  if limit_posts < 0
73
76
  raise ArgumentError, "limit_posts must be a non-negative number"
@@ -97,30 +100,6 @@ module Jekyll
97
100
  end
98
101
  end
99
102
 
100
- # Public: Prefix a given path with the source directory.
101
- #
102
- # paths - (optional) path elements to a file or directory within the
103
- # source directory
104
- #
105
- # Returns a path which is prefixed with the source directory.
106
- def in_source_dir(*paths)
107
- paths.reduce(source) do |base, path|
108
- Jekyll.sanitized_path(base, path)
109
- end
110
- end
111
-
112
- # Public: Prefix a given path with the destination directory.
113
- #
114
- # paths - (optional) path elements to a file or directory within the
115
- # destination directory
116
- #
117
- # Returns a path which is prefixed with the destination directory.
118
- def in_dest_dir(*paths)
119
- paths.reduce(dest) do |base, path|
120
- Jekyll.sanitized_path(base, path)
121
- end
122
- end
123
-
124
103
  # The list of collections and their corresponding Jekyll::Collection instances.
125
104
  # If config['collections'] is set, a new instance is created for each item in the collection.
126
105
  # If config['collections'] is not set, a new hash is returned.
@@ -151,140 +130,8 @@ module Jekyll
151
130
  #
152
131
  # Returns nothing.
153
132
  def read
154
- self.layouts = LayoutReader.new(self).read
155
- read_directories
156
- read_data(config['data_source'])
157
- read_collections
158
- end
159
-
160
- # Recursively traverse directories to find posts, pages and static files
161
- # that will become part of the site according to the rules in
162
- # filter_entries.
163
- #
164
- # dir - The String relative path of the directory to read. Default: ''.
165
- #
166
- # Returns nothing.
167
- def read_directories(dir = '')
168
- base = in_source_dir(dir)
169
- entries = Dir.chdir(base) { filter_entries(Dir.entries('.'), base) }
170
-
171
- read_posts(dir)
172
- read_drafts(dir) if show_drafts
173
- posts.sort!
174
- limit_posts! if limit_posts > 0 # limit the posts if :limit_posts option is set
175
-
176
- entries.each do |f|
177
- f_abs = in_source_dir(base, f)
178
- if File.directory?(f_abs)
179
- f_rel = File.join(dir, f)
180
- read_directories(f_rel) unless dest.sub(/\/$/, '') == f_abs
181
- elsif Utils.has_yaml_header?(f_abs)
182
- page = Page.new(self, source, dir, f)
183
- pages << page if publisher.publish?(page)
184
- else
185
- static_files << StaticFile.new(self, source, dir, f)
186
- end
187
- end
188
-
189
- pages.sort_by!(&:name)
190
- static_files.sort_by!(&:relative_path)
191
- end
192
-
193
- # Read all the files in <source>/<dir>/_posts and create a new Post
194
- # object with each one.
195
- #
196
- # dir - The String relative path of the directory to read.
197
- #
198
- # Returns nothing.
199
- def read_posts(dir)
200
- posts = read_content(dir, '_posts', Post)
201
-
202
- posts.each do |post|
203
- aggregate_post_info(post) if publisher.publish?(post)
204
- end
205
- end
206
-
207
- # Read all the files in <source>/<dir>/_drafts and create a new Post
208
- # object with each one.
209
- #
210
- # dir - The String relative path of the directory to read.
211
- #
212
- # Returns nothing.
213
- def read_drafts(dir)
214
- drafts = read_content(dir, '_drafts', Draft)
215
-
216
- drafts.each do |draft|
217
- if draft.published?
218
- aggregate_post_info(draft)
219
- end
220
- end
221
- end
222
-
223
- def read_content(dir, magic_dir, klass)
224
- get_entries(dir, magic_dir).map do |entry|
225
- klass.new(self, source, dir, entry) if klass.valid?(entry)
226
- end.reject do |entry|
227
- entry.nil?
228
- end
229
- end
230
-
231
- # Read and parse all yaml files under <source>/<dir>
232
- #
233
- # Returns nothing
234
- def read_data(dir)
235
- base = in_source_dir(dir)
236
- read_data_to(base, self.data)
237
- end
238
-
239
- # Read and parse all yaml files under <dir> and add them to the
240
- # <data> variable.
241
- #
242
- # dir - The string absolute path of the directory to read.
243
- # data - The variable to which data will be added.
244
- #
245
- # Returns nothing
246
- def read_data_to(dir, data)
247
- return unless File.directory?(dir) && (!safe || !File.symlink?(dir))
248
-
249
- entries = Dir.chdir(dir) do
250
- Dir['*.{yaml,yml,json,csv}'] + Dir['*'].select { |fn| File.directory?(fn) }
251
- end
252
-
253
- entries.each do |entry|
254
- path = in_source_dir(dir, entry)
255
- next if File.symlink?(path) && safe
256
-
257
- key = sanitize_filename(File.basename(entry, '.*'))
258
- if File.directory?(path)
259
- read_data_to(path, data[key] = {})
260
- else
261
- data[key] = read_data_file(path)
262
- end
263
- end
264
- end
265
-
266
- # Determines how to read a data file.
267
- #
268
- # Returns the contents of the data file.
269
- def read_data_file(path)
270
- case File.extname(path).downcase
271
- when '.csv'
272
- CSV.read(path, {
273
- :headers => true,
274
- :encoding => config['encoding']
275
- }).map(&:to_hash)
276
- else
277
- SafeYAML.load_file(path)
278
- end
279
- end
280
-
281
- # Read in all collections specified in the configuration
282
- #
283
- # Returns nothing.
284
- def read_collections
285
- collections.each do |_, collection|
286
- collection.read unless collection.label.eql?("data")
287
- end
133
+ reader.read
134
+ limit_posts!
288
135
  end
289
136
 
290
137
  # Run each of the Generators.
@@ -300,7 +147,7 @@ module Jekyll
300
147
  #
301
148
  # Returns nothing.
302
149
  def render
303
- relative_permalinks_deprecation_method
150
+ relative_permalinks_are_deprecated
304
151
 
305
152
  payload = site_payload
306
153
  collections.each do |label, collection|
@@ -404,25 +251,13 @@ module Jekyll
404
251
  "html_pages" => pages.select { |page| page.html? || page.url.end_with?("/") },
405
252
  "categories" => post_attr_hash('categories'),
406
253
  "tags" => post_attr_hash('tags'),
407
- "collections" => collections,
254
+ "collections" => collections.values.map(&:to_liquid),
408
255
  "documents" => documents,
409
256
  "data" => site_data
410
257
  }))
411
258
  }
412
259
  end
413
260
 
414
- # Filter out any files/directories that are hidden or backup files (start
415
- # with "." or "#" or end with "~"), or contain site content (start with "_"),
416
- # or are excluded in the site configuration, unless they are web server
417
- # files such as '.htaccess'.
418
- #
419
- # entries - The Array of String file/directory entries to filter.
420
- #
421
- # Returns the Array of filtered entries.
422
- def filter_entries(entries, base_directory = nil)
423
- EntryFilter.new(self, base_directory).filter(entries)
424
- end
425
-
426
261
  # Get the implementation class for the given Converter.
427
262
  #
428
263
  # klass - The Class of the Converter to fetch.
@@ -447,48 +282,37 @@ module Jekyll
447
282
  end
448
283
  end
449
284
 
450
- # Read the entries from a particular directory for processing
451
- #
452
- # dir - The String relative path of the directory to read
453
- # subfolder - The String directory to read
454
- #
455
- # Returns the list of entries to process
456
- def get_entries(dir, subfolder)
457
- base = in_source_dir(dir, subfolder)
458
- return [] unless File.exist?(base)
459
- entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
460
- entries.delete_if { |e| File.directory?(in_source_dir(base, e)) }
461
- end
462
-
463
- # Aggregate post information
285
+ # Warns the user if permanent links are relative to the parent
286
+ # directory. As this is a deprecated function of Jekyll.
464
287
  #
465
- # post - The Post object to aggregate information for
466
- #
467
- # Returns nothing
468
- def aggregate_post_info(post)
469
- posts << post
470
- end
471
-
472
- def relative_permalinks_deprecation_method
473
- if config['relative_permalinks'] && has_relative_page?
474
- Jekyll::Deprecator.deprecation_message "Since v2.0, permalinks for pages" +
475
- " in subfolders must be relative to the" +
476
- " site source directory, not the parent" +
477
- " directory. Check http://jekyllrb.com/docs/upgrading/"+
478
- " for more info."
288
+ # Returns
289
+ def relative_permalinks_are_deprecated
290
+ if config['relative_permalinks']
291
+ Jekyll.logger.abort_with "Since v3.0, permalinks for pages" +
292
+ " in subfolders must be relative to the" +
293
+ " site source directory, not the parent" +
294
+ " directory. Check http://jekyllrb.com/docs/upgrading/"+
295
+ " for more info."
479
296
  end
480
297
  end
481
298
 
299
+ # Get the to be written documents
300
+ #
301
+ # Returns an Array of Documents which should be written
482
302
  def docs_to_write
483
303
  documents.select(&:write?)
484
304
  end
485
305
 
306
+ # Get all the documents
307
+ #
308
+ # Returns an Array of all Documents
486
309
  def documents
487
310
  collections.reduce(Set.new) do |docs, (_, collection)|
488
311
  docs + collection.docs + collection.files
489
312
  end.to_a
490
313
  end
491
314
 
315
+
492
316
  def each_site_file
493
317
  %w(posts pages static_files docs_to_write).each do |type|
494
318
  send(type).each do |item|
@@ -497,6 +321,10 @@ module Jekyll
497
321
  end
498
322
  end
499
323
 
324
+ # Returns the FrontmatterDefaults or creates a new FrontmatterDefaults
325
+ # if it doesn't already exist.
326
+ #
327
+ # Returns The FrontmatterDefaults
500
328
  def frontmatter_defaults
501
329
  @frontmatter_defaults ||= FrontmatterDefaults.new(self)
502
330
  end
@@ -508,29 +336,56 @@ module Jekyll
508
336
  override['full_rebuild'] || config['full_rebuild']
509
337
  end
510
338
 
339
+ # Returns the publisher or creates a new publisher if it doesn't
340
+ # already exist.
341
+ #
342
+ # Returns The Publisher
511
343
  def publisher
512
344
  @publisher ||= Publisher.new(self)
513
345
  end
514
346
 
515
- private
347
+ # Public: Prefix a given path with the source directory.
348
+ #
349
+ # paths - (optional) path elements to a file or directory within the
350
+ # source directory
351
+ #
352
+ # Returns a path which is prefixed with the source directory.
353
+ def in_source_dir(*paths)
354
+ paths.reduce(source) do |base, path|
355
+ Jekyll.sanitized_path(base, path)
356
+ end
357
+ end
516
358
 
517
- def has_relative_page?
518
- pages.any? { |page| page.uses_relative_permalinks }
359
+ # Public: Prefix a given path with the destination directory.
360
+ #
361
+ # paths - (optional) path elements to a file or directory within the
362
+ # destination directory
363
+ #
364
+ # Returns a path which is prefixed with the destination directory.
365
+ def in_dest_dir(*paths)
366
+ paths.reduce(dest) do |base, path|
367
+ Jekyll.sanitized_path(base, path)
368
+ end
519
369
  end
520
370
 
371
+ private
372
+
373
+ # Limits the current posts; removes the posts which exceed the limit_posts
374
+ #
375
+ # Returns nothing
521
376
  def limit_posts!
522
- limit = posts.length < limit_posts ? posts.length : limit_posts
523
- self.posts = posts[-limit, limit]
377
+ if limit_posts > 0
378
+ limit = posts.length < limit_posts ? posts.length : limit_posts
379
+ self.posts = posts[-limit, limit]
380
+ end
524
381
  end
525
382
 
383
+ # Returns the Cleaner or creates a new Cleaner if it doesn't
384
+ # already exist.
385
+ #
386
+ # Returns The Cleaner
526
387
  def site_cleaner
527
388
  @site_cleaner ||= Cleaner.new(self)
528
389
  end
529
-
530
- def sanitize_filename(name)
531
- name.gsub!(/[^\w\s-]+/, '')
532
- name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2')
533
- name.gsub(/\s+/, '_')
534
- end
535
390
  end
536
391
  end
@@ -3,7 +3,7 @@ module Jekyll
3
3
  # The cache of last modification times [path] -> mtime.
4
4
  @@mtimes = Hash.new
5
5
 
6
- attr_reader :relative_path
6
+ attr_reader :relative_path, :extname
7
7
 
8
8
  # Initialize a new StaticFile.
9
9
  #
@@ -18,6 +18,7 @@ module Jekyll
18
18
  @name = name
19
19
  @collection = collection
20
20
  @relative_path = File.join(*[@dir, @name].compact)
21
+ @extname = File.extname(@name)
21
22
  end
22
23
 
23
24
  # Returns source file path.
@@ -25,10 +26,6 @@ module Jekyll
25
26
  File.join(*[@base, @dir, @name].compact)
26
27
  end
27
28
 
28
- def extname
29
- File.extname(path)
30
- end
31
-
32
29
  # Obtain destination path.
33
30
  #
34
31
  # dest - The String path to the destination dir.
@@ -46,9 +43,13 @@ module Jekyll
46
43
  end
47
44
  end
48
45
 
46
+ def modified_time
47
+ @modified_time ||= File.stat(path).mtime
48
+ end
49
+
49
50
  # Returns last modification time for this file.
50
51
  def mtime
51
- File.stat(path).mtime.to_i
52
+ modified_time.to_i
52
53
  end
53
54
 
54
55
  # Is source path modified?
@@ -94,9 +95,9 @@ module Jekyll
94
95
 
95
96
  def to_liquid
96
97
  {
97
- "path" => File.join("", relative_path),
98
- "modified_time" => mtime.to_s,
99
- "extname" => File.extname(relative_path)
98
+ "extname" => extname,
99
+ "modified_time" => modified_time,
100
+ "path" => File.join("", relative_path)
100
101
  }
101
102
  end
102
103
  end
@@ -1,3 +1,3 @@
1
1
  module Jekyll
2
- VERSION = '3.0.0.pre.beta2'
2
+ VERSION = '3.0.0.pre.beta3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.beta2
4
+ version: 3.0.0.pre.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-18 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -149,7 +149,6 @@ files:
149
149
  - lib/jekyll/converters/identity.rb
150
150
  - lib/jekyll/converters/markdown.rb
151
151
  - lib/jekyll/converters/markdown/kramdown_parser.rb
152
- - lib/jekyll/converters/markdown/maruku_parser.rb
153
152
  - lib/jekyll/converters/markdown/rdiscount_parser.rb
154
153
  - lib/jekyll/converters/markdown/redcarpet_parser.rb
155
154
  - lib/jekyll/convertible.rb
@@ -164,7 +163,6 @@ files:
164
163
  - lib/jekyll/frontmatter_defaults.rb
165
164
  - lib/jekyll/generator.rb
166
165
  - lib/jekyll/layout.rb
167
- - lib/jekyll/layout_reader.rb
168
166
  - lib/jekyll/liquid_extensions.rb
169
167
  - lib/jekyll/log_adapter.rb
170
168
  - lib/jekyll/mime.types
@@ -173,6 +171,14 @@ files:
173
171
  - lib/jekyll/plugin_manager.rb
174
172
  - lib/jekyll/post.rb
175
173
  - lib/jekyll/publisher.rb
174
+ - lib/jekyll/reader.rb
175
+ - lib/jekyll/readers/collection_reader.rb
176
+ - lib/jekyll/readers/data_reader.rb
177
+ - lib/jekyll/readers/draft_reader.rb
178
+ - lib/jekyll/readers/layout_reader.rb
179
+ - lib/jekyll/readers/page_reader.rb
180
+ - lib/jekyll/readers/post_reader.rb
181
+ - lib/jekyll/readers/static_file_reader.rb
176
182
  - lib/jekyll/regenerator.rb
177
183
  - lib/jekyll/related_posts.rb
178
184
  - lib/jekyll/renderer.rb
@@ -1,55 +0,0 @@
1
- module Jekyll
2
- module Converters
3
- class Markdown
4
- class MarukuParser
5
- def initialize(config)
6
- require 'maruku'
7
- @config = config
8
- @errors = []
9
- load_divs_library if @config['maruku']['use_divs']
10
- load_blahtext_library if @config['maruku']['use_tex']
11
-
12
- # allow fenced code blocks (new in Maruku 0.7.0)
13
- MaRuKu::Globals[:fenced_code_blocks] = !!@config['maruku']['fenced_code_blocks']
14
-
15
- rescue LoadError
16
- STDERR.puts 'You are missing a library required for Markdown. Please run:'
17
- STDERR.puts ' $ [sudo] gem install maruku'
18
- raise Errors::FatalException.new("Missing dependency: maruku")
19
- end
20
-
21
- def load_divs_library
22
- require 'maruku/ext/div'
23
- STDERR.puts 'Maruku: Using extended syntax for div elements.'
24
- end
25
-
26
- def load_blahtext_library
27
- require 'maruku/ext/math'
28
- STDERR.puts "Maruku: Using LaTeX extension. Images in `#{@config['maruku']['png_dir']}`."
29
-
30
- # Switch off MathML output
31
- MaRuKu::Globals[:html_math_output_mathml] = false
32
- MaRuKu::Globals[:html_math_engine] = 'none'
33
-
34
- # Turn on math to PNG support with blahtex
35
- # Resulting PNGs stored in `images/latex`
36
- MaRuKu::Globals[:html_math_output_png] = true
37
- MaRuKu::Globals[:html_png_engine] = @config['maruku']['png_engine']
38
- MaRuKu::Globals[:html_png_dir] = @config['maruku']['png_dir']
39
- MaRuKu::Globals[:html_png_url] = @config['maruku']['png_url']
40
- end
41
-
42
- def print_errors_and_fail
43
- print @errors.join
44
- raise MaRuKu::Exception, "MaRuKu encountered problem(s) while converting your markup."
45
- end
46
-
47
- def convert(content)
48
- converted = Maruku.new(content, :error_stream => @errors).to_html.strip
49
- print_errors_and_fail unless @errors.empty?
50
- converted
51
- end
52
- end
53
- end
54
- end
55
- end