diff options
author | Alexander Early <alexander.early@gmail.com> | 2016-06-30 17:27:47 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2016-06-30 17:27:47 -0700 |
commit | 7405cf083e436b3d157ba543f5bc979ada561bee (patch) | |
tree | a67fc81ef5756b0072853a42488f8b1525c9c984 | |
parent | 2115e805960a1239ffa306c2eb17a4cac4f6756f (diff) | |
download | async-7405cf083e436b3d157ba543f5bc979ada561bee.tar.gz |
copy custom head data into theme
-rw-r--r-- | support/jsdoc/head-data.html | 10 | ||||
-rw-r--r-- | support/jsdoc/jsdoc-custom.css | 16 | ||||
-rw-r--r-- | support/jsdoc/jsdoc-fix-html.js | 17 | ||||
-rw-r--r-- | support/jsdoc/theme/static/styles/jsdoc-default.css | 13 | ||||
-rw-r--r-- | support/jsdoc/theme/tmpl/layout.tmpl | 12 |
5 files changed, 33 insertions, 35 deletions
diff --git a/support/jsdoc/head-data.html b/support/jsdoc/head-data.html deleted file mode 100644 index c8bd13c..0000000 --- a/support/jsdoc/head-data.html +++ /dev/null @@ -1,10 +0,0 @@ -<meta charset="utf-8"> -<meta name="viewport" content="width=device-width, initial-scale=1"> - -<link rel="icon" href="favicon.ico?v=2" /> -<link src="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css"> -<link src="text/css" rel="stylesheet" href="styles/jsdoc-custom.css"> -<script src="https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js"></script> -<script src="https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js"></script> -<script src="https://cdn.jsdelivr.net/typeahead.js/0.11.1/typeahead.bundle.min.js"></script> -<script src="scripts/async.js"></script> diff --git a/support/jsdoc/jsdoc-custom.css b/support/jsdoc/jsdoc-custom.css index 8d988d4..b42226d 100644 --- a/support/jsdoc/jsdoc-custom.css +++ b/support/jsdoc/jsdoc-custom.css @@ -1,19 +1,3 @@ -.page-title { - padding-top: 12px; -} - -.navbar-fixed-top { - background-color: #101010; -} - -.navbar-fixed-top .navbar-right { - padding-right: 10px; -} - -.navbar .ion-social-github { - font-size: 1.2em; -} - body { height: 100%; width: 100%; diff --git a/support/jsdoc/jsdoc-fix-html.js b/support/jsdoc/jsdoc-fix-html.js index 667d869..a7fb920 100644 --- a/support/jsdoc/jsdoc-fix-html.js +++ b/support/jsdoc/jsdoc-fix-html.js @@ -88,8 +88,7 @@ function combineFakeModules(files, callback) { }); } -function applyPreCheerioFixes(data, headLinks) { - var closingHeadTag = '</head>' +function applyPreCheerioFixes(data) { var customScript = '<script src="scripts/jsdoc-custom.js"></script>\n'; var closingBodyTag = '</body>'; @@ -100,7 +99,7 @@ function applyPreCheerioFixes(data, headLinks) { var rIncorrectModuleText = />module:(\w+)\.(\w+)</g // the heading needs additional padding at the top so it doesn't get cutoff - return data.replace(closingHeadTag, headLinks+closingHeadTag) + return data // inject the async library onto each page .replace(closingBodyTag, customScript+closingBodyTag) // for JSDoc to work, the module needs to be labelled 'ControlFlow', while @@ -111,12 +110,12 @@ function applyPreCheerioFixes(data, headLinks) { .replace(rIncorrectModuleText, function(match, moduleName, methodName) { return '>'+methodName+'<'; }); -}; +} function addStaticHeader($file, $headerContent) { var $body = $file.find('body'); $body.prepend($headerContent); -}; +} function fixToc($page, moduleFiles) { // remove `async` listing from toc @@ -149,12 +148,12 @@ function fixFooter($page) { var $footer = $page.find('footer'); $footer.append(additionalFooterText); $page.find('#main').append($footer); -}; +} function fixModuleLinks(files, callback) { var moduleFiles = extractModuleFiles(files); - async.map(['head-data.html', 'navbar.html'], function(filename, fileCallback) { + async.map(['navbar.html'], function(filename, fileCallback) { fs.readFile(path.join(__dirname, filename), 'utf8', function(err, data) { if (err) return fileCallback(err); return fileCallback(null, data); @@ -162,12 +161,12 @@ function fixModuleLinks(files, callback) { }, function(err, results) { if (err) return callback(err); - var $headerContent = $(results[1]); + var $headerContent = $(results[0]); async.each(files, function(file, fileCallback) { var filePath = path.join(docsDir, file); fs.readFile(filePath, 'utf8', function(err, fileData) { if (err) return fileCallback(err); - var $file = $(applyPreCheerioFixes(fileData, results[0])); + var $file = $(applyPreCheerioFixes(fileData)); addStaticHeader($file, $headerContent); fixToc($file, moduleFiles); diff --git a/support/jsdoc/theme/static/styles/jsdoc-default.css b/support/jsdoc/theme/static/styles/jsdoc-default.css index af6f87c..9b4282e 100644 --- a/support/jsdoc/theme/static/styles/jsdoc-default.css +++ b/support/jsdoc/theme/static/styles/jsdoc-default.css @@ -51,6 +51,7 @@ h1 { } h1.page-title { + padding-top: 12px; font-size: 48px; margin: 1em 30px; } @@ -209,6 +210,18 @@ nav > h2 > a { color: hsl(202, 71%, 50%) !important; } +.navbar-fixed-top { + background-color: #101010; +} + +.navbar-fixed-top .navbar-right { + padding-right: 10px; +} + +.navbar .ion-social-github { + font-size: 1.2em; +} + footer { color: hsl(0, 0%, 28%); margin-left: 250px; diff --git a/support/jsdoc/theme/tmpl/layout.tmpl b/support/jsdoc/theme/tmpl/layout.tmpl index 3b58d97..bd199b2 100644 --- a/support/jsdoc/theme/tmpl/layout.tmpl +++ b/support/jsdoc/theme/tmpl/layout.tmpl @@ -2,8 +2,14 @@ <html lang="en"> <head> <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?js= title ?> - Documentation</title> + + <link rel="icon" href="favicon.ico?v=2" /> + <link src="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css"> + <script src="scripts/async.js"></script> + <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> @@ -11,7 +17,13 @@ <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> + <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> + <link src="text/css" rel="stylesheet" href="styles/jsdoc-custom.css"> + + <script src="https://cdn.jsdelivr.net/jquery/2.2.4/jquery.min.js"></script> + <script src="https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js"></script> + <script src="https://cdn.jsdelivr.net/typeahead.js/0.11.1/typeahead.bundle.min.js"></script> </head> <body> |