-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New home page and docs for TTFunk and PDF-Core
- Loading branch information
1 parent
b7ca70d
commit 3ebe7d3
Showing
870 changed files
with
164,209 additions
and
7,434 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,14 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="URF-8"> | ||
<title>Prawn | The page you were looking for doesn't exist (404)</title> | ||
<link href='/css/default.css' media='screen' rel='stylesheet' type='text/css' /> | ||
<script src='/js/prototype.js' type='text/javascript'></script> | ||
<script src='/js/effects.js' type='text/javascript'></script> | ||
</head> | ||
<body> | ||
<div class='page shadow'> | ||
<div class='content'> | ||
<h1>(404) The page you were looking for doesn't exist.</h1> | ||
<p>You may have mistyped the address or the page may have moved.</p> | ||
</div> | ||
<div class='bottom'> | ||
- Fast, Nimble PDF Writer for Ruby - | ||
</div> | ||
<h1>(404) The page you were looking for doesn't exist.</h1> | ||
<p>You may have mistyped the address or the page may have moved.</p> | ||
<div class='bottom'> | ||
- Fast, Nimble PDF Writer for Ruby - | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
exclude: | ||
- README.md |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<meta charset="utf-8"> | ||
<title>Redirecting…</title> | ||
<link rel="canonical" href="{{ page.redirect.to }}"> | ||
<script>location="{{ page.redirect.to }}"</script> | ||
<meta http-equiv="refresh" content="0; url={{ page.redirect.to }}"> | ||
<meta name="robots" content="noindex"> | ||
<h1>Redirecting…</h1> | ||
<a href="{{ page.redirect.to }}">Click here if you are not redirected.</a> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
|
||
|
||
module GemVersions | ||
def self.versions(name) | ||
@versions ||= {} | ||
@versions[name] ||= | ||
Dir | ||
.glob(File.join(File.expand_path('../docs', __dir__), name, '*')) | ||
.select { File.directory? _1 } | ||
.map { Gem::Version.new File.basename(_1) } | ||
end | ||
|
||
def self.all_versions(name) | ||
@all_versions ||= {} | ||
@all_versions[name] ||= | ||
versions(name) | ||
.flat_map { |v| | ||
(1..v.segments.length).map { |n| | ||
Gem::Version.new(v.segments.slice(0, n).join('.')) | ||
} | ||
} | ||
.sort | ||
.reverse | ||
end | ||
|
||
# Stubbed LiquidContext to support relative_url and absolute_url helpers | ||
class RedirectContext | ||
attr_reader :site | ||
|
||
def initialize(site) | ||
@site = site | ||
end | ||
|
||
def registers | ||
{ :site => site } | ||
end | ||
end | ||
|
||
class RedirectPage < Jekyll::Page | ||
include Jekyll::Filters::URLFilters | ||
|
||
DEFAULT_DATA = { | ||
"sitemap" => false, | ||
"layout" => "redirect", | ||
}.freeze | ||
|
||
def initialize(site, base, dir, name, from, to) | ||
super(site, base, dir, name) | ||
|
||
@context ||= RedirectContext.new(site) | ||
|
||
@redirec_from = ensure_leading_slash(from) | ||
@redirect_to = %r!^https?://!.match?(to) ? to : absolute_url(to) | ||
|
||
data.merge!( | ||
"permalink" => redirect_from, | ||
"redirect" => { | ||
"from" => redirect_from, | ||
"to" => redirect_to, | ||
} | ||
) | ||
end | ||
|
||
attr_reader :redirect_from, :redirect_to | ||
|
||
def read_yaml(_base, _name, _opts = {}) | ||
self.content = self.output = "" | ||
self.data ||= DEFAULT_DATA.dup | ||
end | ||
end | ||
|
||
class Generator < Jekyll::Generator | ||
def generate(site) | ||
Dir.glob(File.join(File.expand_path('../docs', __dir__), '*')) | ||
.select { File.directory? _1 } | ||
.each do |path| | ||
gemname = File.basename(path) | ||
versions = GemVersions.versions(gemname) | ||
all_versions = GemVersions.all_versions(gemname) | ||
version_map = all_versions.to_h { |v| | ||
req = Gem::Requirement.new("~> #{v}.0") | ||
best_version = versions.select { req.satisfied_by?(_1) }.max | ||
|
||
[v, best_version] | ||
} | ||
site.data['gems'] ||= {} | ||
site.data['gems'][gemname] = { | ||
versions: version_map, | ||
latest: versions.max, | ||
} | ||
|
||
version_map.each do |v, best_v| | ||
next if versions.any?{ v.eql? _1 } | ||
|
||
site.pages << RedirectPage.new( | ||
site, site.source, "/docs/#{gemname}/#{v}/", "index.html", | ||
"/docs/#{gemname}/#{v}/", | ||
"/docs/#{gemname}/#{best_v}/" | ||
) | ||
end | ||
|
||
site.pages << RedirectPage.new( | ||
site, site.source, "/docs/#{gemname}/", "index.html", | ||
"/docs/#{gemname}/", | ||
"/docs/#{gemname}/#{site.data['gems'][gemname][:latest]}/" | ||
) | ||
end | ||
|
||
site.pages << RedirectPage.new( | ||
site, site.source, "/docs/", "index.html", | ||
"/docs/", | ||
"/docs/prawn/#{site.data['gems']['prawn'][:latest]}/" | ||
) | ||
end | ||
end | ||
|
||
class Tag < Liquid::Tag | ||
def initialize(tagName, markup, options) | ||
super | ||
parts = markup.split | ||
case parts.length | ||
when 1 | ||
@gem = parts.first | ||
@version = nil | ||
when 2 | ||
@gem = parts.first | ||
@version = parts.last | ||
else | ||
raise SyntaxError, "#{tagName} requires at least 1 and at most 2 argumnts" | ||
end | ||
end | ||
|
||
def render(context) | ||
versions = GemVersions.versions(@gem) | ||
if @version | ||
req = Gem::Requirement.new("~> #{@version}.0") | ||
best_version = versions.select { req.satisfied_by?(_1) }.max | ||
best_version.to_s | ||
else | ||
versions.max.to_s | ||
end | ||
end | ||
|
||
Liquid::Template.register_tag "gem_version", self | ||
end | ||
end |
Oops, something went wrong.