bitwrench 1.2.15 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -158
- package/bin/bitwrench.js +3 -0
- package/dist/bitwrench-code-edit.cjs.js +639 -0
- package/dist/bitwrench-code-edit.es5.js +875 -0
- package/dist/bitwrench-code-edit.es5.min.js +15 -0
- package/dist/bitwrench-code-edit.esm.js +628 -0
- package/dist/bitwrench-code-edit.esm.min.js +15 -0
- package/dist/bitwrench-code-edit.umd.js +645 -0
- package/dist/bitwrench-code-edit.umd.min.js +15 -0
- package/dist/bitwrench.cjs.js +6983 -0
- package/dist/bitwrench.cjs.min.js +62 -0
- package/dist/bitwrench.css +5100 -0
- package/dist/bitwrench.es5.js +8446 -0
- package/dist/bitwrench.es5.min.js +31 -0
- package/dist/bitwrench.esm.js +6981 -0
- package/dist/bitwrench.esm.min.js +62 -0
- package/dist/bitwrench.umd.js +6989 -0
- package/dist/bitwrench.umd.min.js +62 -0
- package/dist/builds.json +127 -0
- package/dist/sri.json +18 -0
- package/package.json +86 -24
- package/readme.html +288 -0
- package/src/bitwrench-code-edit.js +627 -0
- package/src/bitwrench-color-utils.js +311 -0
- package/src/bitwrench-component-base.js +736 -0
- package/src/bitwrench-components-inline.js +374 -0
- package/src/bitwrench-components-v2.js +1879 -0
- package/src/bitwrench-components.js +610 -0
- package/src/bitwrench-styles.js +3240 -0
- package/src/bitwrench.js +3367 -0
- package/src/cli/convert.js +205 -0
- package/src/cli/index.js +122 -0
- package/src/cli/inject.js +55 -0
- package/src/cli/layout-default.js +142 -0
- package/src/generate-css.js +381 -0
- package/src/vendor/quikdown.js +654 -0
- package/src/version.js +16 -0
- package/.eslintrc.json +0 -27
- package/.github/workflows/codeql-analysis.yml +0 -72
- package/.travis.yml +0 -34
- package/bitwrench.css +0 -92
- package/bitwrench.js +0 -3348
- package/bitwrench.js_sri.txt +0 -1
- package/bitwrench.min.js +0 -1
- package/bitwrench.min.js_sri.txt +0 -1
- package/bitwrench_ESM.js +0 -3207
- package/dev/bitwrench-todo.md +0 -215
- package/dev/css-arrows.md +0 -23
- package/dev/docStringDev.js +0 -124
- package/dev/docStringParseDev.js +0 -171
- package/dev/figures.html +0 -37
- package/dev/html_gen.js +0 -349
- package/dev/htmld.md +0 -250
- package/dev/htmldev.html +0 -45
- package/dev/index-old.html +0 -87
- package/dev/misc-notes.md +0 -21
- package/dev/notes.md +0 -2
- package/dev/sizes.html +0 -49
- package/dev/universal-js-module.js +0 -37
- package/examples/example1.html +0 -78
- package/examples/example10.html +0 -84
- package/examples/example2.html +0 -44
- package/examples/example3.html +0 -50
- package/examples/example4.html +0 -22
- package/examples/example5.html +0 -82
- package/examples/example6.html +0 -128
- package/examples/example7.html +0 -91
- package/examples/example8.html +0 -27
- package/examples/example9.html +0 -102
- package/icon/bitwrench-dark-tall.png +0 -0
- package/icon/bitwrench-dark.png +0 -0
- package/icon/bitwrench-icon-lt-grey.png +0 -0
- package/icon/bitwrench-icon.vsd +0 -0
- package/icon/bitwrench-logo-dark.png +0 -0
- package/icon/bitwrench-logo-full.png +0 -0
- package/icon/bitwrench-logo-green.png +0 -0
- package/icon/bitwrench-logo-grey.png +0 -0
- package/icon/bitwrench-logo-white.png +0 -0
- package/icon/bitwrench-logos-colors.png +0 -0
- package/icon/bitwrench-thick-logo.png +0 -0
- package/icon/bitwrench-thick-teal/android-chrome-192x192.png +0 -0
- package/icon/bitwrench-thick-teal/android-chrome-512x512.png +0 -0
- package/icon/bitwrench-thick-teal/apple-touch-icon.png +0 -0
- package/icon/bitwrench-thick-teal/browserconfig.xml +0 -9
- package/icon/bitwrench-thick-teal/favicon-16x16.png +0 -0
- package/icon/bitwrench-thick-teal/favicon-32x32.png +0 -0
- package/icon/bitwrench-thick-teal/favicon.ico +0 -0
- package/icon/bitwrench-thick-teal/mstile-144x144.png +0 -0
- package/icon/bitwrench-thick-teal/mstile-150x150.png +0 -0
- package/icon/bitwrench-thick-teal/mstile-310x150.png +0 -0
- package/icon/bitwrench-thick-teal/mstile-310x310.png +0 -0
- package/icon/bitwrench-thick-teal/mstile-70x70.png +0 -0
- package/icon/bitwrench-thick-teal/site.webmanifest +0 -19
- package/icon/bitwrench-thick-teal.ico +0 -0
- package/icon/bitwrench-thick-teal.svg +0 -44
- package/icon/bitwrench-thick-teal.zip +0 -0
- package/icon/favicon-test.html +0 -20
- package/icon/logos-test.PNG +0 -0
- package/images/bitwrench-512x512.png +0 -0
- package/images/bitwrench-logo-med.png +0 -0
- package/images/bitwrench-thick-logo.png +0 -0
- package/images/bitwrench-thick-logo.svg +0 -64
- package/images/bitwrench-thick-teal.ico +0 -0
- package/images/favicon.ico +0 -0
- package/index.html +0 -256
- package/instr_tmp/bitwrench.js +0 -1350
- package/karma.conf.js +0 -140
- package/makefile +0 -21
- package/quick-docs.html +0 -206
- package/test/bitwrench_test.js +0 -1255
- package/test/karma-test.js +0 -1081
- package/tools/bw_deprecatedNames.js +0 -19
- package/tools/bwconsole.js +0 -20
- package/tools/createSimpleHTMLPage.js +0 -41
- package/tools/emitreadme.sh +0 -4
- package/tools/export-bw-default-css.js +0 -41
- package/tools/umd2ModuleHack.js +0 -32
- package/tools/update-bw-package.js +0 -36
- package/tools/updatereadme.js +0 -34
package/dev/bitwrench-todo.md
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
# bitwrench.js todo list
|
|
2
|
-
(c) 2012-2019 manu chatterjee
|
|
3
|
-
deftio (at) deftio (dot) com
|
|
4
|
-
|
|
5
|
-
This list is used for internal ideas, housekeeping, checklists and notes
|
|
6
|
-
|
|
7
|
-
## features
|
|
8
|
-
[x] typeOf
|
|
9
|
-
[x] getURLParam fails test case where URL param contains # character
|
|
10
|
-
[x] bw.html formelry buildHTMLObjecStr (note rename)
|
|
11
|
-
add pretty print option (prettyPrint : true) --> adds tabbed || space beginning, \n in output for readability.
|
|
12
|
-
[x] makeHTMLTable (also add sort, style examples)
|
|
13
|
-
[ ] support adding column headers to makeHTMLTable as option ==> {header_content: [,,,]}
|
|
14
|
-
[x] makeHTMLTabs()
|
|
15
|
-
[x] makeHTMLList() ==> bulleted or numerical list
|
|
16
|
-
[x] table HTML sort support (needs alpha num fix)
|
|
17
|
-
[x] get/save cookie
|
|
18
|
-
[x] save/store file
|
|
19
|
-
make params for JSON, CSV, function(provide parser), raw
|
|
20
|
-
[x] typeOf
|
|
21
|
-
[ ] prettyPrintJSON with stylizble CSS
|
|
22
|
-
settable tab widths (use padding:<width><units>)
|
|
23
|
-
allow prettyPrint of functions and member-functions
|
|
24
|
-
allow functions to print correctly
|
|
25
|
-
[o] find/set css class name on supplied element (bw.markElement) clean this up
|
|
26
|
-
[ ] encode/decode var info in to a CSS classname (see spannit.js)
|
|
27
|
-
[ ] find classes by encoded var name (returns array of hits)
|
|
28
|
-
note bw.markElement does some of this
|
|
29
|
-
[x] xformScaleSig #sigmoidal scale, linear, constrain (mapScale can do this)
|
|
30
|
-
[0] xformScalePow #power scale ==> remove
|
|
31
|
-
[ ] interp [NN,Lin, Cos] for arrays (e.g. simple resample, any # of dims)
|
|
32
|
-
[x] clip
|
|
33
|
-
[x] setIntervalX // rename repeatN() ?
|
|
34
|
-
[*] repeatUntil --> needs usability clean up
|
|
35
|
-
[x] randomNum in (x,y, float_or_int)
|
|
36
|
-
[x] pseudoRandom gen (prandom())
|
|
37
|
-
[ ] sha256 (can be used of psuedoRandom gen)
|
|
38
|
-
[x] multidim array quick generator
|
|
39
|
-
[x] loremIpsum quick generator
|
|
40
|
-
[x] bwSimpleStyles
|
|
41
|
-
[x] bwSimpleThemes -- note it should work on the examples / docs page w/o problems
|
|
42
|
-
use args (a.g. bwargs-loadSimpleTheme:themeIndex;
|
|
43
|
-
[x] docString()
|
|
44
|
-
support jsdoc style comments, export as JSON or prettyHTML
|
|
45
|
-
allow man style export e.g. doc string params ==> array of vars [] ==> nice text output
|
|
46
|
-
[x] simple logging control to a stream (e.g. bw.log(...) with settable function)
|
|
47
|
-
[x] isHexStr
|
|
48
|
-
[ ] graphMatrixAsImage (use canvas, also allow export as png)
|
|
49
|
-
[ ] save canvas as data:url (show example with save as button)
|
|
50
|
-
[x] color conversions, interpolate colors (used in themes, graphMatrix)
|
|
51
|
-
[x] command line processing via <script bwargs="arg1:val1;arg2:val2"> # also works from URL param, can be disabled here as well
|
|
52
|
-
[ ] simple boolean search of text object. (TBD: jado and frabjousmix support this)
|
|
53
|
-
[x] pad strings (used in logExport({exportFormat:"text"}))
|
|
54
|
-
[ ] bitwrench-server.js / bitwrench-server.php / bitwrench-server.py - simple server for receiving JSON encoded data
|
|
55
|
-
[x] in options (bw.html) allow non-closed tags e.g. bw.html(["meta",{keywords:"foo, bar"},null,{tagClose:false}]) // default is tagClose:true
|
|
56
|
-
[x] in options (bw.html) allow attribs with no value e.g. bw.html(["special tag", {type:"javascript", specialTag:null},null])
|
|
57
|
-
[x] in options (bw.html) null for content means no content e.g.g <tag></tag>
|
|
58
|
-
[ ] in makeCSS (pretty:false) remove "\n"
|
|
59
|
-
[ ] makeCSS, makeCSSRule ==> CSS CSSRuleEmit
|
|
60
|
-
|
|
61
|
-
## packaging and todo
|
|
62
|
-
[x] build script # currently using gnu make --> migrated to just using NPM
|
|
63
|
-
[ ] build script should fail building new package if either lint or tests fail (e.g. make script exit conditional)
|
|
64
|
-
[x] README.md
|
|
65
|
-
[o] index.html should be auto-gen'd from README.md (but include bitwrench.js)
|
|
66
|
-
[x] npm register
|
|
67
|
-
[x] npm install
|
|
68
|
-
[x] minify (yes, using uglifyjs)
|
|
69
|
-
[ ] tests, coverage -- make sure all functions get tested
|
|
70
|
-
[x] linting - JSHint or ESLint
|
|
71
|
-
[x] "use strict";
|
|
72
|
-
[ ] api ref docs
|
|
73
|
-
[ ] examples
|
|
74
|
-
[ ] pure JSON page generation
|
|
75
|
-
[ ] example of using YAML instead of JSON (use yamljs in example but not in bw)
|
|
76
|
-
[x] dir structure
|
|
77
|
-
[x] license
|
|
78
|
-
[x] github
|
|
79
|
-
[x] deftio.com/bitwrench pages ==> move to deftio/opensource/bitwrench ?
|
|
80
|
-
[x] build notes
|
|
81
|
-
[x] rename to bitwrench
|
|
82
|
-
[x] npm release (already an npm package)
|
|
83
|
-
[ ] support inline logo for example favicons: <img src="data:image/png;base64,base64encoded images" />
|
|
84
|
-
[x] full UMD support (cjs / require / AMD / import / browser)
|
|
85
|
-
|
|
86
|
-
## Issues and clean up
|
|
87
|
-
* bw.bwSimpleThemes has cosmetic issues
|
|
88
|
-
* repeatUntil usabilitiy issues
|
|
89
|
-
* make internal function for commonly used:
|
|
90
|
-
a = bw.typeOf(a) == "type" ? true_value : false_value
|
|
91
|
-
==>
|
|
92
|
-
_toa(a,typeString | [typeString1, typeString2]) ==> {if true ... false}
|
|
93
|
-
* in buildHTMLObjectString() add paramter{"pretty" : false} // if set to true inserts "\n" and "\t" at appropriate points in output for readability
|
|
94
|
-
* fix attribute values to escape "". e.g. {style: "background-image: url('/path/to/image') "} <<-- shown single quotes, needs to support double quotes.
|
|
95
|
-
* converge all makeHTML functions to have simple names (see list below). could drop "make" so HTML, HTMLList, HTMLCard, HTMLTable, HTMLPage
|
|
96
|
-
** makeHTML /// currently called buildHTMLObjectStr()
|
|
97
|
-
** makeHTMLTabs
|
|
98
|
-
** makeHTMLList(data_array1d, options)
|
|
99
|
-
* ordered vs unordered
|
|
100
|
-
** makeHTMLCard (see w3 schools)
|
|
101
|
-
** makeHTMLAccordian
|
|
102
|
-
** makeHTMLTable
|
|
103
|
-
** makeHTMLPage
|
|
104
|
-
** makeHTMLFooter
|
|
105
|
-
** makeHTMLHeader
|
|
106
|
-
* converge file operations
|
|
107
|
-
** fileLoadJSON also csv
|
|
108
|
-
** fileSaveJSON also csv
|
|
109
|
-
** fileLoad
|
|
110
|
-
** fileSave
|
|
111
|
-
* converge function registration operations
|
|
112
|
-
** funcGetID
|
|
113
|
-
** funcRegister
|
|
114
|
-
** funcUnRegister
|
|
115
|
-
** funcGetDispatchStr
|
|
116
|
-
* converge numeric operations
|
|
117
|
-
** mapScale ==> numInterp
|
|
118
|
-
** random ==> random
|
|
119
|
-
** clip ==> numClip
|
|
120
|
-
** fixNum ==> numFix
|
|
121
|
-
** multiArray ==> numMultiArray
|
|
122
|
-
** numHash32
|
|
123
|
-
* converge color operations
|
|
124
|
-
** colorInterp
|
|
125
|
-
** colorParse ==> bwformat [c0,c1,c2,alpha,model] // model can be "rgb" | "hsl"
|
|
126
|
-
** colorToRGBHex
|
|
127
|
-
** colorRBGToHSL
|
|
128
|
-
* add disolving bw.logd on all catch (e) {}
|
|
129
|
-
* add attribute "text/css" to <style></style> export functions
|
|
130
|
-
* arrows on sortTable
|
|
131
|
-
* bw-table-sort-upa bw-table-sort-dna bw-table-sort-xxa // arrows mark-element is in cycle xx--> upa --> dna --> xx
|
|
132
|
-
* bw-table-sort-up bw-table-sort-dn bw-table-sort-xx // no arrows or display just sorts. mark-elment is in cycle xx-->up-->dn-->xx
|
|
133
|
-
* need to add this as option to sortable in sortTable
|
|
134
|
-
* tree accordian (eg explorer)
|
|
135
|
-
indented divs with show / hide
|
|
136
|
-
* makeThemes directory (?)
|
|
137
|
-
* add bw.logd(values) // bw.debug log (adds to regular bw.log) but
|
|
138
|
-
TODO: transpose .logd and .log names --> more readable e.g. bw.log acts like console.log
|
|
139
|
-
* is dissolving via bw.logdControl
|
|
140
|
-
bw.logd joins all args like console.log
|
|
141
|
-
bw.logd can be turned on
|
|
142
|
-
bw.logdControl("on") // on
|
|
143
|
-
bw.logdControl("off") // don't log
|
|
144
|
-
bw.logd() // return current on/off status
|
|
145
|
-
all messages are writtend with "bw.logd" as message type. use bw.log() for custom messages
|
|
146
|
-
* takes same style params as console.log (e.g. ...)
|
|
147
|
-
*
|
|
148
|
-
* polyfils needed ==> consider jado pull in
|
|
149
|
-
array.indexOf
|
|
150
|
-
array.map
|
|
151
|
-
array.filter
|
|
152
|
-
array.reduce
|
|
153
|
-
array.forEach
|
|
154
|
-
atob / btoa (base64)
|
|
155
|
-
string.trim ==> bw.trim()
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
## future
|
|
160
|
-
consider merging spannit.js in to bitwrench
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
//useful for table code, other stuff
|
|
164
|
-
element.className.replace("name", "new-name");
|
|
165
|
-
//e.g. el.className.replace("bw-active", "bw-none");
|
|
166
|
-
el.className.replace("bw-col", "bw-none");
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## doc notes:
|
|
171
|
-
document how to "mannually" set up tabs
|
|
172
|
-
make sure bw doesn't try to "append to head" any code if in nodejs
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
## Themes
|
|
176
|
-
```javascript
|
|
177
|
-
|
|
178
|
-
makeBasicTheme(colors{}) {
|
|
179
|
-
color.light.primary
|
|
180
|
-
color.light.background
|
|
181
|
-
|
|
182
|
-
color.dark.primary
|
|
183
|
-
color.dark.background
|
|
184
|
-
|
|
185
|
-
color.border
|
|
186
|
-
color.
|
|
187
|
-
|
|
188
|
-
color.hover.primary
|
|
189
|
-
color.hover.background
|
|
190
|
-
color.hover.border
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var bthem =
|
|
194
|
-
`
|
|
195
|
-
.w3-theme-light {color:#000 !important; background-color:#f2f9fe !important}
|
|
196
|
-
.bw-theme-dark {color:#fff !important; background-color:#074b83 !important}
|
|
197
|
-
.bw-theme-action {color:#fff !important; background-color:#074b83 !important}
|
|
198
|
-
|
|
199
|
-
.bw-theme {color:#fff !important; background-color:#2196f3 !important}
|
|
200
|
-
.bw-text-theme {color:#2196f3 !important}
|
|
201
|
-
.bw-border-theme {border-color:#2196f3 !important}
|
|
202
|
-
|
|
203
|
-
.bw-hover-theme:hover {color:#fff !important; background-color:#2196f3 !important}
|
|
204
|
-
.bw-hover-text-theme:hover {color:#2196f3 !important}
|
|
205
|
-
.bw-hover-border-theme:hover {border-color:#2196f3 !important}
|
|
206
|
-
`
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
================================
|
|
213
|
-
testing
|
|
214
|
-
log
|
|
215
|
-
logd
|
package/dev/css-arrows.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//=============================================
|
|
2
|
-
//arrows for table sort (needs js to be fixed)
|
|
3
|
-
``` css
|
|
4
|
-
.bw-table-sort-upa::after {
|
|
5
|
-
content: "\2191";
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.bw-table-sort-dna::after {
|
|
9
|
-
content: "\2193";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.bw-table-sort-xxa::after {
|
|
13
|
-
content: "\00a0";
|
|
14
|
-
}
|
|
15
|
-
.bw-table-sort-up::after {
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.bw-table-sort-dn::after {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.bw-table-sort-xx::after {
|
|
22
|
-
}
|
|
23
|
-
```
|
package/dev/docStringDev.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"
|
|
3
|
-
|
|
4
|
-
//The above shenbang allows running on systems whether nodejs exec is called 'node'
|
|
5
|
-
//or called 'nodejs' which is common on many debian systems such as Ubuntu.
|
|
6
|
-
|
|
7
|
-
//more traditional shebang would be:
|
|
8
|
-
//#!/usr/bin/env node
|
|
9
|
-
|
|
10
|
-
//begin actual javascript below
|
|
11
|
-
|
|
12
|
-
var fs = require('fs');
|
|
13
|
-
var bw = require('../bitwrench.js')["bw"];
|
|
14
|
-
|
|
15
|
-
var tests = [
|
|
16
|
-
function() {
|
|
17
|
-
/**
|
|
18
|
-
s1
|
|
19
|
-
abc
|
|
20
|
-
def
|
|
21
|
-
ghi
|
|
22
|
-
@wejo
|
|
23
|
-
*/
|
|
24
|
-
var x;
|
|
25
|
-
/* s1 not a docstring
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/** s1 another docsting
|
|
29
|
-
*/
|
|
30
|
-
return true;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
function() {
|
|
34
|
-
|
|
35
|
-
/*
|
|
36
|
-
@description
|
|
37
|
-
not a docstring
|
|
38
|
-
*/
|
|
39
|
-
var y=1; // var y=1, not a valid docstring
|
|
40
|
-
/**
|
|
41
|
-
s2
|
|
42
|
-
abc
|
|
43
|
-
def
|
|
44
|
-
ghi
|
|
45
|
-
@wejo
|
|
46
|
-
*/
|
|
47
|
-
var x =2;
|
|
48
|
-
x = (3>4) ? x : 2;
|
|
49
|
-
|
|
50
|
-
/** s2 another docsting */
|
|
51
|
-
return x+y;
|
|
52
|
-
},
|
|
53
|
-
"/** this is a simple string */",
|
|
54
|
-
"/* not a valid doc string*/",
|
|
55
|
-
"not a valid doc string",
|
|
56
|
-
"// not a valid docstring"
|
|
57
|
-
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var outs = function(x,o) {
|
|
62
|
-
var y = typeof(x) != "string" ? x.toString() : x;
|
|
63
|
-
return "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"+bw.docString(y,o).join("\n..................\n")+"\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.log("started ... ")
|
|
67
|
-
tests.forEach(function(x){console.log(outs(x))})
|
|
68
|
-
|
|
69
|
-
tests.forEach(function(x){console.log(outs(x,{}))})
|
|
70
|
-
//======
|
|
71
|
-
//test docStringParse()
|
|
72
|
-
console.log("\n|||||||||||||||||||||||||||||||||||||\n")
|
|
73
|
-
|
|
74
|
-
//http://usejsdoc.org/tags-param.html
|
|
75
|
-
//Test cases
|
|
76
|
-
//Name only
|
|
77
|
-
function sayHello1(somebody) {
|
|
78
|
-
/**
|
|
79
|
-
* @param somebody
|
|
80
|
-
*/
|
|
81
|
-
alert('Hello ' + somebody);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//Name and type
|
|
85
|
-
function sayHello2(somebody) {
|
|
86
|
-
/**
|
|
87
|
-
* @param {string} somebody
|
|
88
|
-
*/
|
|
89
|
-
alert('Hello ' + somebody);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
//Name, type, and description
|
|
93
|
-
function sayHello3(somebody) {
|
|
94
|
-
/**
|
|
95
|
-
* @param {string} somebody Somebody's name.
|
|
96
|
-
*/
|
|
97
|
-
alert('Hello ' + somebody);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
//You can add a hyphen before the description to make it more readable. Be sure to include a space before and after the hyphen.
|
|
101
|
-
//Name, type, and description, with a hyphen before the description
|
|
102
|
-
function sayHello4(somebody) {
|
|
103
|
-
/**
|
|
104
|
-
* @param {string} somebody - Somebody's name.
|
|
105
|
-
*/
|
|
106
|
-
alert('Hello ' + somebody);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var testCasesParse = [
|
|
110
|
-
sayHello1.toString(),
|
|
111
|
-
sayHello2.toString(),
|
|
112
|
-
sayHello3.toString(),
|
|
113
|
-
sayHello4.toString()
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
var outp = function(x,o) {
|
|
117
|
-
var y = typeof(x) != "string" ? x.toString() : x;
|
|
118
|
-
return "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"+(bw.docString(y,o).forEach(function(z){return bw.parseJsDocString(z)}).join ("|")).join("\n..................\n")+"\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
|
|
119
|
-
}
|
|
120
|
-
//console.log(outp(bw.parseJsDocString))
|
|
121
|
-
|
|
122
|
-
//any issues here..
|
|
123
|
-
console.log("\n"+bw.logExport({"format":"text"}));
|
|
124
|
-
|
package/dev/docStringParseDev.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"
|
|
3
|
-
|
|
4
|
-
//The above shenbang allows running on systems whether nodejs exec is called 'node'
|
|
5
|
-
//or called 'nodejs' which is common on many debian systems such as Ubuntu.
|
|
6
|
-
|
|
7
|
-
//more traditional shebang would be:
|
|
8
|
-
//#!/usr/bin/env node
|
|
9
|
-
|
|
10
|
-
//begin actual javascript below
|
|
11
|
-
|
|
12
|
-
"use strict";
|
|
13
|
-
var fs = require('fs');
|
|
14
|
-
var bw = require('../bitwrench.js')["bw"];
|
|
15
|
-
|
|
16
|
-
/*
|
|
17
|
-
|
|
18
|
-
this is a comment with no @
|
|
19
|
-
* this is a comment with no @ (note begins with *)
|
|
20
|
-
|
|
21
|
-
@param foo
|
|
22
|
-
* @param foo
|
|
23
|
-
|
|
24
|
-
@param {type,type2} description starts here
|
|
25
|
-
@param {type,type2} name - description starts here
|
|
26
|
-
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
console.log("started ... ")
|
|
30
|
-
//======
|
|
31
|
-
//test docStringParse()
|
|
32
|
-
console.log("\n|||||||||||||||||||||||||||||||||||||\n")
|
|
33
|
-
|
|
34
|
-
//http://usejsdoc.org/tags-param.html
|
|
35
|
-
//Test cases
|
|
36
|
-
//Name only
|
|
37
|
-
function sayHello1(somebody) {
|
|
38
|
-
/**
|
|
39
|
-
* @param somebody
|
|
40
|
-
*/
|
|
41
|
-
alert('Hello ' + somebody);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//Name and type
|
|
45
|
-
function sayHello2(somebody) {
|
|
46
|
-
/**
|
|
47
|
-
* @param {string} somebody
|
|
48
|
-
*/
|
|
49
|
-
alert('Hello ' + somebody);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//Name, type, and description
|
|
53
|
-
function sayHello3(somebody) {
|
|
54
|
-
/**
|
|
55
|
-
* @param {string} somebody Somebody's name.
|
|
56
|
-
*/
|
|
57
|
-
alert('Hello ' + somebody);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//You can add a hyphen before the description to make it more readable. Be sure to include a space before and after the hyphen.
|
|
61
|
-
//Name, type, and description, with a hyphen before the description
|
|
62
|
-
function sayHello4(somebody) {
|
|
63
|
-
/**
|
|
64
|
-
* @param {string} somebody - Somebody's name.
|
|
65
|
-
*/
|
|
66
|
-
alert('Hello ' + somebody);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function sayHello5(somebody) {
|
|
70
|
-
/**
|
|
71
|
-
This is a simple description which shoud be hanlded by the parser eventhough it doesn;t have an @param type d
|
|
72
|
-
declaration in it.
|
|
73
|
-
*/
|
|
74
|
-
}
|
|
75
|
-
var testCasesParse = [
|
|
76
|
-
sayHello1.toString(),
|
|
77
|
-
sayHello2.toString(),
|
|
78
|
-
sayHello3.toString(),
|
|
79
|
-
sayHello4.toString(),
|
|
80
|
-
]
|
|
81
|
-
|
|
82
|
-
var outp = function(z,opts) {
|
|
83
|
-
var i,s = "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n";
|
|
84
|
-
for (i=0; i<z.length; i++) { // for each test case
|
|
85
|
-
z.forEach(function(x){return bw.docStringParse(x,opts)}).join ("|");
|
|
86
|
-
}
|
|
87
|
-
s+= "\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n";
|
|
88
|
-
}
|
|
89
|
-
//console.log(outp(bw.parseJsDocString))
|
|
90
|
-
var testCaseParse2 = [
|
|
91
|
-
" @param", // {field: "@param", "types" :"", "fieldName" :"", "description" :""}
|
|
92
|
-
" @field d1 d2 d3 d4", //
|
|
93
|
-
" @param {type1 } d1 d2 d3 d4", //
|
|
94
|
-
" @param2 {type1, type2} d1 d2 d3", //
|
|
95
|
-
" @param {type} name - d1 d2 d3", //
|
|
96
|
-
" this is just a desctription line" //
|
|
97
|
-
]
|
|
98
|
-
|
|
99
|
-
var fn = function(s) {
|
|
100
|
-
var r={"source":s, "field" : "", "types":"", "name" :"", "description" : ""};
|
|
101
|
-
var a = s.replace(/^\s*(\/\*\*?)?|(\*\/)?\s*$/ig,"") // remove the comment markers if still there "/** my comment */"" ==> "my comment"
|
|
102
|
-
a = a.replace(/^\s*\**\s*/,""); // remove any cruft at beginning of line " * @myParam {}....." ==> "@myParam {}....."
|
|
103
|
-
if (a.charAt(0) == "@") { // if we have hit a @fieldname parameter we start parsing.
|
|
104
|
-
// ([str, regex, fieldStr, result{}]) ==> ([str, regex, fieldStr, result{}]) ::> ([str,result{},fieldStr,regex])
|
|
105
|
-
var _tok = function(x){
|
|
106
|
-
var m = x[0].match(x[1]);
|
|
107
|
-
if (m != null) {x[4][3]=m[1];}
|
|
108
|
-
x[0] = x[0].replace(x[1],"");
|
|
109
|
-
return x;
|
|
110
|
-
}
|
|
111
|
-
//r = [[e,f],[e,f],[e,f],[e,f]].reduce(,_tok);
|
|
112
|
-
|
|
113
|
-
var e,x;
|
|
114
|
-
var t = bw.trim;
|
|
115
|
-
e =/^@([A-Za-z0-9_<>[\]]*)/i;
|
|
116
|
-
x = a.match(e);
|
|
117
|
-
if (x != null) {r["field"] = t(x[1])} else return r; // didn't match... opt out here
|
|
118
|
-
a = a.replace(e,"");
|
|
119
|
-
|
|
120
|
-
e = /^\s*\{([A-Za-z0-9_|\s,.\-+!@#$%^&*()=[\]]*)\}/i;
|
|
121
|
-
x = a.match(e);
|
|
122
|
-
if (x != null) {r["types"]=t(x[1]);} // types is optional..
|
|
123
|
-
a = a.replace(e,"");
|
|
124
|
-
|
|
125
|
-
e = /^\s*([\S]*)/i;
|
|
126
|
-
x = a.match(e);
|
|
127
|
-
if (x != null) {r["description"]=t(x[1]);} //
|
|
128
|
-
a = a.replace(e,"");
|
|
129
|
-
|
|
130
|
-
e = /^\s*([\S]*)/i;
|
|
131
|
-
x = a.match(e);
|
|
132
|
-
if (x != null) {r["name"]=t(x[1]);} //
|
|
133
|
-
a = a.replace(e,"");
|
|
134
|
-
|
|
135
|
-
// descrpition ==> name: "" description : "description"
|
|
136
|
-
// description we we ==> name: "" description : "description we we "
|
|
137
|
-
// name - description we we ==> name: "name" descrpition : "description we we"
|
|
138
|
-
// - description we we ==> name: "" description : "description we we"
|
|
139
|
-
if (r["name"].match(/^\s*-+\s*/) != null) {
|
|
140
|
-
r["name"] = r["description"];
|
|
141
|
-
r["description"] = t(a);
|
|
142
|
-
} else {
|
|
143
|
-
r["description"] = r["description"]+" "+r["name"]+" "+t(a);
|
|
144
|
-
r["name"] ="";
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return r;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var testFn = function(t) {
|
|
151
|
-
var i;
|
|
152
|
-
for (i in t) {
|
|
153
|
-
console.log("\n +++++++++++++++++++++++++\n");
|
|
154
|
-
var x = fn(t[i]);
|
|
155
|
-
console.log(x);
|
|
156
|
-
console.log("\n -------------------------\n");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
testFn(testCaseParse2);
|
|
160
|
-
//outp(testCaseParse2);//any issues here..
|
|
161
|
-
bw.log("end-time");
|
|
162
|
-
console.log("\n"+bw.logExport({"format":"text"}));
|
|
163
|
-
|
|
164
|
-
/*
|
|
165
|
-
|
|
166
|
-
s = getline()
|
|
167
|
-
trim()
|
|
168
|
-
trim leading * ==> "\*?\s+"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*/
|
package/dev/figures.html
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<script src="https://unpkg.com/bitwrench/bitwrench.js"></script>
|
|
4
|
-
<body class="bw-def-page-setup">
|
|
5
|
-
|
|
6
|
-
<h1>The figure and figcaption element</h1>
|
|
7
|
-
This demo shows use of html figure elements...<br>
|
|
8
|
-
<div style="display:inline-block">
|
|
9
|
-
<figure style="width:500px; ">
|
|
10
|
-
<img src="../images/bitwrench-512x512.png" alt="Image Alt Text" style="width:100%">
|
|
11
|
-
<figcaption id="x1">Fig.1 - Sample Image weij we owjroiew jroiew joiwewjrwe</figcaption>
|
|
12
|
-
</figure>
|
|
13
|
-
<figure style="width:200px">
|
|
14
|
-
<img src="../images/bitwrench-512x512.png" alt="Image Alt Text" style="width:100%">
|
|
15
|
-
<figcaption>Fig.1 - Sample Image</figcaption>
|
|
16
|
-
</figure>
|
|
17
|
-
<figure style="width:200px; ">
|
|
18
|
-
<figcaption>Fig.1 - Sample Image</figcaption>
|
|
19
|
-
<img src="../images/bitwrench-512x512.png" alt="Image Alt Text" style="width:100%">
|
|
20
|
-
|
|
21
|
-
</figure>
|
|
22
|
-
<figure style="width:200px">
|
|
23
|
-
<img src="../images/bitwrench-512x512.png" alt="Image Alt Text" style="width:100%">
|
|
24
|
-
<figcaption>Fig.1 - Sample Image</figcaption>
|
|
25
|
-
</figure>
|
|
26
|
-
</div>
|
|
27
|
-
End of the figures..
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
bw.DOM("#x1",bw.htmlTabs([["tab1","content1"],["tab2",`<figure style="width:200px; ">
|
|
31
|
-
<figcaption>Fig.1 - Sample Image</figcaption>
|
|
32
|
-
<img src="../images/bitwrench-512x512.png" alt="Image Alt Text" style="width:100%">
|
|
33
|
-
|
|
34
|
-
</figure>`],["tab3","content3"]]));
|
|
35
|
-
</script>
|
|
36
|
-
</body>
|
|
37
|
-
</html>
|