Skip to content

Commit

Permalink
insert the svg class diagram dynamically instead of by concat
Browse files Browse the repository at this point in the history
fixes #1530
jsdoc got confused by seeing 22K of SVG and it inserted some HTML tags into it
this isn't a great solution but it's easier than learning some new tools to replace text in files
  • Loading branch information
gordonwoodhull committed Jun 19, 2019
1 parent 173923d commit 8bebbb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 411 deletions.
15 changes: 2 additions & 13 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ module.exports = function (grunt) {
sourceMap: true,
banner: '<%= conf.banner %>'
}
},
welcome: {
src: ['docs/welcome.base.md', 'web/img/class-hierarchy.svg'],
dest: 'welcome.md',
options: {
process: function (src, filepath) {
return /svg/.test(filepath) ?
src.split('\n').slice(5).join('\n') :
src;
}
}
}
},
sass: {
Expand Down Expand Up @@ -98,7 +87,7 @@ module.exports = function (grunt) {
},
watch: {
jsdoc2md: {
files: ['welcome.md', '<%= conf.src %>/**/*.js'],
files: ['docs/welcome.base.md', '<%= conf.src %>/**/*.js'],
tasks: ['build', 'jsdoc', 'jsdoc2md']
},
scripts: {
Expand Down Expand Up @@ -285,7 +274,7 @@ module.exports = function (grunt) {
},
jsdoc: {
dist: {
src: ['welcome.md', '<%= conf.src %>/**/*.js', '!<%= conf.src %>/{banner,footer}.js'],
src: ['docs/welcome.base.md', '<%= conf.src %>/**/*.js', '!<%= conf.src %>/{banner,footer}.js'],
options: {
destination: 'web/docs/html',
template: 'node_modules/ink-docstrap/template',
Expand Down
10 changes: 10 additions & 0 deletions docs/welcome.base.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ The entire library is scoped under {@link dc the dc namespace}. Its child namesp

A class diagram is shown below - mixins are blue and chart classes are green. (Relations between mixins are somewhat subjective.)

<a id="insert-svg-here" />
<script src="../../js/promise-polyfill.js"></script>
<script src="../../js/fetch.umd.js"></script>
<script>
window.fetch("../../img/class-hierarchy.svg").then(function(result) {
result.text().then(function(content) {
document.getElementById('insert-svg-here').outerHTML = content;
});
});
</script>
Loading

0 comments on commit 8bebbb2

Please sign in to comment.