Commit 62c12a3d authored by Camil Staps's avatar Camil Staps 🐧

Update to new Platform for multiline documentation of record...

Update to new Platform for multiline documentation of record fields/constructors (clean-and-itasks/clean-platform#77)
parent 5afe88a0
Pipeline #31157 passed with stages
in 15 minutes and 29 seconds
#!/bin/bash #!/bin/bash
export CLEANDATE="2019-09-30" export CLEANDATE="2019-10-12"
...@@ -141,13 +141,27 @@ function makeSummary(hidden) { ...@@ -141,13 +141,27 @@ function makeSummary(hidden) {
function mergeComments(code, comments) { function mergeComments(code, comments) {
var maxLength = 0; var maxLength = 0;
for (var i in code) for (var i in code)
if (code[i].length > maxLength) if ((i >= comments.length || (comments[i] != '' && comments[i].indexOf('\n')<0)) &&
code[i].length > maxLength)
maxLength = code[i].length; maxLength = code[i].length;
for (var i in code) var line=1;
if (i < comments.length && comments[i] != '') for (var i=0; i<comments.length; i++) {
code[i] = (code[i] + Array(maxLength + 1).join(' ')) if (i < comments.length && comments[i] != '') {
.substring(0, maxLength+1) + comments[i]; console.log(comments[i].indexOf('\n'),comments[i]);
if (comments[i].indexOf('\n') < 0) {
code[line] = (code[line] + Array(maxLength + 1).join(' '))
.substring(0, maxLength+1) + '//* ' + comments[i];
line++;
} else {
comments[i]=comments[i].split('\n');
code.splice(line+1, 0, ...comments[i].map((c) => '\t\t//* ' + c));
line+=comments[i].length+1;
}
} else {
line++;
}
}
return code; return code;
} }
...@@ -541,7 +555,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag ...@@ -541,7 +555,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
var comments = ['']; var comments = [''];
for (var i in extra['type_field_doc']) for (var i in extra['type_field_doc'])
comments.push(extra['type_field_doc'][i].length > 1 comments.push(extra['type_field_doc'][i].length > 1
? '//* ' + extra['type_field_doc'][i][1].replace('\n', ' ') ? extra['type_field_doc'][i][1]
: ''); : '');
code = mergeComments(code, comments) code = mergeComments(code, comments)
} }
...@@ -549,7 +563,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag ...@@ -549,7 +563,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
var comments = ['']; var comments = [''];
for (var i in extra['type_constructor_doc']) for (var i in extra['type_constructor_doc'])
comments.push(extra['type_constructor_doc'][i].length > 1 comments.push(extra['type_constructor_doc'][i].length > 1
? '//* ' + extra['type_constructor_doc'][i][1].replace('\n', ' ') ? extra['type_constructor_doc'][i][1]
: ''); : '');
code = mergeComments(code, comments) code = mergeComments(code, comments)
} }
......
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