Skip to content

Commit daa137e

Browse files
committed
Added pages, apple doc layout and toc generator plugin
1 parent 7c50136 commit daa137e

File tree

16 files changed

+478
-38
lines changed

16 files changed

+478
-38
lines changed

_appledoclayouts/default.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8' />
5+
<title>{{ page.title }}</title>
6+
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
7+
<meta name="robots" content="anchors"/>
8+
9+
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
10+
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/vd.css">
11+
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/toc.css">
12+
13+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
14+
<script src="javascripts/jquery.cookie.js"></script>
15+
<script src="javascripts/jquery.tocLight.js"></script>
16+
17+
<script type="text/javascript">
18+
$(function() {
19+
$.toc.clickHideButton();
20+
});
21+
</script>
22+
23+
</head>
24+
<body id="small">
25+
<a name="{{ page.mainAnchor }}"></a>
26+
<!-- HEADER -->
27+
<div id="header_wrap" class="outer">
28+
<header class="inner">
29+
<h1 id="project_title_small"><span>{{ page.title }}</span></h1>
30+
<h2 id="project_tagline_small">{{ page.subtitle }}</h2>
31+
</header>
32+
</div>
33+
34+
<div id="main_content_wrap_small" class="outer">
35+
<section id="main_content" class="inner">
36+
{{ content | toc_generate }}
37+
</section>
38+
</div>
39+
40+
</body>
41+
</html>

_layouts/default.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<script type="text/javascript">
2121
$(function() {
2222
{% unless page.noToc %}
23-
$('#main_content').toc();
23+
$('#main_content').toc();
2424
{% endunless %}
2525
});
2626
</script>
@@ -33,8 +33,6 @@
3333
<!-- HEADER -->
3434
<div id="header_wrap" class="outer">
3535
<header class="inner">
36-
<a id="forkme_banner" href="https://github.com/visualdiffer">Hosted at GitHub</a>
37-
3836
<h1 id="project_title"><a href="index.html">VisualDiffer Wiki</a></h1>
3937
<h2 id="project_tagline">{{ page.title }}</h2>
4038

@@ -51,7 +49,7 @@ <h2 id="project_tagline">{{ page.title }}</h2>
5149
<!-- FOOTER -->
5250
<div id="footer_wrap" class="outer">
5351
<footer class="inner">
54-
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
52+
<p>Copyright 2010-2013 <a href="http://visualdiffer.com">VisualDiffer</a></p>
5553
</footer>
5654
</div>
5755

