commit
49108e640f
|
@ -38,7 +38,7 @@ handle remainder => sub {
|
|||
group => 'base',
|
||||
item => 0,
|
||||
options => {
|
||||
content => 'DDH.cheat_sheets.detail',
|
||||
content => "DDH.cheat_sheets.detail",
|
||||
moreAt => 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
}
|
||||
|
||||
.zci--cheat_sheets .cheatsheet__title {
|
||||
padding-bottom: 1em;
|
||||
padding: 16px 0 12px;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -15,39 +15,91 @@
|
|||
.zci--cheat_sheets .cheatsheet__container .cheatsheet__section {
|
||||
width: 295px;
|
||||
float: left;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets td {
|
||||
vertical-align: top;
|
||||
padding-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
/* style defaults */
|
||||
|
||||
.zci--cheat_sheets code {
|
||||
display: inline-block;
|
||||
border: 1px solid #e0e0e0;
|
||||
padding: 2px 5px 0px;
|
||||
padding: 3px 4px 1px;
|
||||
border-radius: 2px;
|
||||
font-size: 0.833em;
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
white-space: normal;
|
||||
word-break: normal;
|
||||
margin-bottom: 0.2em;
|
||||
line-height: 1.4;
|
||||
line-height: 1.17;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets td.cheatsheet__key {
|
||||
min-width: 80px;
|
||||
line-height: 1.7;
|
||||
vertical-align: top;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets td.cheatsheet__value {
|
||||
padding-top: 3px;
|
||||
padding-left: 14px;
|
||||
line-height: 1.4;
|
||||
padding-top: 3px;
|
||||
padding-left: 18px;
|
||||
vertical-align: top;
|
||||
line-height: 1.18;
|
||||
}
|
||||
|
||||
/* terminal-snippets.handlebars */
|
||||
|
||||
.zci--cheat_sheets .terminal-snippets td {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .terminal-snippets code {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .terminal-snippets td.cheatsheet__key {
|
||||
display: block;
|
||||
min-width: 100%;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .terminal-snippets td.cheatsheet__value {
|
||||
display: block;
|
||||
min-width: 100%;
|
||||
padding-top: 0px;
|
||||
padding-left: 7px;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
/* reference-sheet.handlebars */
|
||||
|
||||
.zci--cheat_sheets .reference-sheet ul {
|
||||
padding: 0;
|
||||
margin-left: 13px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .reference-sheet li {
|
||||
position: relative;
|
||||
padding-bottom: 12px;
|
||||
padding-left: 7px;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .reference-sheet li::before {
|
||||
position: absolute;
|
||||
left: -12px;
|
||||
content: '●';
|
||||
color: inherit;
|
||||
font-size: 7px;
|
||||
}
|
||||
|
||||
.zci--cheat_sheets .reference-sheet li .cheatsheet__key {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
||||
.zci--cheat_sheets .cheatsheet__footer {
|
||||
padding-top: 10px;
|
||||
clear: both;
|
||||
|
|
|
@ -2,8 +2,13 @@ DDH.cheat_sheets = DDH.cheat_sheets || {};
|
|||
|
||||
DDH.cheat_sheets.build = function(ops) {
|
||||
|
||||
Spice.registerHelper('cheatsheets_ordered', function(sections, section_order, options) {
|
||||
Spice.registerHelper('cheatsheets_ordered', function(sections, section_order, template_type, options) {
|
||||
var result = "";
|
||||
var template = {
|
||||
type: template_type,
|
||||
path: template_type ? 'DDH.cheat_sheets.' + template_type : 'DDH.cheat_sheets.keyboard-shortcuts'
|
||||
};
|
||||
|
||||
$.each(section_order, function(i, section) {
|
||||
if (sections[section]){
|
||||
|
||||
|
@ -15,7 +20,7 @@ DDH.cheat_sheets.build = function(ops) {
|
|||
showhide = false;
|
||||
}
|
||||
|
||||
result += options.fn({ name: section, items: sections[section], showhide: showhide });
|
||||
result += options.fn({ name: section, items: sections[section], template: template, showhide: showhide });
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
@ -25,10 +30,11 @@ DDH.cheat_sheets.build = function(ops) {
|
|||
re_whitespace = /\s+/, // search for spaces
|
||||
re_codeblock = /<code>(.+?)<\/code>/g; // search for <code></code>
|
||||
|
||||
Spice.registerHelper('cheatsheets_codeblock', function(string, options) {
|
||||
Spice.registerHelper('cheatsheets_codeblock', function(string, className, options) {
|
||||
|
||||
var out;
|
||||
|
||||
var codeClass = typeof className === "string" ? className : "bg-clr--white";
|
||||
|
||||
// replace escaped slashes and brackets
|
||||
string = string.replace(/\\\\/, "<bks>")
|
||||
.replace(/\\\[/g, "<lbr>")
|
||||
|
@ -42,7 +48,7 @@ DDH.cheat_sheets.build = function(ops) {
|
|||
// e.g "?()", ":sp filename"
|
||||
// --> wrap whole sting in <code></code>
|
||||
if ( !re_whitespace.test(string) || !re_brackets.test(string) ){
|
||||
out = "<code>" + string + "</code>";
|
||||
out = "<code class='"+codeClass+"'>" + string + "</code>";
|
||||
|
||||
// spaces
|
||||
// AND
|
||||
|
@ -53,7 +59,7 @@ DDH.cheat_sheets.build = function(ops) {
|
|||
|
||||
// replace unescaped brackets
|
||||
out = string
|
||||
.replace(/\[|\{/g, "<code>")
|
||||
.replace(/\[|\{/g, "<code class='"+codeClass+"'>")
|
||||
.replace(/\]|\}/g, "</code>");
|
||||
}
|
||||
|
||||
|
@ -66,9 +72,9 @@ DDH.cheat_sheets.build = function(ops) {
|
|||
.replace(/<rbr>/g, "]")
|
||||
.replace(/<rcbr>/g, "}");
|
||||
|
||||
out = out.replace(re_codeblock, function esc_codeblock (match, p1, offset, string){
|
||||
out = out.replace(re_codeblock, function esc_codeblock (match, p1, offset, string, codeClass){
|
||||
var escaped = Handlebars.Utils.escapeExpression(p1);
|
||||
return "<code>" + escaped + "</code>";
|
||||
return "<code class='"+codeClass+">" + escaped + "</code>";
|
||||
});
|
||||
|
||||
return new Handlebars.SafeString(out);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<table>
|
||||
<tbody>
|
||||
{{#each items}}
|
||||
<tr>
|
||||
<td class="cheatsheet__key">
|
||||
{{cheatsheets_codeblock key 'bg-clr--platinum'}}
|
||||
</td>
|
||||
<td class="cheatsheet__value tx-clr--slate-light">
|
||||
{{val}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
|
@ -2,26 +2,11 @@
|
|||
<h4 class="c-base__sub">{{description}}</h4>
|
||||
|
||||
<div class="cheatsheet__container compressed" >
|
||||
{{#cheatsheets_ordered sections section_order}}
|
||||
<div class="cheatsheet__section {{#if showhide}} showhide is-hidden {{/if}}">
|
||||
<span>
|
||||
<h6 class="cheatsheet__title tx-clr--slate">{{name}}</h6>
|
||||
</span>
|
||||
<table>
|
||||
<tbody>
|
||||
{{#each items}}
|
||||
<tr>
|
||||
<td class="cheatsheet__key">
|
||||
{{cheatsheets_codeblock key}}
|
||||
</td>
|
||||
<td class="cheatsheet__value">
|
||||
{{val}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{#cheatsheets_ordered sections section_order template_type}}
|
||||
<div class="cheatsheet__section {{template.type}}{{#if showhide}} showhide is-hidden {{/if}}">
|
||||
<h6 class="cheatsheet__title tx-clr--slate">{{name}}</h6>
|
||||
{{{include template.path}}}
|
||||
</div>
|
||||
{{/cheatsheets_ordered}}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"sourceName": "GitHub",
|
||||
"sourceUrl": "https://training.github.com/kit/downloads/github-git-cheat-sheet"
|
||||
},
|
||||
"template_type" : "terminal-snippets",
|
||||
"section_order": [
|
||||
"Configure Tooling",
|
||||
"Create Repositories",
|
||||
|
@ -124,7 +125,7 @@
|
|||
"Synchronize Changes": [{
|
||||
"val": "Downloads all history from the repository bookmark",
|
||||
"key": "$ git fetch \\[bookmark\\]"
|
||||
|
||||
|
||||
}, {
|
||||
"val": "Combines bookmark's branch into current local branches",
|
||||
"key": "$ git merge \\[bookmark\\]/\\[branch\\]"
|
||||
|
@ -137,4 +138,3 @@
|
|||
}]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"metadata": {
|
||||
"sourceName": "Harrypotterspells",
|
||||
"sourceUrl": "http://harrypotterspells.net/"
|
||||
},
|
||||
},
|
||||
"section_order" : ["A","B","C","D","E","F","G","H","I","L","M","N","O","P","Q","R","S","T","W"],
|
||||
"sections":{
|
||||
"A": [{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<table>
|
||||
<tbody>
|
||||
{{#each items}}
|
||||
<tr>
|
||||
<td class="cheatsheet__key">
|
||||
{{cheatsheets_codeblock key}}
|
||||
</td>
|
||||
<td class="cheatsheet__value tx-clr--slate-light">
|
||||
{{val}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,8 @@
|
|||
<ul>
|
||||
{{#each items}}
|
||||
<li class="text--primary">
|
||||
<span class="cheatsheet__key">{{key}}</span>
|
||||
<span class="cheatsheet__value text--secondary">{{val}}</span>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
|
@ -6,6 +6,7 @@
|
|||
"sourceName": "Cheatography",
|
||||
"sourceUrl": "http://www.cheatography.com/davechild/cheat-sheets/regular-expressions/"
|
||||
},
|
||||
"template_type": "code-snippets",
|
||||
"section_order": ["Anchors", "Character Classes", "POSIX Classes", "Pattern Modifiers", "Escape Sequences", "Quantifiers", "Groups and Ranges", "Assertions", "Special Characters", "String Replacement"],
|
||||
"sections": {
|
||||
"Assertions": [{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<table>
|
||||
<tbody>
|
||||
{{#each items}}
|
||||
<tr>
|
||||
<td class="cheatsheet__key">
|
||||
{{cheatsheets_codeblock key 'bg-clr--platinum'}}
|
||||
</td>
|
||||
<td class="cheatsheet__value tx-clr--slate-light">
|
||||
{{val}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
|
@ -6,6 +6,7 @@
|
|||
"sourceName": "VimCheatSheet",
|
||||
"sourceUrl": "http://vim.rtorr.com"
|
||||
},
|
||||
"template_type": "keyboard-shortcuts",
|
||||
"section_order": [
|
||||
"Cursor movement",
|
||||
"Insert mode - inserting/appending text",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"sourceName": "Wikipedia",
|
||||
"sourceUrl": "https://en.wikipedia.org/wiki/Wu-Tang_Clan#Members"
|
||||
},
|
||||
"template_type": "reference-sheet",
|
||||
"section_order": ["Members"],
|
||||
"sections": {
|
||||
"Members": [{
|
||||
|
@ -42,4 +43,3 @@
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue