-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathotdm2jsdocs.sh
executable file
·166 lines (145 loc) · 5.65 KB
/
otdm2jsdocs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
echo "---- otdm to yss .js files to doccumentation packer ----"
otDir="/OT"
yssDir=${otDir}"/ySS_calibration"
wikiDir="/home/yoyo/Apps/oiyshTerminal.wiki"
#
#/~https://github.com/jsdoc2md/jsdoc-to-markdown/wiki/How-to-document-a-ToDo-list
# https://jsdoc.app/index.html
echo "set no errors !!!!"
set -e
#"otdmDriverProto": {
# "title": "otdmDriverProto indepth explenation / documentation of prototype",
# "doctype": "py",
# "file": "./otdm2pydocTemplate.py",
# "asFile": "otdm-tools-devdoc"},
list='{
"otdmDriverProto": {
"title": "otdmDriverProto.py indepth explenation / documentation - coder edition",
"doctype": "py",
"file": "./otdm-tools/data/data/com.termux/files/usr/bin/otdmDriverProto.py",
"asFile": "xdevdoc-otdmDriverProto"},
"otdmDriverWebCmdSubProcess": {
"title": "otdmDriverWebCmdSubProcess.py indepth explenation / documentation - coder edition",
"doctype": "py",
"file": "./otdm-tools/data/data/com.termux/files/usr/bin/otdmDriverWebCmdSubProcess.py",
"asFile": "xdevdoc-otdmDriverProto-web-cmd-sub-process"},
"yssPageExample": {
"title": "example ( Make your site ) - yss site .svg base data from mqtt",
"file": "./ySS_calibration/sites/basic_sail/s_basicSailPage.js",
"asFile": "yss-site-example"},
"sPager": {
"title": "pager. for doing some magic.. with your yss",
"file": "./ySS_calibration/libs/sPager.js",
"asFile": "yss-js-functions-pager"},
"mApp": {
"title": "mApp. for fast touche GUI - jQuery Mobile in yss",
"file": "./ySS_calibration/libs/mApp.js",
"asFile": "yss-js-functions-mApp"},
"mDoCmd": {
"title": "mDoCmd. for communication with tools and bash from any layer ( stdout / stdin )",
"file": "./ySS_calibration/libs/mDoCmd.js",
"asFile": "yss-js-functions-mDoCmd"},
"mMath": {
"title": "mMath and string helper",
"file": "./ySS_calibration/libs/mMath.js",
"asFile": "yss-js-functions-mMath"},
"mOperation": {
"title": "for .svg mOperation helper",
"file": "./ySS_calibration/libs/mOperation.js",
"asFile": "yss-js-functions-svg"},
"three4yss": {
"title": "t4y. for Three.js sites with .obj .stl .gbl files",
"file": "./ySS_calibration/libs/three4yss.js",
"asFile": "yss-js-functions-t4y"},
"t4y_ani": {
"title": "for Three.js sites to help with animation taskers",
"file": "./ySS_calibration/libs/t4y_ani.js"},
"t4y_console": {
"title": "for Three.js sites give console renderer and other ingo use on screen ? key",
"file": "./ySS_calibration/libs/t4y_console.js"},
"t4y_putText": {
"title": "for Three.js sites puts text / OSD",
"file": "./ySS_calibration/libs/t4y_putText.js"},
"t4y_shader": {
"title": "for Three.js sites invert / red black / postprocessor",
"file": "./ySS_calibration/libs/t4y_shader.js"}
}'
#echo $list
echo $list | jq '.'
echo "cleaning old ..."
echo -e "# Index\n\n" > ${otDir}"/yss-js-functions.md"
for js in `echo $list | jq 'keys[]' -r`; do
title=`echo $list | jq '.'$js'.title' -r`
file=`echo $list | jq '.'$js'.file' -r`
shUrl=`echo ${title}|sed 's| |-|g'|sed 's|/||g'| sed 's|\.||g' | sed 's|(||g'| \
sed 's|)||g' | sed "s|'||g" | sed 's|?||g' | sed 's|!||g' `
echo -e "[- "$title"](#$shUrl)\n\n" >> ${otDir}"/yss-js-functions.md"
done
echo -e "\n---\n" >> ${otDir}"/yss-js-functions.md"
for js in `echo $list | jq 'keys[]' -r`; do
echo "js"$js
title=`echo $list | jq '.'$js'.title' -r`
file=`echo $list | jq '.'$js'.file' -r`
asFile=`echo $list | jq '.'$js'.asFile' -r`
docT=`echo $list | jq '.'$js'.doctype' -r`
echo "pre build asFile .... ["${asFile}"]"
tmA="/tmp/abccc"
if [ ${asFile} = 'null' ];then
echo "title for file is ... "$title
echo -e "\n---\n# "${title}"\n### "$js"\n" \
"[To index](#)" >> ${otDir}"/yss-js-functions.md"
echo "no seperet file."
else
echo "seperet file ...."
tmA=`tempfile`
echo "so move current to tmp .... ["${tmA}"]"
mv ${otDir}"/yss-js-functions.md" ${tmA}
echo "set up clean with title ...."
echo -e "# "${title}"\n### "$js"\n" \
"[To index](./yss-js-functions#index)" >> ${otDir}"/yss-js-functions.md"
fi
if [ ${docT} = "py" ];then
echo "doctype .... ["${docT}"]"
echo " preparing /tmp/py2docInput ....."
rm -rvf '/tmp/py2docInput'
mkdir /tmp/py2docInput
echo "copy file to work with ... "${otDir}"/"${file}
cp ${otDir}"/"${file} /tmp/py2docInput/
echo "running npm run py2doc.md ...."
npm run py2doc.md
if [ -f /tmp/py2docOutput.md ];then
echo " DONE"
echo " cheeting that that was a jsdoc2md :P ....."
cat /tmp/py2docOutput.md >> ${otDir}"/yss-js-functions.md"
rm /tmp/py2docOutput.md
echo " .... NEXT"
else
echo " ERROR generating "${otDir}"/"${file}" no result foud!"
exit 1
fi
#echo "-- workon"
#exit 1
else
echo "running ... npm run jsdoc2md-arg" $file
npm run jsdoc2md-arg $file >> /dev/null
fi
echo "post build asFile .... ["${asFile}"]"
if [ ${asFile} = 'null' ];then
echo "no seperet file."
else
echo "seperet file ...."
echo "file to asFile copy ..."
cp ${otDir}"/yss-js-functions.md" ${wikiDir}"/"${asFile}".md"
echo "stacking it on top of tmp .... ["${tmA}"]"
cat ${otDir}"/yss-js-functions.md" >> ${tmA}
echo "removing ...."
rm ${otDir}"/yss-js-functions.md"
echo "moving tmp ass current .."
mv ${tmA} ${otDir}"/yss-js-functions.md"
echo "resume ... nothing happend :P only new file in ["${wikiDir}"/"${asFile}".md]"
fi
done
echo -e "\n---\n**Powered by**: [jsdoc2md](/~https://github.com/jsdoc2md)" >> ${otDir}"/yss-js-functions.md"
cp ${otDir}"/yss-js-functions.md" ${wikiDir}"/"
#echo "------exit -------"
#exit 1