不要怂,就是干,撸起袖子干!

Commit 94983785 by Pedro Augusto de Paula Barbosa Committed by Simon Schick

docs(data-types): separate nav menu (#10898)

1 parent 6091ca98
......@@ -60,6 +60,9 @@
]
}
}
},
{
"name": "./docs/plugins/group-data-types"
}
]
}
......@@ -38,3 +38,9 @@ a[href^="file/lib/"] {
box-shadow: none !important;
max-width: 300px;
}
.navigation {
margin-top: 40px !important;
padding-top: 0;
height: calc(100% - 40px);
}
\ No newline at end of file
'use strict';
const path = require('path');
const cheerio = require('cheerio');
function groupDataTypes($) {
let firstLi;
$('nav a').each(function() {
/* eslint-disable no-invalid-this */
if ($(this).attr('href').startsWith('class/lib/data-types.js~')) {
const li = $(this).closest('li');
if (!firstLi) {
firstLi = li;
firstLi.prepend('<a data-ice="dirPath" class="nav-dir-path" href="variable/index.html#static-variable-DataTypes">datatypes</a>');
firstLi.appendTo(firstLi.parent());
} else {
firstLi.after(li);
}
}
});
}
class GroupDataTypesPlugin {
onHandleContent(ev) {
if (path.extname(ev.data.fileName) !== '.html') return;
const $ = cheerio.load(ev.data.content);
groupDataTypes($);
$('nav li[data-ice=doc]:first-child').css('margin-top', '15px');
ev.data.content = $.html();
}
}
module.exports = new GroupDataTypesPlugin();
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!