my_help 1.2.3 → 1.2.4p1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +1 -1
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +10 -11
- data/README.org +117 -84
- data/README_e.org +110 -0
- data/development_memo.org +5 -0
- data/doc/MyHelp/CLI.html +751 -0
- data/doc/MyHelp/Config.html +693 -0
- data/doc/MyHelp/Error.html +124 -0
- data/doc/MyHelp/GetConfig.html +196 -0
- data/doc/MyHelp/Git.html +291 -0
- data/doc/MyHelp/Init.html +449 -0
- data/doc/MyHelp/List.html +581 -0
- data/doc/MyHelp/Md2Hash.html +632 -0
- data/doc/MyHelp/Modify.html +393 -0
- data/doc/MyHelp/Org2Hash.html +544 -0
- data/doc/MyHelp.html +135 -0
- data/doc/Org2Yaml.html +497 -0
- data/doc/_index.html +230 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +181 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +181 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +451 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/my_help/cli.rb +28 -2
- data/lib/my_help/org2hash.rb +2 -1
- data/lib/my_help/version.rb +1 -1
- data/lib/templates/emacs.org +2 -1
- data/lib/templates/emacs_j.org +76 -0
- data/lib/templates/example.org +3 -2
- data/lib/templates/my_help_j.org +24 -0
- data/lib/templates/org_j.org +25 -0
- data/my_help_install.org +33 -0
- metadata +34 -5
- data/README_j.org +0 -143
- data/tmp.txt +0 -14
data/doc/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>my_help</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript">
|
8
|
+
var mainUrl = 'index.html';
|
9
|
+
try {
|
10
|
+
var match = decodeURIComponent(window.location.hash).match(/^#!(.+)/);
|
11
|
+
var name = match ? match[1] : mainUrl;
|
12
|
+
var url = new URL(name, location.href);
|
13
|
+
window.top.location.replace(url.origin === location.origin ? name : mainUrl);
|
14
|
+
} catch (e) {
|
15
|
+
window.top.location.replace(mainUrl);
|
16
|
+
}
|
17
|
+
</script>
|
18
|
+
<noscript>
|
19
|
+
<h1>Oops!</h1>
|
20
|
+
<h2>YARD requires JavaScript!</h2>
|
21
|
+
</noscript>
|
22
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— my_help
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1>概要</h1>
|
61
|
+
<p>CUI(CLA)ヘルプのUsage出力を真似て,user独自のhelpを作成・提供するgem.</p>
|
62
|
+
<h1>(my_helpで解決しようとする)問題点</h1>
|
63
|
+
<p>CUIやshell, 何かのプログラミング言語などを習得しようとする初心者は,
|
64
|
+
commandや文法を覚えるのに苦労します.
|
65
|
+
少しのkey(とっかかり)があると思い出すんですが,
|
66
|
+
うろ覚えでは間違えて路頭に迷います.
|
67
|
+
問題点は,</p>
|
68
|
+
<ul>
|
69
|
+
<li>manは基本的に英語</li>
|
70
|
+
<li>manualでは重たい</li>
|
71
|
+
<li>いつもおなじことをwebで検索して</li>
|
72
|
+
<li>同じとこ見ている</li>
|
73
|
+
<li>memoしても,どこへ置いたか忘れる</li>
|
74
|
+
</ul>
|
75
|
+
<p>などです.</p>
|
76
|
+
<h1>特徴</h1>
|
77
|
+
<p>これらをCLAとして提供しようというのが,このgemの目的です.
|
78
|
+
仕様としては,</p>
|
79
|
+
<ul>
|
80
|
+
<li>userが自分にあったmanを作成</li>
|
81
|
+
<li>雛形を提供</li>
|
82
|
+
<li>おなじformat, looks, 操作, 階層構造</li>
|
83
|
+
<li>すぐに手が届く</li>
|
84
|
+
<li>それらを追加・修正・削除できる</li>
|
85
|
+
</ul>
|
86
|
+
<p>memoソフトでは,検索が必要となりますが,my_helpは
|
87
|
+
key(記憶のとっかかり)を提供することが目的です.
|
88
|
+
RPGでレベル上げとかアイテムを貯めるようにして,
|
89
|
+
プログラミングでスキルを発展させてください.</p>
|
90
|
+
<p>VSCodeやGithub Copilotではcodeの候補を挙げてくれますが,
|
91
|
+
物覚えの悪い作者は,人の名前をitem分けして,こそっと使っています.</p>
|
92
|
+
<h1>使用法</h1>
|
93
|
+
<h2>インストール</h2>
|
94
|
+
<pre class="code ruby"><code class="ruby">
|
95
|
+
> gem install my_help
|
96
|
+
</code></pre>
|
97
|
+
<p>です.</p>
|
98
|
+
<h2>簡単な使用法</h2>
|
99
|
+
<p>まずは,</p>
|
100
|
+
<pre class="code bash"><code class="bash">
|
101
|
+
> my_help
|
102
|
+
Commands:
|
103
|
+
my_help delete HELP # delete HELP
|
104
|
+
my_help edit HELP # edit HELP
|
105
|
+
my_help help [COMMAND] # Describe available commands or one specific command
|
106
|
+
my_help list [HELP] [ITEM] # list all helps, specific HELP, or ITEM
|
107
|
+
my_help new HELP # make new HELP
|
108
|
+
my_help set_editor EDITOR_NAME # set editor to EDITOR_NAME
|
109
|
+
my_help setup # set up the test database
|
110
|
+
my_help version # show version
|
111
|
+
</code></pre>
|
112
|
+
<p>としてください.このlistにNAMEやITEMを加えて行くとわかると思います.</p>
|
113
|
+
<pre class="code bash"><code class="bash">
|
114
|
+
> my_help list
|
115
|
+
> my_help list emacs
|
116
|
+
> my_help list emacs -f
|
117
|
+
> my_help list emacs file
|
118
|
+
</code></pre>
|
119
|
+
<p>として動かしてみてください.</p>
|
120
|
+
<pre class="code bash"><code class="bash">
|
121
|
+
- emacsのキーバインド
|
122
|
+
-
|
123
|
+
特殊キー操作
|
124
|
+
- C-f, controlキーを押しながら 'f'
|
125
|
+
- M-f, escキーを押した後一度離して'f'
|
126
|
+
- 操作の中断C-g, 操作の取り消し(Undo) C-x u
|
127
|
+
, head : head
|
128
|
+
, license : license
|
129
|
+
-c, cursor : cursor
|
130
|
+
-e, edit : edit
|
131
|
+
-s, short_cut : short_cut
|
132
|
+
-f, file : file
|
133
|
+
-q, quit : quit
|
134
|
+
-p, page : page
|
135
|
+
-w, window : window
|
136
|
+
-b, buffer : buffer
|
137
|
+
-m, mode : mode
|
138
|
+
, query_replace : query_replace
|
139
|
+
-r, ruby-mode : ruby-mode
|
140
|
+
-d, dired : ファイラとして使う
|
141
|
+
</code></pre>
|
142
|
+
<h2>my_helpがやっていること</h2>
|
143
|
+
<p>my_helpの個々のヘルプファイルは’~/.my_help’に置かれています.
|
144
|
+
ヘルプファイルのフォーマットはEmacsのorg-modeです.
|
145
|
+
これをEditorで叩いて編集したり,
|
146
|
+
そこから情報を取り出したりしています.
|
147
|
+
単にファイル操作を集約しているだけなのですが,
|
148
|
+
これが面倒で...</p>
|
149
|
+
<h2>独自のhelpを作る方法</h2>
|
150
|
+
<p>独自のhelpを作る方法です.まずは,</p>
|
151
|
+
<pre class="code ruby"><code class="ruby">
|
152
|
+
$ my_help new new_help
|
153
|
+
</code></pre>
|
154
|
+
<p>で,new_helpというtemplateが用意されます.</p>
|
155
|
+
<pre class="code ruby"><code class="ruby">
|
156
|
+
$ my_help edit new_help
|
157
|
+
</code></pre>
|
158
|
+
<p>で編集してください. Emacs org形式で,格納されています.</p>
|
159
|
+
<pre class="code ruby"><code class="ruby">
|
160
|
+
$ my_help delete new_help
|
161
|
+
</code></pre>
|
162
|
+
<p>すると消されます.</p>
|
163
|
+
<h2>editorの変更</h2>
|
164
|
+
<pre class="code ruby"><code class="ruby">
|
165
|
+
$ my_help set_editor vim
|
166
|
+
</code></pre>
|
167
|
+
<p>でeditorを変更できます.codeとかは確認していますが,
|
168
|
+
それ以外で動いたり,動かなかったりを報告してください.</p>
|
169
|
+
<p>OS Xで’emacs’とした時にGUI版が立ち上がって嫌だという場合は,
|
170
|
+
‘emacs -nw’として下さい.</p>
|
171
|
+
</div></div>
|
172
|
+
|
173
|
+
<div id="footer">
|
174
|
+
Generated on Thu Sep 26 14:20:52 2024 by
|
175
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
176
|
+
0.9.36 (ruby-3.0.2).
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</div>
|
180
|
+
</body>
|
181
|
+
</html>
|
data/doc/js/app.js
ADDED
@@ -0,0 +1,314 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
var localStorage = {}, sessionStorage = {};
|
4
|
+
try { localStorage = window.localStorage; } catch (e) { }
|
5
|
+
try { sessionStorage = window.sessionStorage; } catch (e) { }
|
6
|
+
|
7
|
+
function createSourceLinks() {
|
8
|
+
$('.method_details_list .source_code').
|
9
|
+
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
|
10
|
+
$('.toggleSource').toggle(function() {
|
11
|
+
$(this).parent().nextAll('.source_code').slideDown(100);
|
12
|
+
$(this).text("Hide source");
|
13
|
+
},
|
14
|
+
function() {
|
15
|
+
$(this).parent().nextAll('.source_code').slideUp(100);
|
16
|
+
$(this).text("View source");
|
17
|
+
});
|
18
|
+
}
|
19
|
+
|
20
|
+
function createDefineLinks() {
|
21
|
+
var tHeight = 0;
|
22
|
+
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
|
23
|
+
$('.toggleDefines').toggle(function() {
|
24
|
+
tHeight = $(this).parent().prev().height();
|
25
|
+
$(this).prev().css('display', 'inline');
|
26
|
+
$(this).parent().prev().height($(this).parent().height());
|
27
|
+
$(this).text("(less)");
|
28
|
+
},
|
29
|
+
function() {
|
30
|
+
$(this).prev().hide();
|
31
|
+
$(this).parent().prev().height(tHeight);
|
32
|
+
$(this).text("more...");
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
function createFullTreeLinks() {
|
37
|
+
var tHeight = 0;
|
38
|
+
$('.inheritanceTree').toggle(function() {
|
39
|
+
tHeight = $(this).parent().prev().height();
|
40
|
+
$(this).parent().toggleClass('showAll');
|
41
|
+
$(this).text("(hide)");
|
42
|
+
$(this).parent().prev().height($(this).parent().height());
|
43
|
+
},
|
44
|
+
function() {
|
45
|
+
$(this).parent().toggleClass('showAll');
|
46
|
+
$(this).parent().prev().height(tHeight);
|
47
|
+
$(this).text("show all");
|
48
|
+
});
|
49
|
+
}
|
50
|
+
|
51
|
+
function searchFrameButtons() {
|
52
|
+
$('.full_list_link').click(function() {
|
53
|
+
toggleSearchFrame(this, $(this).attr('href'));
|
54
|
+
return false;
|
55
|
+
});
|
56
|
+
window.addEventListener('message', function(e) {
|
57
|
+
if (e.data === 'navEscape') {
|
58
|
+
$('#nav').slideUp(100);
|
59
|
+
$('#search a').removeClass('active inactive');
|
60
|
+
$(window).focus();
|
61
|
+
}
|
62
|
+
});
|
63
|
+
|
64
|
+
$(window).resize(function() {
|
65
|
+
if ($('#search:visible').length === 0) {
|
66
|
+
$('#nav').removeAttr('style');
|
67
|
+
$('#search a').removeClass('active inactive');
|
68
|
+
$(window).focus();
|
69
|
+
}
|
70
|
+
});
|
71
|
+
}
|
72
|
+
|
73
|
+
function toggleSearchFrame(id, link) {
|
74
|
+
var frame = $('#nav');
|
75
|
+
$('#search a').removeClass('active').addClass('inactive');
|
76
|
+
if (frame.attr('src') === link && frame.css('display') !== "none") {
|
77
|
+
frame.slideUp(100);
|
78
|
+
$('#search a').removeClass('active inactive');
|
79
|
+
}
|
80
|
+
else {
|
81
|
+
$(id).addClass('active').removeClass('inactive');
|
82
|
+
if (frame.attr('src') !== link) frame.attr('src', link);
|
83
|
+
frame.slideDown(100);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
function linkSummaries() {
|
88
|
+
$('.summary_signature').click(function() {
|
89
|
+
document.location = $(this).find('a').attr('href');
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
function summaryToggle() {
|
94
|
+
$('.summary_toggle').click(function(e) {
|
95
|
+
e.preventDefault();
|
96
|
+
localStorage.summaryCollapsed = $(this).text();
|
97
|
+
$('.summary_toggle').each(function() {
|
98
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
99
|
+
var next = $(this).parent().parent().nextAll('ul.summary').first();
|
100
|
+
if (next.hasClass('compact')) {
|
101
|
+
next.toggle();
|
102
|
+
next.nextAll('ul.summary').first().toggle();
|
103
|
+
}
|
104
|
+
else if (next.hasClass('summary')) {
|
105
|
+
var list = $('<ul class="summary compact" />');
|
106
|
+
list.html(next.html());
|
107
|
+
list.find('.summary_desc, .note').remove();
|
108
|
+
list.find('a').each(function() {
|
109
|
+
$(this).html($(this).find('strong').html());
|
110
|
+
$(this).parent().html($(this)[0].outerHTML);
|
111
|
+
});
|
112
|
+
next.before(list);
|
113
|
+
next.toggle();
|
114
|
+
}
|
115
|
+
});
|
116
|
+
return false;
|
117
|
+
});
|
118
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
119
|
+
$('.summary_toggle').first().click();
|
120
|
+
} else { localStorage.summaryCollapsed = "expand"; }
|
121
|
+
}
|
122
|
+
|
123
|
+
function constantSummaryToggle() {
|
124
|
+
$('.constants_summary_toggle').click(function(e) {
|
125
|
+
e.preventDefault();
|
126
|
+
localStorage.summaryCollapsed = $(this).text();
|
127
|
+
$('.constants_summary_toggle').each(function() {
|
128
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
129
|
+
var next = $(this).parent().parent().nextAll('dl.constants').first();
|
130
|
+
if (next.hasClass('compact')) {
|
131
|
+
next.toggle();
|
132
|
+
next.nextAll('dl.constants').first().toggle();
|
133
|
+
}
|
134
|
+
else if (next.hasClass('constants')) {
|
135
|
+
var list = $('<dl class="constants compact" />');
|
136
|
+
list.html(next.html());
|
137
|
+
list.find('dt').each(function() {
|
138
|
+
$(this).addClass('summary_signature');
|
139
|
+
$(this).text( $(this).text().split('=')[0]);
|
140
|
+
if ($(this).has(".deprecated").length) {
|
141
|
+
$(this).addClass('deprecated');
|
142
|
+
};
|
143
|
+
});
|
144
|
+
// Add the value of the constant as "Tooltip" to the summary object
|
145
|
+
list.find('pre.code').each(function() {
|
146
|
+
console.log($(this).parent());
|
147
|
+
var dt_element = $(this).parent().prev();
|
148
|
+
var tooltip = $(this).text();
|
149
|
+
if (dt_element.hasClass("deprecated")) {
|
150
|
+
tooltip = 'Deprecated. ' + tooltip;
|
151
|
+
};
|
152
|
+
dt_element.attr('title', tooltip);
|
153
|
+
});
|
154
|
+
list.find('.docstring, .tags, dd').remove();
|
155
|
+
next.before(list);
|
156
|
+
next.toggle();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
return false;
|
160
|
+
});
|
161
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
162
|
+
$('.constants_summary_toggle').first().click();
|
163
|
+
} else { localStorage.summaryCollapsed = "expand"; }
|
164
|
+
}
|
165
|
+
|
166
|
+
function generateTOC() {
|
167
|
+
if ($('#filecontents').length === 0) return;
|
168
|
+
var _toc = $('<ol class="top"></ol>');
|
169
|
+
var show = false;
|
170
|
+
var toc = _toc;
|
171
|
+
var counter = 0;
|
172
|
+
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
173
|
+
var i;
|
174
|
+
var curli;
|
175
|
+
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
176
|
+
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
177
|
+
var lastTag = parseInt(tags[0][1], 10);
|
178
|
+
$(tags.join(', ')).each(function() {
|
179
|
+
if ($(this).parents('.method_details .docstring').length != 0) return;
|
180
|
+
if (this.id == "filecontents") return;
|
181
|
+
show = true;
|
182
|
+
var thisTag = parseInt(this.tagName[1], 10);
|
183
|
+
if (this.id.length === 0) {
|
184
|
+
var proposedId = $(this).attr('toc-id');
|
185
|
+
if (typeof(proposedId) != "undefined") this.id = proposedId;
|
186
|
+
else {
|
187
|
+
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
|
188
|
+
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
|
189
|
+
this.id = proposedId;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
if (thisTag > lastTag) {
|
193
|
+
for (i = 0; i < thisTag - lastTag; i++) {
|
194
|
+
if ( typeof(curli) == "undefined" ) {
|
195
|
+
curli = $('<li/>');
|
196
|
+
toc.append(curli);
|
197
|
+
}
|
198
|
+
toc = $('<ol/>');
|
199
|
+
curli.append(toc);
|
200
|
+
curli = undefined;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
if (thisTag < lastTag) {
|
204
|
+
for (i = 0; i < lastTag - thisTag; i++) {
|
205
|
+
toc = toc.parent();
|
206
|
+
toc = toc.parent();
|
207
|
+
}
|
208
|
+
}
|
209
|
+
var title = $(this).attr('toc-title');
|
210
|
+
if (typeof(title) == "undefined") title = $(this).text();
|
211
|
+
curli =$('<li><a href="#' + this.id + '">' + title + '</a></li>');
|
212
|
+
toc.append(curli);
|
213
|
+
lastTag = thisTag;
|
214
|
+
});
|
215
|
+
if (!show) return;
|
216
|
+
html = '<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>';
|
217
|
+
$('#content').prepend(html);
|
218
|
+
$('#toc').append(_toc);
|
219
|
+
$('#toc .hide_toc').toggle(function() {
|
220
|
+
$('#toc .top').slideUp('fast');
|
221
|
+
$('#toc').toggleClass('hidden');
|
222
|
+
$('#toc .title small').toggle();
|
223
|
+
}, function() {
|
224
|
+
$('#toc .top').slideDown('fast');
|
225
|
+
$('#toc').toggleClass('hidden');
|
226
|
+
$('#toc .title small').toggle();
|
227
|
+
});
|
228
|
+
}
|
229
|
+
|
230
|
+
function navResizeFn(e) {
|
231
|
+
if (e.which !== 1) {
|
232
|
+
navResizeFnStop();
|
233
|
+
return;
|
234
|
+
}
|
235
|
+
|
236
|
+
sessionStorage.navWidth = e.pageX.toString();
|
237
|
+
$('.nav_wrap').css('width', e.pageX);
|
238
|
+
$('.nav_wrap').css('-ms-flex', 'inherit');
|
239
|
+
}
|
240
|
+
|
241
|
+
function navResizeFnStop() {
|
242
|
+
$(window).unbind('mousemove', navResizeFn);
|
243
|
+
window.removeEventListener('message', navMessageFn, false);
|
244
|
+
}
|
245
|
+
|
246
|
+
function navMessageFn(e) {
|
247
|
+
if (e.data.action === 'mousemove') navResizeFn(e.data.event);
|
248
|
+
if (e.data.action === 'mouseup') navResizeFnStop();
|
249
|
+
}
|
250
|
+
|
251
|
+
function navResizer() {
|
252
|
+
$('#resizer').mousedown(function(e) {
|
253
|
+
e.preventDefault();
|
254
|
+
$(window).mousemove(navResizeFn);
|
255
|
+
window.addEventListener('message', navMessageFn, false);
|
256
|
+
});
|
257
|
+
$(window).mouseup(navResizeFnStop);
|
258
|
+
|
259
|
+
if (sessionStorage.navWidth) {
|
260
|
+
navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)});
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
function navExpander() {
|
265
|
+
var done = false, timer = setTimeout(postMessage, 500);
|
266
|
+
function postMessage() {
|
267
|
+
if (done) return;
|
268
|
+
clearTimeout(timer);
|
269
|
+
var opts = { action: 'expand', path: pathId };
|
270
|
+
document.getElementById('nav').contentWindow.postMessage(opts, '*');
|
271
|
+
done = true;
|
272
|
+
}
|
273
|
+
|
274
|
+
window.addEventListener('message', function(event) {
|
275
|
+
if (event.data === 'navReady') postMessage();
|
276
|
+
return false;
|
277
|
+
}, false);
|
278
|
+
}
|
279
|
+
|
280
|
+
function mainFocus() {
|
281
|
+
var hash = window.location.hash;
|
282
|
+
if (hash !== '' && $(hash)[0]) {
|
283
|
+
$(hash)[0].scrollIntoView();
|
284
|
+
}
|
285
|
+
|
286
|
+
setTimeout(function() { $('#main').focus(); }, 10);
|
287
|
+
}
|
288
|
+
|
289
|
+
function navigationChange() {
|
290
|
+
// This works around the broken anchor navigation with the YARD template.
|
291
|
+
window.onpopstate = function() {
|
292
|
+
var hash = window.location.hash;
|
293
|
+
if (hash !== '' && $(hash)[0]) {
|
294
|
+
$(hash)[0].scrollIntoView();
|
295
|
+
}
|
296
|
+
};
|
297
|
+
}
|
298
|
+
|
299
|
+
$(document).ready(function() {
|
300
|
+
navResizer();
|
301
|
+
navExpander();
|
302
|
+
createSourceLinks();
|
303
|
+
createDefineLinks();
|
304
|
+
createFullTreeLinks();
|
305
|
+
searchFrameButtons();
|
306
|
+
linkSummaries();
|
307
|
+
summaryToggle();
|
308
|
+
constantSummaryToggle();
|
309
|
+
generateTOC();
|
310
|
+
mainFocus();
|
311
|
+
navigationChange();
|
312
|
+
});
|
313
|
+
|
314
|
+
})();
|