diff --git a/assets/images/icons.png b/assets/images/icons.png
index 1c2d9539..220fecf9 100644
Binary files a/assets/images/icons.png and b/assets/images/icons.png differ
diff --git a/assets/images/icons@2x.png b/assets/images/icons@2x.png
index 39ab5aa7..6bc93bdf 100644
Binary files a/assets/images/icons@2x.png and b/assets/images/icons@2x.png differ
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index 0033d95c..fc3c35bd 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,5 +1,8 @@
[
[
+ "2016-01-31",
+ "New documentation: Tcl/Tk"
+ ], [
"2016-01-24",
"“Multi-version support” has landed!\nClick Select documentation to pick which versions to use. More versions will be added in the coming weeks.\nIf you notice any bugs, please report them on GitHub."
], [
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee
index 0509b02e..19e7343a 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -384,6 +384,11 @@ credits = [
'2004-2016 Fabien Potencier',
'MIT',
'http://symfony.com/doc/current/contributing/code/license.html'
+ ], [
+ 'Tcl/Tk',
+ 'The Regents of the University of California, Sun Microsystems, Inc., Scriptics Corporation, and other parties',
+ 'Tcl/Tk',
+ 'http://tcl.tk/software/tcltk/license.html'
], [
'Underscore.js',
'2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors',
diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss
index 360bc0cf..c9b7d110 100644
--- a/assets/stylesheets/global/_icons.scss
+++ b/assets/stylesheets/global/_icons.scss
@@ -4,7 +4,7 @@
width: 1rem;
height: 1rem;
background-image: image-url('icons.png');
- background-size: 10rem 10rem;
+ background-size: 10rem 11rem;
}
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
@@ -122,3 +122,4 @@
._icon-flow:before { background-position: -7rem -9rem; }
._icon-relay:before { background-position: -8rem -9rem; }
._icon-phoenix:before { background-position: -9rem -9rem; }
+._icon-tcl_tk:before { background-position: 0 -10rem; }
diff --git a/assets/stylesheets/pages/_tcl_tk.scss b/assets/stylesheets/pages/_tcl_tk.scss
index 26ac6358..3731e59d 100644
--- a/assets/stylesheets/pages/_tcl_tk.scss
+++ b/assets/stylesheets/pages/_tcl_tk.scss
@@ -1,19 +1,5 @@
._tcl_tk {
- /* make content listing more compact */
- .description {
- margin: 0;
- > dd {
- margin: 0;
- }
- }
- dl {
- margin: 0;
- }
- .copy {
- /* per page copyright */
- white-space: pre;
- font-size: 80%;
- border-top: 1px solid #6A6A6A;
- margin-top: 2em;
- }
+ @extend %simple;
+
+ dl { margin: .5em 0; }
}
diff --git a/lib/docs/filters/tcl_tk/clean_html.rb b/lib/docs/filters/tcl_tk/clean_html.rb
index f2a0e931..5691c3f6 100644
--- a/lib/docs/filters/tcl_tk/clean_html.rb
+++ b/lib/docs/filters/tcl_tk/clean_html.rb
@@ -2,48 +2,38 @@ module Docs
class TclTk
class CleanHtmlFilter < Filter
def call
- # Page Title
- css('h2').remove
- # Navigation
- css('h3:first-child').remove
- # restore breaks in copyright
- txt = at_css('div.copy').content
- at_css('div.copy').content = txt.gsub! /.Copyright/, "\n\\0"
+ css('h2').remove # Page Title
+ css('h3:first-child').remove # Navigation
+
+ css('div.copy').each do |node|
+ node['class'] = '_attribution'
+ node.inner_html = %(
#{node.inner_html.gsub(' Copyright', '
\0')}
)
+ end
- file = result[:path].split('/')[-1]
- re = Regexp.new('^' + Regexp.escape(file) + '(#.*)$')
css('a[name]').each do |node|
- if node['href'] then
- # useless name
- node.remove_attribute 'name'
- # make fragments relativ
- if node['href'].match re then
- node['href'] = node['href'].sub re, '\\1'
- end
- else
- # move name to id
- node.parent['id'] = node['name']
- node.parent.content = node.content
- end
+ node.parent['id'] = node['name']
+ node.before(node.children).remove unless node['href']
end
- # remove keywords headline
- css('h3').each do |node|
- if node.content == 'KEYWORDS' then
- node.remove
- end
- end
- # remove keywords links
- css('a').each do |node|
- attr = node.attribute('href')
- if attr && attr.value.match(/\/Keywords\//) then
- # the ','
- if node.next_sibling then
- node.next_sibling.remove
+ css('h3').each do |node|
+ if node.content == 'KEYWORDS'
+ node['id'] = 'tmp__'
+ css('#tmp__ ~ a[href*="Keywords"]').each do |link|
+ link.next.remove if link.next.content == ', '
+ link.remove
end
node.remove
+ next
end
- end
+
+ node.name = 'h2'
+ node.content = node.content.capitalize
+ end
+
+ css('h4').each do |node|
+ node.name = 'h3'
+ node.content = node.content.capitalize
+ end
doc
end
diff --git a/lib/docs/filters/tcl_tk/entries.rb b/lib/docs/filters/tcl_tk/entries.rb
index f3dcd909..f364384a 100644
--- a/lib/docs/filters/tcl_tk/entries.rb
+++ b/lib/docs/filters/tcl_tk/entries.rb
@@ -1,56 +1,43 @@
module Docs
class TclTk
class EntriesFilter < Docs::EntriesFilter
- #def additional_entries
- # type = nil
- #end
-
- def split_slug
- slug.sub! /\.html?/, ''
- return *slug.split('/')
- end
-
TYPE_MAP = {
+ 'UserCmd' => 'Applications',
'TclCmd' => 'Tcl',
'TkCmd' => 'Tk',
- 'ItclCmd' => 'incr',
- 'SqliteCmd' => 'tdbc',
- 'TdbcCmd' => 'tdbc',
- 'TdbcmysqlCmd' => 'tdbc',
- 'TdbcodbcCmd' => 'tdbc',
- 'TdbcpostgresCmd' => 'tdbc',
- 'TdbcsqliteCmd' => 'tdbc',
- 'ThreadCmd' => 'Thread',
- 'UserCmd' => 'App'
+ 'ItclCmd' => '[incr Tcl]',
+ 'SqliteCmd' => 'TDBC',
+ 'TdbcCmd' => 'TDBC',
+ 'TdbcmysqlCmd' => 'TDBC',
+ 'TdbcodbcCmd' => 'TDBC',
+ 'TdbcpostgresCmd' => 'TDBC',
+ 'TdbcsqliteCmd' => 'TDBC',
+ 'ThreadCmd' => 'Thread'
}
- def get_type
- type, name = split_slug
- type = TYPE_MAP[type] || type
- if name == 'contents' then
- type = nil
- end
- type
+ def get_name
+ if slug == 'contents.htm'
+ TYPE_MAP[slug.split('/').first]
+ else
+ slug.split('/').last.remove('.htm')
+ end
end
- def get_name
- type, name = split_slug
- name
+ def get_type
+ return nil if name == 'contents'
+ TYPE_MAP.fetch(slug.split('/').first)
end
def additional_entries
- type, name = split_slug
- if type != 'TclCmd' || name != 'library' then
- return []
- end
- # special rule for library page which contains multiple commands at once
- entries = []
- css('a > b').each do |node|
- text = node.content.strip
- id = node.parent['href'].sub /^.*#(.*)$/, '\\1'
- entries << [text, id, TYPE_MAP[type]]
+ css('> dl.command > dt > a[name]:not([href])', '> dl.commands > dt > a[name]:not([href])').each_with_object [] do |node, entries|
+ name = node.at_xpath("./b[not(text()='#{self.name}')]").try(:content)
+ next unless name
+ name.strip!
+ name.remove! %r{\A:+}
+ name.prepend "#{self.name}: " unless name =~ /#{self.name}[:\s]/ || name =~ /#{self.name.gsub('_', '::')}[:\s]/
+ next if entries.any? { |entry| entry[0] == name }
+ entries << [name, node['name']]
end
- return entries
end
end
end
diff --git a/lib/docs/scrapers/tcl_tk.rb b/lib/docs/scrapers/tcl_tk.rb
index e790b9e4..148a3e3f 100644
--- a/lib/docs/scrapers/tcl_tk.rb
+++ b/lib/docs/scrapers/tcl_tk.rb
@@ -2,41 +2,28 @@ module Docs
class TclTk < UrlScraper
self.name = 'Tcl/Tk'
self.type = 'tcl_tk'
- self.slug = 'tcl'
- self.version = '8.6'
- # test URL:
- self.base_url = 'http://localhost/tcl/'
- # real URL:
- #self.base_url = 'http://www.tcl.tk/man/tcl/'
+ self.slug = 'tcl_tk'
+ self.release = '8.6'
+ self.base_url = 'https://www.tcl.tk/man/tcl/'
self.root_path = 'contents.htm'
- html_filters.push 'tcl_tk/clean_html', 'tcl_tk/entries'
-
- options[:skip_links] = false
+ html_filters.push 'tcl_tk/entries', 'tcl_tk/clean_html', 'title'
+ options[:root_title] = 'Tcl/Tk Documentation'
options[:trailing_slash] = false
- options[:skip] = ['siteinfo.htm']
+ options[:skip] = %w(siteinfo.htm)
options[:skip_patterns] = [
- # ignore keyword list pages
- /^Keywords\//,
- # ignore C-API, only required for extension developers
- /^TclLib\//,
- /^TkLib\//,
- /^ItclLib\//,
- /^TdbcLib\//
+ # ignore keyword list pages
+ /\AKeywords\//,
+ # ignore C-API, only required for extension developers
+ /\ATclLib\//,
+ /\ATkLib\//,
+ /\AItclLib\//,
+ /\ATdbcLib\//
]
- # TODO can't figure out howto convert .htm => .html in filenames
- # to save as "xyz.html" instead of "xyz.htm.html"
- #options[:fix_urls] = ->(url) do
- # url.sub! /\.htm($|#)/, '.html\\1'
- # url
- #end
-
- # Each Page contains a specific list of copyrights, only add the
- # overall license link
options[:attribution] = <<-HTML
- Licensed under Tcl/Tk Terms
+ Licensed under Tcl/Tk terms
HTML
end
end
diff --git a/public/icons/docs/tcl_tk/16.png b/public/icons/docs/tcl_tk/16.png
index 8752547d..eb88a3bb 100644
Binary files a/public/icons/docs/tcl_tk/16.png and b/public/icons/docs/tcl_tk/16.png differ
diff --git a/public/icons/docs/tcl_tk/16@2.png b/public/icons/docs/tcl_tk/16@2.png
index 1d784a29..3e00d1f6 100644
Binary files a/public/icons/docs/tcl_tk/16@2.png and b/public/icons/docs/tcl_tk/16@2.png differ