_plugins/tocGenerator.rb

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
require 'nokogiri'
2+
3+
module Jekyll
4+
module TOCGenerator
5+
TOGGLE_HTML = '<div id="toctitle"><h2>%1</h2>%2</div>'
6+
TOC_CONTAINER_HTML = '<div id="toc-container"><table class="toc" id="toc"><tbody><tr><td>%1<ul>%2</ul></td></tr></tbody></table></div>'
7+
HIDE_HTML = '<span class="toctoggle">[<a id="toctogglelink" class="internal" href="#">%1</a>]</span>'
8+
9+
def toc_generate(html)
10+
pageContext = @context.environments.first["page"]
11+
12+
anchorPrefix = pageContext["anchorPrefix"] || 'tocAnchor-'
13+
showAlways = pageContext["showAlways"] || false
14+
saveShowStatus = pageContext["saveShowStatus"] || true
15+
16+
# Text labels
17+
contentsLabel = pageContext["contentsLabel"] || 'Contents'
18+
hideLabel = pageContext["hideLabel"] || 'hide'
19+
showText = pageContext["showText"] || 'show'
20+
showHideButton = pageContext["showHideButton"] || true;
21+
22+
noToc = pageContext["noToc"] || false;
23+
24+
if noToc
25+
return html
26+
end
27+
28+
tocHTML = ''
29+
tocLevel = 1
30+
tocSection = 1
31+
itemNumber = 1
32+
levelHTML = ''
33+
34+
doc = Nokogiri::HTML(html)
35+
36+
# Find H1 tag and all its H2 siblings until next H1
37+
# TODO This XPATH expression can greatly improved
38+
doc.css('h1').each do |h1|
39+
ct = h1.xpath('count(following-sibling::h1)')
40+
h2s = h1.xpath("following-sibling::h2[count(following-sibling::h1)=#{ct}]")
41+
42+
levelHTML = '';
43+
innerSection = 0;
44+
45+
h2s.map.each do |h2|
46+
innerSection += 1;
47+
anchorId = anchorPrefix + tocLevel.to_s + '-' + tocSection.to_s + '-' + innerSection.to_s
48+
# Insert before element the anchor used by TOC
49+
h2.before("<a name=\"#{anchorId}\"></a>")
50+
51+
levelHTML += createLevelHTML(anchorId,
52+
tocLevel + 1,
53+
tocSection + innerSection,
54+
itemNumber.to_s + '.' + innerSection.to_s,
55+
h2.text,
56+
'')
57+
end
58+
if levelHTML.length > 0
59+
levelHTML = '<ul>' + levelHTML + '</ul>';
60+
end
61+
anchorId = anchorPrefix + tocLevel.to_s + '-' + tocSection.to_s;
62+
# Insert before element the anchor used by TOC
63+
h1.before("<a name=\"#{anchorId}\"></a>")
64+
65+
tocHTML += createLevelHTML(anchorId,
66+
tocLevel,
67+
tocSection,
68+
itemNumber,
69+
h1.text,
70+
levelHTML);
71+
72+
tocSection += 1 + innerSection;
73+
itemNumber += 1;
74+
end
75+
76+
if tocHTML.length > 0
77+
hideHTML = '';
78+
if (showHideButton)
79+
hideHTML = HIDE_HTML.gsub('%1', hideLabel)
80+
end
81+
82+
hasOnlyOneTocItem = tocLevel == 1 && tocSection <= 2;
83+
show = showAlways ? true : !hasOnlyOneTocItem;
84+
85+
if (show)
86+
replacedToggleHTML = TOGGLE_HTML
87+
.gsub('%1', contentsLabel)
88+
.gsub('%2', hideHTML);
89+
tocTable = TOC_CONTAINER_HTML
90+
.gsub('%1', replacedToggleHTML)
91+
.gsub('%2', tocHTML);
92+
doc.css('body').children.before(tocTable)
93+
end
94+
doc.css('body').children.to_xhtml(indent:3, indent_text:" ")
95+
else
96+
return html
97+
end
98+
end
99+
100+
private
101+
102+
def createLevelHTML(anchorId, tocLevel, tocSection, tocNumber, tocText, tocInner)
103+
link = '<a href="#%1"><span class="tocnumber">%2</span> <span class="toctext">%3</span></a>%4'
104+
.gsub('%1', anchorId.to_s)
105+
.gsub('%2', tocNumber.to_s)
106+
.gsub('%3', tocText)
107+
.gsub('%4', tocInner ? tocInner : '');
108+
'<li class="toclevel-%1 tocsection-%2">%3</li>'
109+
.gsub('%1', tocLevel.to_s)
110+
.gsub('%2', tocSection.to_s)
111+
.gsub('%3', link)
112+
end
113+
end
114+
end
115+
116+
Liquid::Template.register_filter(Jekyll::TOCGenerator)

alignRules.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
permalink: alignRules.html
3+
layout: default
4+
5+
# mainAnchor is used by Apple links
6+
mainAnchor: alignRules
7+
title: File Names Alignment Rules
8+
subtitle: Change the default file names alignment method
9+
---
10+
11+
Before being compared two files they must be aligned, the alignment rule can be configured
12+
13+
# Align by name case sensitivity
14+
15+
The default alignment method compares file name strings, if they are match case then they will be aligned.
16+
Suppose you have the scenario shown below
17+
18+
<table class="bordered">
19+
<tr>
20+
<th>Left</th>
21+
<th>Right</th>
22+
</tr>
23+
<tr>
24+
<td>winter.jpg</td>
25+
<td>&nbsp;</td>
26+
</tr>
27+
<tr>
28+
<td>&nbsp;</td>
29+
<td>WINTER.JPG</td>
30+
</tr>
31+
<tr>
32+
<td>summer.jpg</td>
33+
<td>summer.jpg</td>
34+
</tr>
35+
</table>
36+
37+
By default winter.jpg and WINTER.JPG will be not aligned because their strings don't match uppercase and lowercase characters.
38+
39+
This result sometimes isn't what you expect, maybe you want to ignore uppercase/lowercase differences.
40+
This can be achieved selecting 'Ignore File Name Case' from popup menu.</p>
41+
42+
<table class="bordered">
43+
<tr>
44+
<th>Left</th>
45+
<th>Right</th>
46+
</tr>
47+
<tr>
48+
<td>winter.jpg</td>
49+
<td>WINTER.JPG</td>
50+
</tr>
51+
<tr>
52+
<td>summer.jpg</td>
53+
<td>summer.jpg</td>
54+
</tr>
55+
</table>
56+
57+
# Align by HFS+ filesystem case
58+
59+
Normally the <acronym title="Hierarchical File System">HFS+</acronym> disks are formatted ignoring the file name case, so if we have winter.jpg and WINTER.JPG they cannot be created on same directory (because they have the same name).
60+
61+
When the HFS+ partitions are formatted with case sensitive support the file names winter.jpg and WINTER.JPG are two different file names and can be created on same directory.
62+
63+
It is possible to let VisualDiffer determine the file name alignment case algorithm looking at HFS partition case, so three scenarios are possible
64+
65+
1. left and right are both case insensitive
66+
2. left and right are both case sensitive
67+
3. left/right is case sensitive and right/left is case insensitive
68+
69+
If the last scenario is true, the alignment will try to be smart, first it searches if a match case is available (winter.jpg with winter.jpg) then it tries to align with the most similar name.
70+
71+
# Align by user defined rules (not available on OSX 10.6 Snow Leopard)
72+
73+
TODO

