mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-28 07:39:57 +02:00
Merge pull request #38 from twbs/customizer-remnants
remove remaining remnants of the Customizer
This commit is contained in:
@@ -36,7 +36,6 @@ Our bug tracker utilizes several labels to help organize and identify issues. He
|
|||||||
- `browser bug` - Issues that are reported to us, but actually are the result of a browser-specific bug. These are diagnosed with reduced test cases and result in a issue opened on that browser's own bug tracker.
|
- `browser bug` - Issues that are reported to us, but actually are the result of a browser-specific bug. These are diagnosed with reduced test cases and result in a issue opened on that browser's own bug tracker.
|
||||||
- `confirmed` - Issues that have been confirmed with a reduced test case and identify a bug in Bootstrap.
|
- `confirmed` - Issues that have been confirmed with a reduced test case and identify a bug in Bootstrap.
|
||||||
- `css` - Issues stemming from our compiled CSS or source Less files.
|
- `css` - Issues stemming from our compiled CSS or source Less files.
|
||||||
- `customizer` - Issues with our web-based Customizer.
|
|
||||||
- `docs` - Issues for improving or updating our documentation.
|
- `docs` - Issues for improving or updating our documentation.
|
||||||
- `examples` - Issues involving the example templates included in our docs.
|
- `examples` - Issues involving the example templates included in our docs.
|
||||||
- `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v3.0.0` to `v3.1.0`).
|
- `feature` - Issues asking for a new feature to be added, or an existing one to be extended or modified. New features require a minor version bump (e.g., `v3.0.0` to `v3.1.0`).
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
<!-- NOTE: DO NOT EDIT THE FOLLOWING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-nav.jade template.-->
|
|
||||||
<li><a href="#import">Import</a></li>
|
|
||||||
<li><a href="#less">Less components</a></li>
|
|
||||||
<li><a href="#plugins">jQuery plugins</a></li>
|
|
||||||
<li><a href="#less-variables">Less variables</a>
|
|
||||||
<ul class="nav">
|
|
||||||
<li><a href="#colors">Colors</a></li>
|
|
||||||
<li><a href="#scaffolding">Scaffolding</a></li>
|
|
||||||
<li><a href="#global-settings">Global settings</a></li>
|
|
||||||
<li><a href="#typography">Typography</a></li>
|
|
||||||
<li><a href="#components">Components</a></li>
|
|
||||||
<li><a href="#tables">Tables</a></li>
|
|
||||||
<li><a href="#buttons">Buttons</a></li>
|
|
||||||
<li><a href="#forms">Forms</a></li>
|
|
||||||
<li><a href="#dropdowns">Dropdowns</a></li>
|
|
||||||
<li><a href="#media-queries-breakpoints">Media queries breakpoints</a></li>
|
|
||||||
<li><a href="#grid-system">Grid system</a></li>
|
|
||||||
<li><a href="#container-sizes">Container sizes</a></li>
|
|
||||||
<li><a href="#navbar">Navbar</a></li>
|
|
||||||
<li><a href="#navs">Navs</a></li>
|
|
||||||
<li><a href="#tabs">Tabs</a></li>
|
|
||||||
<li><a href="#pills">Pills</a></li>
|
|
||||||
<li><a href="#pagination">Pagination</a></li>
|
|
||||||
<li><a href="#pager">Pager</a></li>
|
|
||||||
<li><a href="#jumbotron">Jumbotron</a></li>
|
|
||||||
<li><a href="#form-states-and-alerts">Form states and alerts</a></li>
|
|
||||||
<li><a href="#tooltips">Tooltips</a></li>
|
|
||||||
<li><a href="#popovers">Popovers</a></li>
|
|
||||||
<li><a href="#labels">Labels</a></li>
|
|
||||||
<li><a href="#modals">Modals</a></li>
|
|
||||||
<li><a href="#alerts">Alerts</a></li>
|
|
||||||
<li><a href="#progress-bars">Progress bars</a></li>
|
|
||||||
<li><a href="#list-group">List group</a></li>
|
|
||||||
<li><a href="#thumbnails">Thumbnails</a></li>
|
|
||||||
<li><a href="#badges">Badges</a></li>
|
|
||||||
<li><a href="#breadcrumbs">Breadcrumbs</a></li>
|
|
||||||
<li><a href="#carousel">Carousel</a></li>
|
|
||||||
<li><a href="#close">Close</a></li>
|
|
||||||
<li><a href="#code">Code</a></li>
|
|
||||||
<li><a href="#type">Type</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li><a href="#download">Download</a></li>
|
|
||||||
<!-- NOTE: DO NOT EDIT THE PRECEDING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-nav.jade template.-->
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
|||||||
// NOTE: DO NOT EDIT THE FOLLOWING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-nav.jade template.
|
|
||||||
li
|
|
||||||
a(href='#import-drop-target') Import
|
|
||||||
li
|
|
||||||
a(href='#less') Less components
|
|
||||||
li
|
|
||||||
a(href='#plugins') jQuery plugins
|
|
||||||
li
|
|
||||||
a(href='#less-variables') Less variables
|
|
||||||
ul.nav
|
|
||||||
each section in sections
|
|
||||||
if section.customizable
|
|
||||||
li
|
|
||||||
a(href='#'+section.id)= section.heading
|
|
||||||
li
|
|
||||||
a(href='#download') Download
|
|
||||||
// NOTE: DO NOT EDIT THE PRECEDING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-nav.jade template.
|
|
@@ -1,23 +0,0 @@
|
|||||||
// NOTE: DO NOT EDIT THE FOLLOWING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-variables.jade template.
|
|
||||||
each section in sections
|
|
||||||
if section.customizable
|
|
||||||
h2(id=section.id)= section.heading
|
|
||||||
if section.docstring
|
|
||||||
p!= section.docstring.html
|
|
||||||
each subsection in section.subsections
|
|
||||||
if subsection.heading
|
|
||||||
h3(id=subsection.id)= subsection.heading
|
|
||||||
div.row
|
|
||||||
each variable, index in subsection.variables
|
|
||||||
if index > 0 && index % 3 === 0
|
|
||||||
div.clearfix
|
|
||||||
div.col-xs-4
|
|
||||||
label(for="input-" + variable.name)= variable.name
|
|
||||||
input.form-control(
|
|
||||||
id="input-" + variable.name
|
|
||||||
type="text"
|
|
||||||
value=variable.defaultValue
|
|
||||||
data-var=variable.name)
|
|
||||||
if variable.docstring
|
|
||||||
p.help-block!= variable.docstring.html
|
|
||||||
// NOTE: DO NOT EDIT THE PRECEDING SECTION DIRECTLY! It is autogenerated via the `build-customizer-html` Grunt task using the customizer-variables.jade template.
|
|
@@ -1308,122 +1308,6 @@ h1[id] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Customizer
|
|
||||||
*
|
|
||||||
* Since this is so form control heavy, we have quite a few styles to customize
|
|
||||||
* the display of inputs, headings, and more. Also included are all the download
|
|
||||||
* buttons and actions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.bs-customizer .toggle {
|
|
||||||
float: right;
|
|
||||||
margin-top: 25px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Headings and form contrls */
|
|
||||||
.bs-customizer label {
|
|
||||||
margin-top: 10px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
.bs-customizer h2 {
|
|
||||||
padding-top: 30px;
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.bs-customizer h3 {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer h4 {
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer .bs-callout h4 {
|
|
||||||
margin-top: 0; /* lame, but due to specificity we have to duplicate */
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.bs-customizer input[type="text"] {
|
|
||||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
.bs-customizer .help-block {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For the variables, use regular weight */
|
|
||||||
#less-section label {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Downloads */
|
|
||||||
.bs-customize-download .btn-outline {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Error handling */
|
|
||||||
.bs-customizer-alert {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1030;
|
|
||||||
padding: 15px 0;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #d9534f;
|
|
||||||
border-bottom: 1px solid #b94441;
|
|
||||||
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
|
|
||||||
}
|
|
||||||
.bs-customizer-alert .close {
|
|
||||||
margin-top: -4px;
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert .glyphicon {
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert pre {
|
|
||||||
margin: 10px 0 0;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #a83c3a;
|
|
||||||
border-color: #973634;
|
|
||||||
-webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);
|
|
||||||
box-shadow: inset 0 2px 4px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bs-dropzone {
|
|
||||||
position: relative;
|
|
||||||
padding: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
color: #777;
|
|
||||||
text-align: center;
|
|
||||||
border: 2px dashed #eee;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.bs-dropzone h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.bs-dropzone hr {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
.bs-dropzone .lead {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
/*.bs-dropzone*/ #import-manual-trigger {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.bs-dropzone p:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Brand guidelines
|
* Brand guidelines
|
||||||
*
|
*
|
||||||
|
7
docs/assets/js/raw-files.min.js
vendored
7
docs/assets/js/raw-files.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1198,120 +1198,6 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Customizer
|
|
||||||
//
|
|
||||||
|
|
||||||
.bs-customizer .toggle {
|
|
||||||
float: right;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Headings and form controls
|
|
||||||
.bs-customizer label {
|
|
||||||
margin-top: .5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
.bs-customizer h2 {
|
|
||||||
padding-top: 2rem;
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: .25rem;
|
|
||||||
}
|
|
||||||
.bs-customizer h3 {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer h4 {
|
|
||||||
margin-top: 1rem;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer .bs-callout h4 {
|
|
||||||
margin-top: 0; // lame, but due to specificity we have to duplicate
|
|
||||||
margin-bottom: .25rem;
|
|
||||||
}
|
|
||||||
.bs-customizer input[type="text"] {
|
|
||||||
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
.bs-customizer .help-block {
|
|
||||||
margin-bottom: .25rem;
|
|
||||||
font-size: 75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For the variables, use regular weight
|
|
||||||
#less-section label {
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Downloads
|
|
||||||
.bs-customize-download .btn-outline {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error handling
|
|
||||||
.bs-customizer-alert {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
left: 0;
|
|
||||||
z-index: 1030;
|
|
||||||
padding: 1rem 0;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #d9534f;
|
|
||||||
border-bottom: 1px solid #b94441;
|
|
||||||
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
|
|
||||||
box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
|
|
||||||
}
|
|
||||||
.bs-customizer-alert .close {
|
|
||||||
margin-top: -.25rem;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert p {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert .glyphicon {
|
|
||||||
margin-right: .25rem;
|
|
||||||
}
|
|
||||||
.bs-customizer-alert pre {
|
|
||||||
margin: .5rem 0 0;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #a83c3a;
|
|
||||||
border-color: #973634;
|
|
||||||
-webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);
|
|
||||||
box-shadow: inset 0 2px 4px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drag and drop
|
|
||||||
.bs-dropzone {
|
|
||||||
position: relative;
|
|
||||||
padding: 20px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
color: #777;
|
|
||||||
text-align: center;
|
|
||||||
border: 2px dashed #eee;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.bs-dropzone h2 {
|
|
||||||
margin-top: 0;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
.bs-dropzone .lead {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-weight: normal;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
.bs-dropzone hr {
|
|
||||||
width: 100px;
|
|
||||||
}
|
|
||||||
#import-manual-trigger {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.bs-dropzone p:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Brand guidelines
|
// Brand guidelines
|
||||||
//
|
//
|
||||||
|
@@ -1,238 +0,0 @@
|
|||||||
/*!
|
|
||||||
* Bootstrap Grunt task for parsing Less docstrings
|
|
||||||
* http://getbootstrap.com
|
|
||||||
* Copyright 2014 Twitter, Inc.
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
*/
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var Remarkable = require('remarkable');
|
|
||||||
|
|
||||||
function markdown2html(markdownString) {
|
|
||||||
var md = new Remarkable();
|
|
||||||
|
|
||||||
// the slice removes the <p>...</p> wrapper output by Markdown processor
|
|
||||||
return md.render(markdownString.trim()).slice(3, -5);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Mini-language:
|
|
||||||
//== This is a normal heading, which starts a section. Sections group variables together.
|
|
||||||
//## Optional description for the heading
|
|
||||||
|
|
||||||
//=== This is a subheading.
|
|
||||||
|
|
||||||
//** Optional description for the following variable. You **can** use Markdown in descriptions to discuss `<html>` stuff.
|
|
||||||
@foo: #fff;
|
|
||||||
|
|
||||||
//-- This is a heading for a section whose variables shouldn't be customizable
|
|
||||||
|
|
||||||
All other lines are ignored completely.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
var CUSTOMIZABLE_HEADING = /^[/]{2}={2}(.*)$/;
|
|
||||||
var UNCUSTOMIZABLE_HEADING = /^[/]{2}-{2}(.*)$/;
|
|
||||||
var SUBSECTION_HEADING = /^[/]{2}={3}(.*)$/;
|
|
||||||
var SECTION_DOCSTRING = /^[/]{2}#{2}(.+)$/;
|
|
||||||
var VAR_ASSIGNMENT = /^(@[a-zA-Z0-9_-]+):[ ]*([^ ;][^;]*);[ ]*$/;
|
|
||||||
var VAR_DOCSTRING = /^[/]{2}[*]{2}(.+)$/;
|
|
||||||
|
|
||||||
function Section(heading, customizable) {
|
|
||||||
this.heading = heading.trim();
|
|
||||||
this.id = this.heading.replace(/\s+/g, '-').toLowerCase();
|
|
||||||
this.customizable = customizable;
|
|
||||||
this.docstring = null;
|
|
||||||
this.subsections = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
Section.prototype.addSubSection = function (subsection) {
|
|
||||||
this.subsections.push(subsection);
|
|
||||||
};
|
|
||||||
|
|
||||||
function SubSection(heading) {
|
|
||||||
this.heading = heading.trim();
|
|
||||||
this.id = this.heading.replace(/\s+/g, '-').toLowerCase();
|
|
||||||
this.variables = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
SubSection.prototype.addVar = function (variable) {
|
|
||||||
this.variables.push(variable);
|
|
||||||
};
|
|
||||||
|
|
||||||
function VarDocstring(markdownString) {
|
|
||||||
this.html = markdown2html(markdownString);
|
|
||||||
}
|
|
||||||
|
|
||||||
function SectionDocstring(markdownString) {
|
|
||||||
this.html = markdown2html(markdownString);
|
|
||||||
}
|
|
||||||
|
|
||||||
function Variable(name, defaultValue) {
|
|
||||||
this.name = name;
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
this.docstring = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Tokenizer(fileContent) {
|
|
||||||
this._lines = fileContent.split('\n');
|
|
||||||
this._next = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tokenizer.prototype.unshift = function (token) {
|
|
||||||
if (this._next !== undefined) {
|
|
||||||
throw new Error('Attempted to unshift twice!');
|
|
||||||
}
|
|
||||||
this._next = token;
|
|
||||||
};
|
|
||||||
|
|
||||||
Tokenizer.prototype._shift = function () {
|
|
||||||
// returning null signals EOF
|
|
||||||
// returning undefined means the line was ignored
|
|
||||||
if (this._next !== undefined) {
|
|
||||||
var result = this._next;
|
|
||||||
this._next = undefined;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
if (this._lines.length <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
var line = this._lines.shift();
|
|
||||||
var match = null;
|
|
||||||
match = SUBSECTION_HEADING.exec(line);
|
|
||||||
if (match !== null) {
|
|
||||||
return new SubSection(match[1]);
|
|
||||||
}
|
|
||||||
match = CUSTOMIZABLE_HEADING.exec(line);
|
|
||||||
if (match !== null) {
|
|
||||||
return new Section(match[1], true);
|
|
||||||
}
|
|
||||||
match = UNCUSTOMIZABLE_HEADING.exec(line);
|
|
||||||
if (match !== null) {
|
|
||||||
return new Section(match[1], false);
|
|
||||||
}
|
|
||||||
match = SECTION_DOCSTRING.exec(line);
|
|
||||||
if (match !== null) {
|
|
||||||
return new SectionDocstring(match[1]);
|
|
||||||
}
|
|
||||||
match = VAR_DOCSTRING.exec(line);
|
|
||||||
if (match !== null) {
|
|
||||||
return new VarDocstring(match[1]);
|
|
||||||
}
|
|
||||||
var commentStart = line.lastIndexOf('//');
|
|
||||||
var varLine = (commentStart === -1) ? line : line.slice(0, commentStart);
|
|
||||||
match = VAR_ASSIGNMENT.exec(varLine);
|
|
||||||
if (match !== null) {
|
|
||||||
return new Variable(match[1], match[2]);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
Tokenizer.prototype.shift = function () {
|
|
||||||
while (true) {
|
|
||||||
var result = this._shift();
|
|
||||||
if (result === undefined) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function Parser(fileContent) {
|
|
||||||
this._tokenizer = new Tokenizer(fileContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
Parser.prototype.parseFile = function () {
|
|
||||||
var sections = [];
|
|
||||||
while (true) {
|
|
||||||
var section = this.parseSection();
|
|
||||||
if (section === null) {
|
|
||||||
if (this._tokenizer.shift() !== null) {
|
|
||||||
throw new Error('Unexpected unparsed section of file remains!');
|
|
||||||
}
|
|
||||||
return sections;
|
|
||||||
}
|
|
||||||
sections.push(section);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Parser.prototype.parseSection = function () {
|
|
||||||
var section = this._tokenizer.shift();
|
|
||||||
if (section === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!(section instanceof Section)) {
|
|
||||||
throw new Error('Expected section heading; got: ' + JSON.stringify(section));
|
|
||||||
}
|
|
||||||
var docstring = this._tokenizer.shift();
|
|
||||||
if (docstring instanceof SectionDocstring) {
|
|
||||||
section.docstring = docstring;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this._tokenizer.unshift(docstring);
|
|
||||||
}
|
|
||||||
this.parseSubSections(section);
|
|
||||||
|
|
||||||
return section;
|
|
||||||
};
|
|
||||||
|
|
||||||
Parser.prototype.parseSubSections = function (section) {
|
|
||||||
while (true) {
|
|
||||||
var subsection = this.parseSubSection();
|
|
||||||
if (subsection === null) {
|
|
||||||
if (section.subsections.length === 0) {
|
|
||||||
// Presume an implicit initial subsection
|
|
||||||
subsection = new SubSection('');
|
|
||||||
this.parseVars(subsection);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
section.addSubSection(subsection);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (section.subsections.length === 1 && !(section.subsections[0].heading) && section.subsections[0].variables.length === 0) {
|
|
||||||
// Ignore lone empty implicit subsection
|
|
||||||
section.subsections = [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Parser.prototype.parseSubSection = function () {
|
|
||||||
var subsection = this._tokenizer.shift();
|
|
||||||
if (subsection instanceof SubSection) {
|
|
||||||
this.parseVars(subsection);
|
|
||||||
return subsection;
|
|
||||||
}
|
|
||||||
this._tokenizer.unshift(subsection);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
Parser.prototype.parseVars = function (subsection) {
|
|
||||||
while (true) {
|
|
||||||
var variable = this.parseVar();
|
|
||||||
if (variable === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
subsection.addVar(variable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Parser.prototype.parseVar = function () {
|
|
||||||
var docstring = this._tokenizer.shift();
|
|
||||||
if (!(docstring instanceof VarDocstring)) {
|
|
||||||
this._tokenizer.unshift(docstring);
|
|
||||||
docstring = null;
|
|
||||||
}
|
|
||||||
var variable = this._tokenizer.shift();
|
|
||||||
if (variable instanceof Variable) {
|
|
||||||
variable.docstring = docstring;
|
|
||||||
return variable;
|
|
||||||
}
|
|
||||||
this._tokenizer.unshift(variable);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Parser;
|
|
@@ -1,46 +0,0 @@
|
|||||||
/*!
|
|
||||||
* Bootstrap Grunt task for generating raw-files.min.js for the Customizer
|
|
||||||
* http://getbootstrap.com
|
|
||||||
* Copyright 2014 Twitter, Inc.
|
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* global btoa: true */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
var fs = require('fs');
|
|
||||||
var btoa = require('btoa');
|
|
||||||
var glob = require('glob');
|
|
||||||
|
|
||||||
function getFiles(type) {
|
|
||||||
var files = {};
|
|
||||||
var recursive = (type === 'less');
|
|
||||||
var globExpr = (recursive ? '/**/*' : '/*');
|
|
||||||
glob.sync(type + globExpr)
|
|
||||||
.filter(function (path) {
|
|
||||||
return type === 'fonts' ? true : new RegExp('\\.' + type + '$').test(path);
|
|
||||||
})
|
|
||||||
.forEach(function (fullPath) {
|
|
||||||
var relativePath = fullPath.replace(/^[^/]+\//, '');
|
|
||||||
files[relativePath] = (type === 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'));
|
|
||||||
});
|
|
||||||
return 'var __' + type + ' = ' + JSON.stringify(files) + '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function generateRawFilesJs(grunt, banner) {
|
|
||||||
if (!banner) {
|
|
||||||
banner = '';
|
|
||||||
}
|
|
||||||
var dirs = ['js', 'less'];
|
|
||||||
var files = banner + dirs.map(getFiles).reduce(function (combined, file) {
|
|
||||||
return combined + file;
|
|
||||||
}, '');
|
|
||||||
var rawFilesJs = 'docs/assets/js/raw-files.min.js';
|
|
||||||
try {
|
|
||||||
fs.writeFileSync(rawFilesJs, files);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
grunt.fail.warn(err);
|
|
||||||
}
|
|
||||||
grunt.log.writeln('File ' + rawFilesJs.cyan + ' created.');
|
|
||||||
};
|
|
Reference in New Issue
Block a user