Skip to content

Commit c2d0a0a

Browse files
authored
Merge pull request #33 from ita-design-system/develop
Upgrade to v0.9.0
2 parents 8dd651f + 19553f1 commit c2d0a0a

22 files changed

+181
-75
lines changed

.eleventy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function(eleventyConfig) {
2626
eleventyConfig.addAsyncFilter("datePrefixText", libdocFunctions.filters.datePrefixText);
2727
eleventyConfig.addAsyncFilter("toc", libdocFunctions.filters.toc);
2828
eleventyConfig.addAsyncFilter("sanitizeJSON", libdocFunctions.filters.sanitizeJson);
29+
eleventyConfig.addAsyncFilter("gitLastModifiedDate", libdocFunctions.filters.gitLastModifiedDate);
2930
// END FILTERS
3031

3132
// START COLLECTIONS

_data/libdocFunctions.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// https://github.com/11ty/eleventy/issues/3128#issuecomment-1878745864
44
import { createRequire } from "node:module";
55
const require = createRequire(import.meta.url);
6+
const childProcess = require('child_process');
67
// END IMPORT REQUIRE WORKAROUND
78

89
// START JSON IMPORT WORKAROUND
@@ -164,20 +165,42 @@ export default {
164165
tocMarkup += '</ol>';
165166
}
166167
return tocMarkup;
168+
},
169+
gitLastModifiedDate: async function(filePath) {
170+
// Run the git log command
171+
// https://jamesdoc.com/blog/2023/git-changelog-in-11ty/
172+
let fileHistory = childProcess
173+
.execSync(`git log --pretty=tformat:"%cs" ${filePath}`)
174+
.toString()
175+
.trim();
176+
177+
// If the file isn't committed to git then ignore
178+
if (fileHistory == "") { return false }
179+
180+
return fileHistory.split(/\r?\n/)[0];
167181
}
168182
},
169183
collections: {
170184
myTags: function(collectionsApi) {
171185
const allData = collectionsApi.getAll();
172-
let finalData = [];
186+
let unsortedTagsCount = {};
173187
allData.forEach(function(item) {
174188
if (typeof item.data.tags == 'object') {
175189
item.data.tags.forEach(function(tag) {
176-
if (!finalData.includes(tag) && tag != 'post') finalData.push(tag);
190+
if (tag !== 'post') {
191+
if (unsortedTagsCount[tag] === undefined) {
192+
unsortedTagsCount[tag] = 1
193+
} else {
194+
unsortedTagsCount[tag]++
195+
}
196+
}
177197
})
178198
}
179199
});
180-
return finalData;
200+
let sortedObject = Object.fromEntries(
201+
Object.entries(unsortedTagsCount).sort(([, a], [, b]) => b - a)
202+
);
203+
return Object.entries(sortedObject);
181204
},
182205
postsByDateDescending: function(collectionsApi) {
183206
return collectionsApi.getFilteredByTag("post").sort(function (a, b) {

_includes/libdoc_before_html.liquid

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
{%- if pagePathUrl[1] == 'tags' -%}
3434
{%- assign pageTitle = libdocMessages.tagsList[pageLang] -%}
3535
{%- assign pageDescription = libdocMessages.tagsListDescription[pageLang] -%}
36+
{%- if pagePathUrl[2] -%}
37+
{%- assign pageTitle = pagePathUrl[2] -%}
38+
{%- capture pageDescription -%}
39+
{{ libdocMessages.pagesTagged[pageLang] }} <em>{{ pagePathUrl[2] }}</em>
40+
{%- endcapture -%}
41+
{%- endif -%}
3642
{%- endif -%}
3743

3844
{%- if eleventyNavigation.key -%}
@@ -46,13 +52,6 @@
4652
{%- assign pageTitle = libdocMessages.search[pageLang] -%}
4753
{%- endif -%}
4854

49-
{%- if tag -%}
50-
{%- assign pageTitle = tag -%}
51-
{%- capture pageDescription -%}
52-
{{ libdocMessages.pagesTagged[pageLang] }} <em>{{ tag }}</em>
53-
{%- endcapture -%}
54-
{%- endif -%}
55-
5655
{%- if tocEnabled == true -%}
5756
{%- assign tocMarkup = content | toc -%}
5857
{%- elsif tocEnabled != false and libdocConfig.tocEnabled -%}

_includes/libdoc_page.liquid

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,22 @@
8282
<noscript>
8383
<link rel="stylesheet" href="/core/assets/css/noscript.css">
8484
</noscript>
85-
{% comment %} <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/nord.min.css"> {% endcomment %}
86-
{% comment %} <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/ir-black.min.css"> {% endcomment %}
87-
{% comment %} <link rel="stylesheet" href="/assets/css/monokai-sublime.css"> {% endcomment %}
88-
8985
<script>
9086
const libdocMessages = {
9187
{% for key in libdocMessages %}
9288
{{ key[0] }}: `{{ libdocMessages[key[0]][pageLang] }}`,
9389
{%- endfor %}
9490
}
9591
const libdocConfig = {
96-
searchIndexUrl: `{{ '/core/assets/js/search_index.json' | url }}`,
97-
fuzzyIndexUrl: `{{ '/core/assets/js/fuzzy_index.json' | url }}`,
98-
blogTitle: `{{ libdocConfig.blogTitle }}`
92+
blogTitle: `{{ libdocConfig.blogTitle }}`,
93+
blogDescription: `{{ libdocConfig.blogDescription }}`,
94+
displayTagsListLink: {{ libdocConfig.displayTagsListLink }}
9995
}
10096
const libdocSystem = {
101-
productionUrl: `{{ libdocSystem.productionUrl }}`
97+
searchIndexUrl: `{{ '/core/assets/js/search_index.json' | url }}`,
98+
fuzzyIndexUrl: `{{ '/core/assets/js/fuzzy_index.json' | url }}`,
99+
productionUrl: `{{ libdocSystem.productionUrl }}`,
100+
blogPostsCount: `{{ collections.post.size }}`
102101
}
103102
</script>
104103
</head>
@@ -110,7 +109,7 @@
110109
pl-5="md"
111110
style="max-width: var(--ita-widths-main-container-max)">
112111
<div id="sidebar"
113-
class="d-flex fd-column | pos-sticky top-0 z-2"
112+
class="d-flex fd-column | pos-sticky top-0 z-3"
114113
ai-center="xs,sm"
115114
w-100="xs,sm"
116115
w-sidebar="md">
@@ -159,7 +158,7 @@
159158
</div>
160159
</nav>
161160
<nav id="nav_primary_container"
162-
class="d-flex d-none--xs d-none--sm fd-column | w-100 o-hidden | bwidth-1 bstyle-dashed bcolor-neutral-500 | __soft-shadow"
161+
class="d-flex d-none--xs d-none--sm fd-column | w-100 | bwidth-1 bstyle-dashed bcolor-neutral-500 | __soft-shadow"
163162
mt-5="md"
164163
maxw-sidebar="md"
165164
maxh-sidebar="md"
@@ -358,9 +357,14 @@
358357
fs-2="xs">
359358
<span class="icon-calendar-dots fs-6"></span>
360359
<span ws-nowrap="sm,md">
361-
{% comment %} <span class="ws-nowrap">{{ libdocMessages.lastModified[pageLang] }}</span> {% endcomment %}
362-
{{ date | datePrefixText }}
363-
{{ page.date | dateString }}
360+
{% assign dateString = page.date | dateString %}
361+
{% if dateString == "1111-11-11" %}
362+
{{ libdocMessages.lastModified[pageLang] }}
363+
{{ page.inputPath | gitLastModifiedDate }}
364+
{% else %}
365+
{{ date | datePrefixText }}
366+
{{ dateString }}
367+
{% endif %}
364368
</span>
365369
</p>
366370
{% endif %}

core/assets/css/ds__defaults.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,10 @@ main q {
274274
font-variation-settings: "slnt" -15, "CRSV" 1, "CASL" 1, "wght" 400;
275275
}
276276
main kbd {
277-
font-variation-settings: "MONO" 1, "CASL" 0, "CRSV" 0, "wght" 500;
277+
font-variation-settings: "MONO" 1, "CASL" 0, "CRSV" 0, "wght" 300;
278278
font-family: var(--libdoc-font-family);
279+
padding: 0 var(--ita-spacings-2);
280+
border-radius: 4px;
279281
}
280282
/* LISTS */
281283
main ul,

core/assets/fonts/icomoon/demo.html

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,38 @@
99
<link rel="stylesheet" href="style.css"></head>
1010
<body>
1111
<div class="bgc1 clearfix">
12-
<h1 class="mhmm mvm"><span class="fgc1">Font Name:</span> icomoon <small class="fgc1">(Glyphs:&nbsp;37)</small></h1>
12+
<h1 class="mhmm mvm"><span class="fgc1">Font Name:</span> icomoon <small class="fgc1">(Glyphs:&nbsp;39)</small></h1>
1313
</div>
1414
<div class="clearfix mhl ptl">
1515
<h1 class="mvm mtn fgc1">Grid Size: Unknown</h1>
16+
<div class="glyph fs1">
17+
<div class="clearfix bshadow0 pbs">
18+
<span class="icon-star"></span>
19+
<span class="mls"> icon-star</span>
20+
</div>
21+
<fieldset class="fs0 size1of1 clearfix hidden-false">
22+
<input type="text" readonly value="e925" class="unit size1of2" />
23+
<input type="text" maxlength="1" readonly value="&#xe925;" class="unitRight size1of2 talign-right" />
24+
</fieldset>
25+
<div class="fs0 bshadow0 clearfix hidden-true">
26+
<span class="unit pvs fgc1">liga: </span>
27+
<input type="text" readonly value="" class="liga unitRight" />
28+
</div>
29+
</div>
30+
<div class="glyph fs1">
31+
<div class="clearfix bshadow0 pbs">
32+
<span class="icon-star-fill"></span>
33+
<span class="mls"> icon-star-fill</span>
34+
</div>
35+
<fieldset class="fs0 size1of1 clearfix hidden-false">
36+
<input type="text" readonly value="e926" class="unit size1of2" />
37+
<input type="text" maxlength="1" readonly value="&#xe926;" class="unitRight size1of2 talign-right" />
38+
</fieldset>
39+
<div class="fs0 bshadow0 clearfix hidden-true">
40+
<span class="unit pvs fgc1">liga: </span>
41+
<input type="text" readonly value="" class="liga unitRight" />
42+
</div>
43+
</div>
1644
<div class="glyph fs1">
1745
<div class="clearfix bshadow0 pbs">
1846
<span class="icon-circle-half"></span>

core/assets/fonts/icomoon/fonts/icomoon.svg

Lines changed: 2 additions & 0 deletions
Loading
492 Bytes
Binary file not shown.
492 Bytes
Binary file not shown.

core/assets/fonts/icomoon/selection.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)