comparisonMethods.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
permalink: comparisonMethods.html
33
layout: default
4+
5+
# mainAnchor is used by Apple links
6+
mainAnchor: comparisonMethod
47
title: Comparison method
8+
subtitle: Choose the method to compare folders and how to handle special files and metadata
59
---
610

7-
Choose the method to compare folders and how to handle special files and metadata
8-
9-
1011
# Comparison method
1112

1213
It is possible to choose which method to use to compare two folders.

fileFilters.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
permalink: fileFilters.html
3+
layout: default
4+
5+
# mainAnchor is used by Apple links
6+
mainAnchor: fileFilters
7+
title: File Filters
8+
subtitle: Filters can be used to exclude files from comparison, copy and delete actions
9+
---
10+
11+
Files can be escluded from comparison specifying filenames, relative paths, file sizes and file modification dates.
12+
13+
# Filename Filters
14+
15+
Available filters for filenames are shown below
16+
17+
<table class="bordered">
18+
<tr>
19+
<th>Comparator Filter</th>
20+
<th>Description</th>
21+
</tr>
22+
<tr>
23+
<td>Contains</td>
24+
<td>Filename contains the specified string</td>
25+
</tr>
26+
<tr>
27+
<td>Begins with</td>
28+
<td>Filename begins with the specified string</td>
29+
</tr>
30+
<tr>
31+
<td>Ends with</td>
32+
<td>Filename ends with the specified string</td>
33+
</tr>
34+
<tr>
35+
<td>Is</td>
36+
<td>Filename is equal to the specified string</td>
37+
</tr>
38+
<tr>
39+
<td>Is not</td>
40+
<td>Filename is not equal to the specified string</td>
41+
</tr>
42+
<tr>
43+
<td>Is like</td>
44+
<td>Filename equals the specified string
45+
<br/>? and * are allowed as wildcard characters, where ? matches 1 character and * matches 0 or more characters</td>
46+
</tr>
47+
</table>
48+
49+
# Path Filters
50+
51+
It is possible to filter by specifying a path relative to root, this allows to exclude specific paths
52+
Example
53+
54+
Left root path: <strong>/Users/dave/sources/</strong>
55+
Folder content
56+
<pre>
57+
/Users/dave/sources/
58+
&nbsp;&nbsp;project_1
59+
&nbsp;&nbsp;&nbsp;&nbsp;src/
60+
&nbsp;&nbsp;project_2
61+
&nbsp;&nbsp;&nbsp;&nbsp;src/
62+
&nbsp;&nbsp;&nbsp;&nbsp;index.txt
63+
</pre>
64+
To exclude only the folder <strong>src</strong> under <strong>project_1</strong> you can specify <strong>project_1/src</strong> as path filter.
65+
The path is relative to root <strong>/Users/dave/sources/</strong>, you can use both folders and files as path filter.
66+
The context menu item 'Exclude' automatically excludes folders as path.
67+
68+
Pay attention to not add extra characters, the following paths will never found
69+
<strong>project_1//src</strong>&nbsp;&nbsp;&nbsp;invalid, double slash
70+
<strong>project_1/src/</strong>&nbsp;&nbsp;&nbsp;invalid, trailing slash
71+
72+
73+
# File size Filters
74+
75+
It is possible to specify files (not folders) to exclude based on their size expressed in bytes, KB, MB and GB
76+
77+
# File modification date Filters
78+
79+
It is possible to specify files (not folders) to exclude based on their last modification date and time

fileLegend.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
---
22
permalink: fileLegend.html
33
layout: default
4+
5+
# mainAnchor is used by Apple links
6+
mainAnchor: fileLegend
47
title: File Colors Legend
8+
subtitle: Colors used in File Differ View
59
---
610

711
Lines colors in the File Differ View are based on differences found
8-
===========================================================
912

1013
<table class="bordered file-legend">
1114
<tr>

0 commit comments

Comments
 (0)