na 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +35 -0
- data/README.rdoc +6 -0
- data/Rakefile +31 -0
- data/bin/na +285 -0
- data/html/App.html +105 -0
- data/html/NA/Action.html +299 -0
- data/html/NA/Color.html +373 -0
- data/html/NA.html +100 -0
- data/html/README_rdoc.html +328 -0
- data/html/String.html +368 -0
- data/html/created.rid +9 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +639 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +297 -0
- data/html/js/darkfish.js +84 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +237 -0
- data/lib/na/action.rb +65 -0
- data/lib/na/colors.rb +335 -0
- data/lib/na/next_action.rb +181 -0
- data/lib/na/string.rb +42 -0
- data/lib/na/version.rb +3 -0
- data/lib/na.rb +11 -0
- data/na.gemspec +26 -0
- data/na.rdoc +167 -0
- metadata +211 -0
data/html/index.html
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>Your application title</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="file">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
|
40
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
41
|
+
<form action="#" method="get" accept-charset="utf-8">
|
42
|
+
<div id="search-field-wrapper">
|
43
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
44
|
+
aria-autocomplete="list" aria-controls="search-results"
|
45
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
46
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<ul id="search-results" aria-label="Search Results"
|
50
|
+
aria-busy="false" aria-expanded="false"
|
51
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
52
|
+
</form>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="project-metadata">
|
58
|
+
|
59
|
+
<div id="fileindex-section" class="nav-section">
|
60
|
+
<h3>Pages</h3>
|
61
|
+
|
62
|
+
<ul class="link-list">
|
63
|
+
<li><a href="./README_rdoc.html">README</a>
|
64
|
+
</ul>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<div id="classindex-section" class="nav-section">
|
68
|
+
<h3>Class and Module Index</h3>
|
69
|
+
|
70
|
+
<ul class="link-list">
|
71
|
+
<li><a href="./App.html">App</a>
|
72
|
+
<li><a href="./NA.html">NA</a>
|
73
|
+
<li><a href="./NA/Action.html">NA::Action</a>
|
74
|
+
<li><a href="./NA/Color.html">NA::Color</a>
|
75
|
+
<li><a href="./Na.html">Na</a>
|
76
|
+
<li><a href="./String.html">String</a>
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main">
|
84
|
+
|
85
|
+
|
86
|
+
<h1 id="label-na">na<span><a href="#label-na">¶</a> <a href="#top">↑</a></span></h1>
|
87
|
+
|
88
|
+
<p>A command line tool for adding and listing project todos in TaskPaper format.</p>
|
89
|
+
|
90
|
+
<h2 id="label-na+-+Add+and+list+next+actions+for+the+current+project">na - Add and list next actions for the current project<span><a href="#label-na+-+Add+and+list+next+actions+for+the+current+project">¶</a> <a href="#top">↑</a></span></h2>
|
91
|
+
|
92
|
+
<p>v1.0.0</p>
|
93
|
+
|
94
|
+
<h3 id="label-Global+Options">Global Options<span><a href="#label-Global+Options">¶</a> <a href="#top">↑</a></span></h3>
|
95
|
+
|
96
|
+
<h3 id="label-d-7C--depth+DEPTH">-d|–depth DEPTH<span><a href="#label-d-7C--depth+DEPTH">¶</a> <a href="#top">↑</a></span></h3>
|
97
|
+
|
98
|
+
<p>Recurse to depth</p>
|
99
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
100
|
+
<dd>
|
101
|
+
<p>1</p>
|
102
|
+
</dd><dt>Must Match
|
103
|
+
<dd>
|
104
|
+
<p>(?-mix:^d+$)</p>
|
105
|
+
</dd></dl>
|
106
|
+
|
107
|
+
<h3 id="label--ext+FILE_EXTENSION">–ext FILE_EXTENSION<span><a href="#label--ext+FILE_EXTENSION">¶</a> <a href="#top">↑</a></span></h3>
|
108
|
+
|
109
|
+
<p>File extension to consider a todo file</p>
|
110
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
111
|
+
<dd>
|
112
|
+
<p>taskpaper</p>
|
113
|
+
</dd></dl>
|
114
|
+
|
115
|
+
<h3 id="label--na_tag+TAG">–na_tag TAG<span><a href="#label--na_tag+TAG">¶</a> <a href="#top">↑</a></span></h3>
|
116
|
+
|
117
|
+
<p>Tag to consider a next action</p>
|
118
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
119
|
+
<dd>
|
120
|
+
<p>na</p>
|
121
|
+
</dd></dl>
|
122
|
+
|
123
|
+
<h3 id="label-p-7C--priority+PRIORITY">-p|–priority PRIORITY<span><a href="#label-p-7C--priority+PRIORITY">¶</a> <a href="#top">↑</a></span></h3>
|
124
|
+
|
125
|
+
<p>Set a priority 0-5 (deprecated, for backwards compatibility)</p>
|
126
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
127
|
+
<dd>
|
128
|
+
<p>None</p>
|
129
|
+
</dd></dl>
|
130
|
+
|
131
|
+
<h3 id="label-a-7C--add">-<a href="no-">a|–</a>add<span><a href="#label-a-7C--add">¶</a> <a href="#top">↑</a></span></h3>
|
132
|
+
|
133
|
+
<p>Add a next action (deprecated, for backwards compatibility)</p>
|
134
|
+
|
135
|
+
<h3 id="label--help">–help<span><a href="#label--help">¶</a> <a href="#top">↑</a></span></h3>
|
136
|
+
|
137
|
+
<p>Show this message</p>
|
138
|
+
|
139
|
+
<h3 id="label-n-7C--note">-<a href="no-">n|–</a>note<span><a href="#label-n-7C--note">¶</a> <a href="#top">↑</a></span></h3>
|
140
|
+
|
141
|
+
<p>Prompt for additional notes (deprecated, for backwards compatibility)</p>
|
142
|
+
|
143
|
+
<h3 id="label-r-7C--recurse">-<a href="no-">r|–</a>recurse<span><a href="#label-r-7C--recurse">¶</a> <a href="#top">↑</a></span></h3>
|
144
|
+
|
145
|
+
<p>Recurse 3 directories deep (deprecated, for backwards compatability)</p>
|
146
|
+
|
147
|
+
<h3 id="label--version">–version<span><a href="#label--version">¶</a> <a href="#top">↑</a></span></h3>
|
148
|
+
|
149
|
+
<p>Display the program version</p>
|
150
|
+
|
151
|
+
<h3 id="label-Commands">Commands<span><a href="#label-Commands">¶</a> <a href="#top">↑</a></span></h3>
|
152
|
+
|
153
|
+
<h4 id="label-Command-3A+add++TASK">Command: <code>add TASK</code><span><a href="#label-Command-3A+add++TASK">¶</a> <a href="#top">↑</a></span></h4>
|
154
|
+
|
155
|
+
<p>Add a new next action</p>
|
156
|
+
|
157
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
158
|
+
|
159
|
+
<h5 id="label-f-7C--file+PATH">-f|–file PATH<span><a href="#label-f-7C--file+PATH">¶</a> <a href="#top">↑</a></span></h5>
|
160
|
+
|
161
|
+
<p>Specify the file to which the task should be added</p>
|
162
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
163
|
+
<dd>
|
164
|
+
<p>None</p>
|
165
|
+
</dd></dl>
|
166
|
+
|
167
|
+
<h5 id="label-p-7C--priority+arg">-p|–priority arg<span><a href="#label-p-7C--priority+arg">¶</a> <a href="#top">↑</a></span></h5>
|
168
|
+
|
169
|
+
<p>Add a priority level 1-5</p>
|
170
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
171
|
+
<dd>
|
172
|
+
<p>0</p>
|
173
|
+
</dd><dt>Must Match
|
174
|
+
<dd>
|
175
|
+
<p>(?-<a href="1-5">mix:</a>)</p>
|
176
|
+
</dd></dl>
|
177
|
+
|
178
|
+
<h5 id="label-t-7C--tag+TAG">-t|–tag TAG<span><a href="#label-t-7C--tag+TAG">¶</a> <a href="#top">↑</a></span></h5>
|
179
|
+
|
180
|
+
<p>Use a tag other than the default next action tag</p>
|
181
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
182
|
+
<dd>
|
183
|
+
<p>None</p>
|
184
|
+
</dd></dl>
|
185
|
+
|
186
|
+
<h5 id="label-n-7C--note">-<a href="no-">n|–</a>note<span><a href="#label-n-7C--note">¶</a> <a href="#top">↑</a></span></h5>
|
187
|
+
|
188
|
+
<p>Prompt for additional notes</p>
|
189
|
+
|
190
|
+
<h4 id="label-Command-3A+find++PATTERN">Command: <code>find PATTERN</code><span><a href="#label-Command-3A+find++PATTERN">¶</a> <a href="#top">↑</a></span></h4>
|
191
|
+
|
192
|
+
<p>Find actions matching a search pattern</p>
|
193
|
+
|
194
|
+
<p>Search tokens are separated by spaces. Actions matching any token in the pattern will be shown</p>
|
195
|
+
|
196
|
+
<pre>(partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`</pre>
|
197
|
+
|
198
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
199
|
+
|
200
|
+
<h5 id="label-d-7C--depth+DEPTH">-d|–depth DEPTH<span><a href="#label-d-7C--depth+DEPTH">¶</a> <a href="#top">↑</a></span></h5>
|
201
|
+
|
202
|
+
<p>Recurse to depth</p>
|
203
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
204
|
+
<dd>
|
205
|
+
<p>1</p>
|
206
|
+
</dd><dt>Must Match
|
207
|
+
<dd>
|
208
|
+
<p>(?-mix:^d+$)</p>
|
209
|
+
</dd></dl>
|
210
|
+
|
211
|
+
<h5 id="label-x-7C--exact">-<a href="no-">x|–</a>exact<span><a href="#label-x-7C--exact">¶</a> <a href="#top">↑</a></span></h5>
|
212
|
+
|
213
|
+
<p>Match pattern exactly</p>
|
214
|
+
|
215
|
+
<h4 id="label-Command-3A+help++command">Command: <code>help command</code><span><a href="#label-Command-3A+help++command">¶</a> <a href="#top">↑</a></span></h4>
|
216
|
+
|
217
|
+
<p>Shows a list of commands or help for one command</p>
|
218
|
+
|
219
|
+
<p>Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function</p>
|
220
|
+
|
221
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
222
|
+
|
223
|
+
<h5 id="label-c">-c<span><a href="#label-c">¶</a> <a href="#top">↑</a></span></h5>
|
224
|
+
|
225
|
+
<p>List commands one per line, to assist with shell completion</p>
|
226
|
+
|
227
|
+
<h4 id="label-Command-3A+initconfig+">Command: <code>initconfig </code><span><a href="#label-Command-3A+initconfig+">¶</a> <a href="#top">↑</a></span></h4>
|
228
|
+
|
229
|
+
<p>Initialize the config file using current global options</p>
|
230
|
+
|
231
|
+
<p>Initializes a configuration file where you can set default options for command line flags, both globally and on a per-command basis. These defaults override the built-in defaults and allow you to omit commonly-used command line flags when invoking this program</p>
|
232
|
+
|
233
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
234
|
+
|
235
|
+
<h5 id="label---5Bno--5Dforce">–[no-]force<span><a href="#label---5Bno--5Dforce">¶</a> <a href="#top">↑</a></span></h5>
|
236
|
+
|
237
|
+
<p>force overwrite of existing config file</p>
|
238
|
+
|
239
|
+
<h4 id="label-Command-3A+next-7Cshow+">Command: <code>next|show </code><span><a href="#label-Command-3A+next-7Cshow+">¶</a> <a href="#top">↑</a></span></h4>
|
240
|
+
|
241
|
+
<p>Show next actions</p>
|
242
|
+
|
243
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
244
|
+
|
245
|
+
<h5 id="label-d-7C--depth+DEPTH">-d|–depth DEPTH<span><a href="#label-d-7C--depth+DEPTH">¶</a> <a href="#top">↑</a></span></h5>
|
246
|
+
|
247
|
+
<p>Recurse to depth</p>
|
248
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
249
|
+
<dd>
|
250
|
+
<p>None</p>
|
251
|
+
</dd><dt>Must Match
|
252
|
+
<dd>
|
253
|
+
<p>(?-mix:^d+$)</p>
|
254
|
+
</dd></dl>
|
255
|
+
|
256
|
+
<h5 id="label-t-7C--tag+arg">-t|–tag arg<span><a href="#label-t-7C--tag+arg">¶</a> <a href="#top">↑</a></span></h5>
|
257
|
+
|
258
|
+
<p>Alternate tag to search for</p>
|
259
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
260
|
+
<dd>
|
261
|
+
<p>na</p>
|
262
|
+
</dd></dl>
|
263
|
+
|
264
|
+
<h4 id="label-Command-3A+tagged++TAG+-5BVALUE-5D">Command: <code>tagged TAG [VALUE]</code><span><a href="#label-Command-3A+tagged++TAG+-5BVALUE-5D">¶</a> <a href="#top">↑</a></span></h4>
|
265
|
+
|
266
|
+
<p>Find actions matching a tag</p>
|
267
|
+
|
268
|
+
<p>Finds actions with tags matching the arguments. An action is shown if it</p>
|
269
|
+
|
270
|
+
<pre>contains any of the tags listed. Add a + before a tag to make it required,
|
271
|
+
e.g. `na tagged feature +maybe`</pre>
|
272
|
+
|
273
|
+
<h5 id="label-Options">Options<span><a href="#label-Options">¶</a> <a href="#top">↑</a></span></h5>
|
274
|
+
|
275
|
+
<h5 id="label-d-7C--depth+DEPTH">-d|–depth DEPTH<span><a href="#label-d-7C--depth+DEPTH">¶</a> <a href="#top">↑</a></span></h5>
|
276
|
+
|
277
|
+
<p>Recurse to depth</p>
|
278
|
+
<dl class="rdoc-list label-list"><dt>Default Value
|
279
|
+
<dd>
|
280
|
+
<p>1</p>
|
281
|
+
</dd><dt>Must Match
|
282
|
+
<dd>
|
283
|
+
<p>(?-mix:^d+$)</p>
|
284
|
+
</dd><dt>Default Command
|
285
|
+
<dd>
|
286
|
+
<p>next</p>
|
287
|
+
</dd></dl>
|
288
|
+
|
289
|
+
</main>
|
290
|
+
|
291
|
+
|
292
|
+
<footer id="validator-badges" role="contentinfo">
|
293
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
294
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.3.3.
|
295
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
296
|
+
</footer>
|
297
|
+
|
data/html/js/darkfish.js
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/**
|
2
|
+
*
|
3
|
+
* Darkfish Page Functions
|
4
|
+
* $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
|
5
|
+
*
|
6
|
+
* Author: Michael Granger <mgranger@laika.com>
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
|
10
|
+
/* Provide console simulation for firebug-less environments */
|
11
|
+
/*
|
12
|
+
if (!("console" in window) || !("firebug" in console)) {
|
13
|
+
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
14
|
+
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
15
|
+
|
16
|
+
window.console = {};
|
17
|
+
for (var i = 0; i < names.length; ++i)
|
18
|
+
window.console[names[i]] = function() {};
|
19
|
+
};
|
20
|
+
*/
|
21
|
+
|
22
|
+
|
23
|
+
function showSource( e ) {
|
24
|
+
var target = e.target;
|
25
|
+
while (!target.classList.contains('method-detail')) {
|
26
|
+
target = target.parentNode;
|
27
|
+
}
|
28
|
+
if (typeof target !== "undefined" && target !== null) {
|
29
|
+
target = target.querySelector('.method-source-code');
|
30
|
+
}
|
31
|
+
if (typeof target !== "undefined" && target !== null) {
|
32
|
+
target.classList.toggle('active-menu')
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
function hookSourceViews() {
|
37
|
+
document.querySelectorAll('.method-heading').forEach(function (codeObject) {
|
38
|
+
codeObject.addEventListener('click', showSource);
|
39
|
+
});
|
40
|
+
};
|
41
|
+
|
42
|
+
function hookSearch() {
|
43
|
+
var input = document.querySelector('#search-field');
|
44
|
+
var result = document.querySelector('#search-results');
|
45
|
+
result.classList.remove("initially-hidden");
|
46
|
+
|
47
|
+
var search_section = document.querySelector('#search-section');
|
48
|
+
search_section.classList.remove("initially-hidden");
|
49
|
+
|
50
|
+
var search = new Search(search_data, input, result);
|
51
|
+
|
52
|
+
search.renderItem = function(result) {
|
53
|
+
var li = document.createElement('li');
|
54
|
+
var html = '';
|
55
|
+
|
56
|
+
// TODO add relative path to <script> per-page
|
57
|
+
html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
|
58
|
+
if (result.params)
|
59
|
+
html += '<span class="params">' + result.params + '</span>';
|
60
|
+
html += '</a>';
|
61
|
+
|
62
|
+
|
63
|
+
if (result.namespace)
|
64
|
+
html += '<p class="search-namespace">' + this.hlt(result.namespace);
|
65
|
+
|
66
|
+
if (result.snippet)
|
67
|
+
html += '<div class="search-snippet">' + result.snippet + '</div>';
|
68
|
+
|
69
|
+
li.innerHTML = html;
|
70
|
+
|
71
|
+
return li;
|
72
|
+
}
|
73
|
+
|
74
|
+
search.select = function(result) {
|
75
|
+
window.location.href = result.firstChild.firstChild.href;
|
76
|
+
}
|
77
|
+
|
78
|
+
search.scrollIntoView = search.scrollInWindow;
|
79
|
+
};
|
80
|
+
|
81
|
+
document.addEventListener('DOMContentLoaded', function() {
|
82
|
+
hookSourceViews();
|
83
|
+
hookSearch();
|
84
|
+
});
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/*
|
2
|
+
* Navigation allows movement using the arrow keys through the search results.
|
3
|
+
*
|
4
|
+
* When using this library you will need to set scrollIntoView to the
|
5
|
+
* appropriate function for your layout. Use scrollInWindow if the container
|
6
|
+
* is not scrollable and scrollInElement if the container is a separate
|
7
|
+
* scrolling region.
|
8
|
+
*/
|
9
|
+
Navigation = new function() {
|
10
|
+
this.initNavigation = function() {
|
11
|
+
var _this = this;
|
12
|
+
|
13
|
+
document.addEventListener('keydown', function(e) {
|
14
|
+
_this.onkeydown(e);
|
15
|
+
});
|
16
|
+
|
17
|
+
this.navigationActive = true;
|
18
|
+
}
|
19
|
+
|
20
|
+
this.setNavigationActive = function(state) {
|
21
|
+
this.navigationActive = state;
|
22
|
+
}
|
23
|
+
|
24
|
+
this.onkeydown = function(e) {
|
25
|
+
if (!this.navigationActive) return;
|
26
|
+
switch(e.keyCode) {
|
27
|
+
case 37: //Event.KEY_LEFT:
|
28
|
+
if (this.moveLeft()) e.preventDefault();
|
29
|
+
break;
|
30
|
+
case 38: //Event.KEY_UP:
|
31
|
+
if (e.keyCode == 38 || e.ctrlKey) {
|
32
|
+
if (this.moveUp()) e.preventDefault();
|
33
|
+
}
|
34
|
+
break;
|
35
|
+
case 39: //Event.KEY_RIGHT:
|
36
|
+
if (this.moveRight()) e.preventDefault();
|
37
|
+
break;
|
38
|
+
case 40: //Event.KEY_DOWN:
|
39
|
+
if (e.keyCode == 40 || e.ctrlKey) {
|
40
|
+
if (this.moveDown()) e.preventDefault();
|
41
|
+
}
|
42
|
+
break;
|
43
|
+
case 13: //Event.KEY_RETURN:
|
44
|
+
if (this.current) e.preventDefault();
|
45
|
+
this.select(this.current);
|
46
|
+
break;
|
47
|
+
}
|
48
|
+
if (e.ctrlKey && e.shiftKey) this.select(this.current);
|
49
|
+
}
|
50
|
+
|
51
|
+
this.moveRight = function() {
|
52
|
+
}
|
53
|
+
|
54
|
+
this.moveLeft = function() {
|
55
|
+
}
|
56
|
+
|
57
|
+
this.move = function(isDown) {
|
58
|
+
}
|
59
|
+
|
60
|
+
this.moveUp = function() {
|
61
|
+
return this.move(false);
|
62
|
+
}
|
63
|
+
|
64
|
+
this.moveDown = function() {
|
65
|
+
return this.move(true);
|
66
|
+
}
|
67
|
+
|
68
|
+
/*
|
69
|
+
* Scrolls to the given element in the scrollable element view.
|
70
|
+
*/
|
71
|
+
this.scrollInElement = function(element, view) {
|
72
|
+
var offset, viewHeight, viewScroll, height;
|
73
|
+
offset = element.offsetTop;
|
74
|
+
height = element.offsetHeight;
|
75
|
+
viewHeight = view.offsetHeight;
|
76
|
+
viewScroll = view.scrollTop;
|
77
|
+
|
78
|
+
if (offset - viewScroll + height > viewHeight) {
|
79
|
+
view.scrollTop = offset - viewHeight + height;
|
80
|
+
}
|
81
|
+
if (offset < viewScroll) {
|
82
|
+
view.scrollTop = offset;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
/*
|
87
|
+
* Scrolls to the given element in the window. The second argument is
|
88
|
+
* ignored
|
89
|
+
*/
|
90
|
+
this.scrollInWindow = function(element, ignored) {
|
91
|
+
var offset, viewHeight, viewScroll, height;
|
92
|
+
offset = element.offsetTop;
|
93
|
+
height = element.offsetHeight;
|
94
|
+
viewHeight = window.innerHeight;
|
95
|
+
viewScroll = window.scrollY;
|
96
|
+
|
97
|
+
if (offset - viewScroll + height > viewHeight) {
|
98
|
+
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
99
|
+
}
|
100
|
+
if (offset < viewScroll) {
|
101
|
+
window.scrollTo(window.scrollX, offset);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
Binary file
|
data/html/js/search.js
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
Search = function(data, input, result) {
|
2
|
+
this.data = data;
|
3
|
+
this.input = input;
|
4
|
+
this.result = result;
|
5
|
+
|
6
|
+
this.current = null;
|
7
|
+
this.view = this.result.parentNode;
|
8
|
+
this.searcher = new Searcher(data.index);
|
9
|
+
this.init();
|
10
|
+
}
|
11
|
+
|
12
|
+
Search.prototype = Object.assign({}, Navigation, new function() {
|
13
|
+
var suid = 1;
|
14
|
+
|
15
|
+
this.init = function() {
|
16
|
+
var _this = this;
|
17
|
+
var observer = function(e) {
|
18
|
+
switch(e.keyCode) {
|
19
|
+
case 38: // Event.KEY_UP
|
20
|
+
case 40: // Event.KEY_DOWN
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
_this.search(_this.input.value);
|
24
|
+
};
|
25
|
+
this.input.addEventListener('keyup', observer);
|
26
|
+
this.input.addEventListener('click', observer); // mac's clear field
|
27
|
+
|
28
|
+
this.searcher.ready(function(results, isLast) {
|
29
|
+
_this.addResults(results, isLast);
|
30
|
+
})
|
31
|
+
|
32
|
+
this.initNavigation();
|
33
|
+
this.setNavigationActive(false);
|
34
|
+
}
|
35
|
+
|
36
|
+
this.search = function(value, selectFirstMatch) {
|
37
|
+
value = value.trim().toLowerCase();
|
38
|
+
if (value) {
|
39
|
+
this.setNavigationActive(true);
|
40
|
+
} else {
|
41
|
+
this.setNavigationActive(false);
|
42
|
+
}
|
43
|
+
|
44
|
+
if (value == '') {
|
45
|
+
this.lastQuery = value;
|
46
|
+
this.result.innerHTML = '';
|
47
|
+
this.result.setAttribute('aria-expanded', 'false');
|
48
|
+
this.setNavigationActive(false);
|
49
|
+
} else if (value != this.lastQuery) {
|
50
|
+
this.lastQuery = value;
|
51
|
+
this.result.setAttribute('aria-busy', 'true');
|
52
|
+
this.result.setAttribute('aria-expanded', 'true');
|
53
|
+
this.firstRun = true;
|
54
|
+
this.searcher.find(value);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
this.addResults = function(results, isLast) {
|
59
|
+
var target = this.result;
|
60
|
+
if (this.firstRun && (results.length > 0 || isLast)) {
|
61
|
+
this.current = null;
|
62
|
+
this.result.innerHTML = '';
|
63
|
+
}
|
64
|
+
|
65
|
+
for (var i=0, l = results.length; i < l; i++) {
|
66
|
+
var item = this.renderItem.call(this, results[i]);
|
67
|
+
item.setAttribute('id', 'search-result-' + target.childElementCount);
|
68
|
+
target.appendChild(item);
|
69
|
+
};
|
70
|
+
|
71
|
+
if (this.firstRun && results.length > 0) {
|
72
|
+
this.firstRun = false;
|
73
|
+
this.current = target.firstChild;
|
74
|
+
this.current.classList.add('search-selected');
|
75
|
+
}
|
76
|
+
//TODO: ECMAScript
|
77
|
+
//if (jQuery.browser.msie) this.$element[0].className += '';
|
78
|
+
|
79
|
+
if (isLast) this.result.setAttribute('aria-busy', 'false');
|
80
|
+
}
|
81
|
+
|
82
|
+
this.move = function(isDown) {
|
83
|
+
if (!this.current) return;
|
84
|
+
var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
|
85
|
+
if (next) {
|
86
|
+
this.current.classList.remove('search-selected');
|
87
|
+
next.classList.add('search-selected');
|
88
|
+
this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
|
89
|
+
this.scrollIntoView(next, this.view);
|
90
|
+
this.current = next;
|
91
|
+
this.input.value = next.firstChild.firstChild.text;
|
92
|
+
this.input.select();
|
93
|
+
}
|
94
|
+
return true;
|
95
|
+
}
|
96
|
+
|
97
|
+
this.hlt = function(html) {
|
98
|
+
return this.escapeHTML(html).
|
99
|
+
replace(/\u0001/g, '<em>').
|
100
|
+
replace(/\u0002/g, '</em>');
|
101
|
+
}
|
102
|
+
|
103
|
+
this.escapeHTML = function(html) {
|
104
|
+
return html.replace(/[&<>]/g, function(c) {
|
105
|
+
return '&#' + c.charCodeAt(0) + ';';
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
});
|
110
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
var search_data = {"index":{"searchIndex":["app","na","action","color","na","string","add_action()","attributes()","choose_from()","coloring()","coloring?()","create_todo()","find_files()","highlight_tags()","indent_level()","inspect()","last_color_code()","matches()","matches_all()","matches_any()","new()","normalize_color()","output_actions()","parse_actions()","pretty()","rgb()","select_file()","support?()","template()","to_s()","uncolor()","validate_color()","readme"],"longSearchIndex":["app","na","na::action","na::color","na","string","na::add_action()","na::color#attributes()","na::choose_from()","na::color::coloring()","na::color::coloring?()","na::create_todo()","na::find_files()","string#highlight_tags()","string#indent_level()","na::action#inspect()","string#last_color_code()","string#matches()","string#matches_all()","string#matches_any()","na::action::new()","string#normalize_color()","na::output_actions()","na::parse_actions()","na::action#pretty()","na::color#rgb()","na::select_file()","na::color#support?()","na::color::template()","na::action#to_s()","na::color#uncolor()","string#validate_color()",""],"info":[["App","","App.html","",""],["NA","","NA.html","","<p>Cribbed from <github.com/flori/term-ansicolor>\n<p>Next Action methods\n"],["NA::Action","","NA/Action.html","",""],["NA::Color","","NA/Color.html","","<p>Terminal output color functions.\n"],["Na","","Na.html","",""],["String","","String.html","","<p>Template coloring\n"],["add_action","NA","NA.html#method-c-add_action","(file, action, note = nil)",""],["attributes","NA::Color","NA/Color.html#method-i-attributes","()","<p>Returns an array of all NA::Color attributes as symbols.\n"],["choose_from","NA","NA.html#method-c-choose_from","(options, prompt: 'Make a selection: ', multiple: false, sorted: true, fzf_args: [])","<p>Generate a menu of options and allow user selection\n<p>@return [String] The selected option\n<p>@param …\n"],["coloring","NA::Color","NA/Color.html#method-c-coloring","()","<p>Enables colored output\n<p>@example Turn color on or off based on TTY\n\n<pre class=\"ruby\"><span class=\"ruby-constant\">NA</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Color</span>.<span class=\"ruby-identifier\">coloring</span> = <span class=\"ruby-constant\">STDOUT</span>.<span class=\"ruby-identifier\">isatty</span>\n</pre>\n"],["coloring?","NA::Color","NA/Color.html#method-c-coloring-3F","()","<p>Returns true if the coloring function of this module is switched on, false otherwise.\n"],["create_todo","NA","NA.html#method-c-create_todo","(target, basename)",""],["find_files","NA","NA.html#method-c-find_files","(depth: 1, extension: 'taskpaper')",""],["highlight_tags","String","String.html#method-i-highlight_tags","(color: '{m}', value: '{y}', parens: '{m}', last_color: '{g}')","<p>Colorize @tags with ANSI escapes\n<p>@param color [String] color (see #Color)\n<p>@return [String] string …\n"],["indent_level","String","String.html#method-i-indent_level","()",""],["inspect","NA::Action","NA/Action.html#method-i-inspect","()",""],["last_color_code","String","String.html#method-i-last_color_code","()","<p>Get the calculated ANSI color at the end of the string\n<p>@return ANSI escape sequence to match color …\n"],["matches","String","String.html#method-i-matches","(any: [], all: [])",""],["matches_all","String","String.html#method-i-matches_all","(regexes)",""],["matches_any","String","String.html#method-i-matches_any","(regexes)",""],["new","NA::Action","NA/Action.html#method-c-new","(file, project, parent, action)",""],["normalize_color","String","String.html#method-i-normalize_color","()","<p>Normalize a color name, removing underscores, replacing “bright” with “bold”, and …\n"],["output_actions","NA","NA.html#method-c-output_actions","(actions, depth, extension)",""],["parse_actions","NA","NA.html#method-c-parse_actions","(depth: 1, extension: 'taskpaper', na_tag: 'na', tag: nil, search: nil)",""],["pretty","NA::Action","NA/Action.html#method-i-pretty","(extension: 'taskpaper', template: {})",""],["rgb","NA::Color","NA/Color.html#method-i-rgb","(hex)","<p>Generate escape codes for hex colors\n<p>@param hex [String] The hexadecimal color code\n<p>@return …\n"],["select_file","NA","NA.html#method-c-select_file","(files)",""],["support?","NA::Color","NA/Color.html#method-i-support-3F","(feature)","<p>Returns true if NA::Color supports the <code>feature</code>.\n<p>The feature :clear, that is mixing the clear color attribute …\n"],["template","NA::Color","NA/Color.html#method-c-template","(input)","<p>Convert a template string to a colored string. Colors are specified with single letters inside curly …\n"],["to_s","NA::Action","NA/Action.html#method-i-to_s","()",""],["uncolor","NA::Color","NA/Color.html#method-i-uncolor","(string = nil)","<p>Returns an uncolored version of the string, that is all ANSI-sequences are stripped from the string. …\n"],["validate_color","String","String.html#method-i-validate_color","()","<p>Extract the longest valid %color name from a string.\n<p>Allows %colors to bleed into other text and still …\n"],["README","","README_rdoc.html","","<p>na\n<p>A command line tool for adding and listing project todos in TaskPaper format.\n<p>na - Add and list next …\n"]]}}
|
Binary file
|