Commit 11ccb5ee authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix sphinx doc for javascript

parent a78da59b
......@@ -16,7 +16,7 @@ def parse_js_file(module_name, file_path, js_writer, separator):
js_writer.write(module_name + "\n")
js_writer.write(len(module_name) * separator + "\n\n")
js_code = js_f.read()
functions_doc = re.findall(r"/\*\*[^/]+\*/\n([^\n/]+) = function", js_code)
functions_doc = re.findall(r"/\*\*.*?\*/\n([^\n/]+) = function", js_code, re.DOTALL)
functions_doc.sort(key=lambda x: "0000000" if x.rsplit(".", 1)[-1] == "init" else
(("zzzzzzzzzz" + x) if x.rsplit(".", 1)[-1].startswith("_") else x))
for func in functions_doc:
......@@ -70,6 +70,26 @@ def build_rst_files():
shutil.rmtree("javascript")
os.mkdir("javascript")
if os.path.exists("javascript/js"):
shutil.rmtree("javascript/js")
os.mkdir("javascript/js")
app_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
js_dir = os.path.join(app_dir, "src", "dgenies", "static", "js")
js_files = set()
for package in PACKAGES:
for file in glob(os.path.join(js_dir, package + "*")):
is_excl = False
for excl in EXCLUDES:
if os.path.basename(file).startswith(excl):
is_excl = True
break
if not is_excl and not file.endswith(".min.js"):
js_files.add(file)
for js_file in js_files:
os.symlink(js_file, os.path.join("javascript", "js", os.path.basename(js_file)))
print("Parse javascript files...")
js_files = get_modules_list()
......
......@@ -173,4 +173,4 @@ texinfo_documents = [
autodoc_default_flags = ['private-members']
autoclass_content = "both"
js_source_path = '../src/dgenies/static/js'
js_source_path = 'javascript/js'
......@@ -5,6 +5,7 @@ d3.boxplot.mousetip = {};
/**
* Get color (black/white) depending on bgColor so it would be clearly seen.
*
* @param bgColor
* @returns {string}
*/
......@@ -22,21 +23,21 @@ d3.boxplot.mousetip.getColorByBgColor = function(bgColor) {
* @param {int} y
*/
$.fn.mousetip = function(my_tip, relative_to=null, x=20, y=20) {
let $this = $(this);
let tip = relative_to === null ? $(my_tip, this) : $(my_tip, relative_to);
let hidden = true;
$this.hover(function(e) {
if (!e.ctrlKey) {
tip.show();
hidden = false;
}
}, function() {
hidden = true;
tip.hide().removeAttr('style');
}).mousemove(function(e) {
tip.hide();
......@@ -149,6 +150,7 @@ d3.boxplot.mousetip.hide = function () {
/**
* get label to show
*
* @param {string} label initial label
* @returns {string} new label
*/
......@@ -236,4 +238,4 @@ d3.boxplot.mousetip.get_match = function(e) {
}
}
return null;
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment