initial commit
This commit is contained in:
commit
0c6686f5a0
6 changed files with 102 additions and 0 deletions
41
README.awk
Executable file
41
README.awk
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env -S awk -f
|
||||
# a no-nonsense source-to-markdown generator which scans for:
|
||||
#
|
||||
# /**
|
||||
# * # foo
|
||||
# *
|
||||
# * this is markdown $(cat bar.md)
|
||||
# */
|
||||
#
|
||||
# var foo; // comment with 2 leading spaces is markdown too $(date)
|
||||
#
|
||||
# easily refactorable to hash-based languages (py/bash/perl/lua e.g.)
|
||||
# by changing the regexes
|
||||
#
|
||||
|
||||
BEGIN{
|
||||
# printf README.md until '# Component List'
|
||||
system("grep -B9999 '# Functions' README.md")
|
||||
print ""
|
||||
}
|
||||
|
||||
/\$(?![\(|"])/ { cmd=$0;
|
||||
gsub(/^.*\$\(/,"",cmd);
|
||||
gsub(/\).*/,"",cmd);
|
||||
cmd | getline stdout; close(cmd);
|
||||
sub(/\$\(.*\)/,stdout);
|
||||
}
|
||||
/\/\*\*/ { doc=1; sub(/^.*\/\*/,""); }
|
||||
doc && /\*\// { doc=0;
|
||||
sub(/[[:space:]]*\*\/.*/,"");
|
||||
sub(/^[[:space:]]*\*[[:space:]]?/,"");
|
||||
print
|
||||
}
|
||||
doc && /^[[:space:]]*\*/ { sub(/^[[:space:]]*\*[[:space:]]?/,"");
|
||||
print
|
||||
}
|
||||
#!doc && /\/\/ / { sub(".*// ","");
|
||||
# sub("# ","\n# ");
|
||||
# sub("> ","\n> ");
|
||||
# print
|
||||
# }
|
||||
11
README.md
Normal file
11
README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
XR Fragment utilities
|
||||
=====================
|
||||
|
||||
These are helper functions to make 3D (javascript) viewers XR Fragment compatible.
|
||||
|
||||
|
||||
See function list below
|
||||
|
||||
> this README.md is generated by running `echo "$(./README.awk *.js)" > README.md`
|
||||
|
||||
# Function list
|
||||
24
level0.js
Normal file
24
level0.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import * as http from './scheme/http.js'
|
||||
import * as xrf from './scheme/http.js'
|
||||
|
||||
function defaultSchemes(){
|
||||
return {http,xrf}
|
||||
}
|
||||
|
||||
async function pollSideCarFiles(urlString, opts){
|
||||
|
||||
opts = {}
|
||||
opts.scheme = opts.scheme || defaultSchemes()
|
||||
let p = []
|
||||
const sext = [".png",".ogg",".vtt",".json"]
|
||||
ext = urlString.lastIndexOf('.')
|
||||
|
||||
for( let i in ext) p.push(
|
||||
new Promise( (resolve,reject) => {
|
||||
fetch( urlString.replace(ext, sext[i] ), { method:'HEAD'} )
|
||||
})
|
||||
)
|
||||
await Promise.all(p)
|
||||
}
|
||||
|
||||
export {pollSideCarFiles}
|
||||
6
level0.test.js
Normal file
6
level0.test.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import * as level0 from './level0.js'
|
||||
import { expect, test } from "bun:test";
|
||||
|
||||
test("2 + 2", () => {
|
||||
expect(2 + 2).toBe(4);
|
||||
});
|
||||
10
scheme/http.js
Normal file
10
scheme/http.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const profile = {
|
||||
type: "http"
|
||||
}
|
||||
|
||||
const fetchApi = fetch
|
||||
|
||||
export {
|
||||
profile,
|
||||
fetchApi
|
||||
}
|
||||
10
scheme/xrf.js
Normal file
10
scheme/xrf.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const profile = {
|
||||
type: "http"
|
||||
}
|
||||
|
||||
const fetchApi = fetch
|
||||
|
||||
export {
|
||||
profile,
|
||||
fetchApi
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue