Skip to content

Commit

Permalink
fix: finish systems
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Jul 13, 2020
1 parent 7c55fca commit 2e3fbd7
Show file tree
Hide file tree
Showing 108 changed files with 793 additions and 951 deletions.
40 changes: 34 additions & 6 deletions next/.site/assets/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
@import "plugins/scrollbars";

// SVG Diagrams

.diagrams {
.diagrams-container {
margin: 20px 20px;
}
.diagrams {
width: auto;
overflow: hidden;
cursor: grab;
Expand All @@ -24,19 +25,48 @@
}
.diagrams-caption {
text-align: center;
a {
text-decoration: none !important;
}
}
.diagrams > svg {

.diagrams svg {
transform-origin: top left;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.diagrams.svg > svg {
.diagrams.svg svg {
background-color: white;
}

// Figure zoom
.figure {
width: auto;
overflow: hidden;
cursor: grab;
justify-content: center;
align-items: center;
will-change: transform;
outline: none;
}
.figure:active {
cursor: grabbing;
}
.figure + figcaption {
text-align: center;
}

.figure img {
transform-origin: top left;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: auto;
}
// search
#book-search-results {
width: 100%;
Expand Down Expand Up @@ -68,7 +98,6 @@ blockquote {

.markdown code, code {
margin: 0 1px;
display: inline-block;
padding: 3px 6px;
font-size: 85%;
border-radius: 3px;
Expand Down Expand Up @@ -125,7 +154,6 @@ blockquote {
line-height: 50px;
background-color: #090909;
z-index: 20;
/* box-shadow: 0 3px 8px 0 #232323; */
border-bottom: 1px solid #232323;
margin-bottom: 0;
aside {
Expand Down
34 changes: 34 additions & 0 deletions next/.site/layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- if .Page.Site.Params.BookPortableLinks -}}
{{- template "portable-link" . -}}
{{- else -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
{{- end -}}

{{- define "portable-link" -}}
{{- $destination := .Destination }}
{{- $title := .Title -}}
{{- $isRemote := or (in .Destination ":") (strings.HasPrefix .Destination "//") }}
{{- if not $isRemote }}
{{- $url := urls.Parse .Destination }}
{{- $path := strings.TrimSuffix "/_index.md" $url.Path }}
{{- $path = strings.TrimSuffix "/_index" $path }}
{{- $path = strings.TrimSuffix ".md" $path }}
{{- $page := .Page.Site.GetPage $path }}
{{- if $page }}
{{- $destination = $page.RelPermalink }}
{{- if .Title -}}
{{- $title = .Title -}}
{{- else -}}
{{- $title = $page.Title -}}
{{- end -}}
{{- if $url.Fragment }}
{{- $destination = print $destination "#" $url.Fragment }}
{{- end }}
{{- else if fileExists (print .Page.File.Dir .Destination) }}
<!-- Nothing -->
{{- else -}}
{{- warnf "Page '%s' not found in '%s'" .Destination .Page.File }}
{{- end }}
{{- end }}
<a href="{{ $destination | safeURL }}"{{ with $title}} title="{{ . }}"{{ end }} {{ if $isRemote }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
{{- end -}}
45 changes: 45 additions & 0 deletions next/.site/layouts/shortcodes/dashboard-level.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<i class="gg-incorrect"></i> Incorrect
<i class="gg-wip"></i> WIP
<i class="gg-incomplete"></i> Incomplete
<i class="gg-stable"></i> Stable
<i class="gg-permanent"></i> Permanent

{{ range .Site.Pages }}
{{ if in (slice ($.Get "name")) .Title}}
{{ $.Scratch.Set "counter" 0 }}
{{ $.Scratch.Set "counter-audit" 0 }}
{{ range .Data.Pages }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if .Params.dashboardAudit }}
{{ $.Scratch.Set "counter-audit" (add ($.Scratch.Get "counter-audit") .Params.dashboardAudit) }}
{{ end }}
{{ end }}
<details {{ if eq ($.Get "open") "true" }}open{{ end }}>
<summary>{{ .Title}} <i title="{{ humanize .Params.dashboardState }}" class="gg-{{ .Params.dashboardState }}"></i> <code>Last update: {{ dateFormat "02 Jan 06 15:04 UTC" .Lastmod.UTC }}</code></summary>

<div class="markdown-inner">
<b>Audit:</b> <i class="gg-{{ if eq ($.Scratch.Get "counter-audit") ($.Scratch.Get "counter")}}stable{{else}}wip{{end}}"></i> {{$.Scratch.Get "counter-audit"}} / {{$.Scratch.Get "counter"}}<br>
<b>Interface:</b> <i class="gg-incomplete"></i><br>
<b>Tests:</b> <i class="gg-wip"></i><br>
</div>
{{ range .Data.Pages }}
<div class="book-expand">
<label>
<div class="book-expand-head flex justify-between">
<span>{{ .Title }} <i title="{{ humanize .Params.dashboardState }}" class="gg-{{ if .Params.dashboardState }}{{.Params.dashboardState}}{{else}}wip{{end}}"></i> <code>Last update: {{ dateFormat "02 Jan 06 15:04 UTC" .Lastmod.UTC }}</code></span>
<span></span>
</div>
<input type="checkbox" class="hidden" />
<div class="book-expand-content markdown-inner">
<b>Audit:</b> <i class="gg-{{ if eq .Params.dashboardAudit 1}}permanent{{else}}wip{{end}}"></i><br>
<b>Interface:</b> <i class="gg-{{ if .Params.dashboardInterface }}{{ .Params.dashboardInterface }}{{else}}wip{{end}}"></i><br>
<b>Tests:</b> <i class="gg-wip"></i><br>
</div>
</label>
</div>
{{ end }}
</details><br>


{{ end }}
{{ end }}
15 changes: 10 additions & 5 deletions next/.site/layouts/shortcodes/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<i class="gg-incorrect"></i> Incorrect
<i class="gg-wip"></i> WIP
<i class="gg-incomplete"></i> Incomplete
<i class="gg-stable"></i> Stable
<i class="gg-permanent"></i> Permanent

{{ range .Site.Pages }}
{{ if in (slice "Algorithms" "Introduction") .Title}}
{{ if in (slice "Files & Data" "Blockchain" "Market" "Storage Mining" "Filecoin Nodes" "Token" "Virtual Machine") .Title}}
{{ $.Scratch.Set "counter" 0 }}
{{ $.Scratch.Set "counter-audit" 0 }}
{{ range .Data.Pages }}
{{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) }}
{{ if .Params.audit }}
{{ $.Scratch.Set "counter-audit" (add ($.Scratch.Get "counter-audit") .Params.audit) }}
{{ if .Params.dashboardAudit }}
{{ $.Scratch.Set "counter-audit" (add ($.Scratch.Get "counter-audit") .Params.dashboardAudit) }}
{{ end }}
{{ end }}

<details>
<summary>{{ .Title}} <i title="{{ humanize .Params.dashboardState }}" class="gg-{{ .Params.dashboardState }}"></i> <code>Last update: {{ dateFormat "02 Jan 06 15:04 UTC" .Lastmod.UTC }}</code></summary>

Expand All @@ -26,7 +31,7 @@
</div>
<input type="checkbox" class="hidden" />
<div class="book-expand-content markdown-inner">
<b>Audit:</b> <i class="gg-{{ if eq .Params.audit 1}}permanent{{else}}wip{{end}}"></i><br>
<b>Audit:</b> <i class="gg-{{ if eq .Params.dashboardAudit 1}}permanent{{else}}wip{{end}}"></i><br>
<b>Interface:</b> <i class="gg-{{ if .Params.dashboardInterface }}{{ .Params.dashboardInterface }}{{else}}wip{{end}}"></i><br>
<b>Tests:</b> <i class="gg-wip"></i><br>
</div>
Expand Down
44 changes: 44 additions & 0 deletions next/.site/layouts/shortcodes/figure.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{ if not (.Page.Scratch.Get "panzoom") }}
<script src="https://unpkg.com/d3-zoomable@1.1.3/dist/d3-zoomable.min.js"></script>
{{ .Page.Scratch.Set "panzoom" true }}
{{ end }}

{{ if (.Get "src") }}
{{ if eq (.Get "src" | printf "%.4s") "http" }}
<figure>
<img src="{{ .Get "src" }}" />
<figcaption>
{{(.Get "title")}}
</figcaption>
</figure>
{{ else }}
{{ $.Scratch.Set "filepath" .Page.File.Dir }}
{{ $.Scratch.Add "filepath" ( .Get "src" ) }}
{{ if fileExists ($.Scratch.Get "filepath") }}
{{ $uuid := delimit (shuffle (seq 1 9)) "" }}
{{ $id := (print "figure-" $uuid) }}
<figure >
{{ $src := .Page.Resources.GetMatch ( .Get "src" ) }}
{{ with $src }}
<div id="{{ $id }}" class="figure">
<img src="{{ .RelPermalink }}" height="{{ .Height }}" width="{{ .Width }}" loading="lazy" alt="{{ $.Get "title" }}"/>
</div>
{{ end }}
<figcaption>
{{ .Get "title" }}
</figcaption>
</figure>
{{ if (.Get "zoom")}}
<script>
var element = document.querySelector("#{{ $id }}");
zoomable()(element).htmlEl(element.querySelector('img'));
</script>
{{ end }}
{{ else }}
<blockquote class="book-hint danger">
{{- printf "File '%s' not found from Page '%s'" ($.Scratch.Get "filepath") .Page.File }}
</blockquote>
{{- warnf "File '%s' not found from Page '%s'" ($.Scratch.Get "filepath") .Page.File }}
{{ end }}
{{ end }}
{{ end }}
3 changes: 3 additions & 0 deletions next/.site/layouts/shortcodes/link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- $ref := relref . (.Get 0) -}}
{{- $page := .Site.GetPage (.Get 0) -}}
<a href="{{- $ref -}}" title="{{- $page.Title -}}">{{- $page.Title -}}</a>
11 changes: 3 additions & 8 deletions next/.site/layouts/shortcodes/svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
{{ $content := $.Scratch.Get "filepath" | readFile | safeHTML }}
{{ $uuid := delimit (shuffle (seq 1 9)) "" }}
{{ $id := (print "diagrams-" $uuid) }}
<div>
<div id="{{ $id }}" class="diagrams svg{{ with .Get "class" }} {{ . }}{{ end }}">
<div class="diagrams-container">
<div title="{{ .Get "title" }}" id="{{ $id }}" class="diagrams svg{{ with .Get "class" }} {{ . }}{{ end }}">
{{- $content -}}
</div>
<div class="diagrams-caption">{{( .Get "title" )}}</div>
<div title="{{ .Get "title" }}" class="diagrams-caption">{{( .Get "title" )}} <a href="#{{ anchorize ( .Get "title" ) }}">#</a></div>
</div>
<script>
var element = document.querySelector("#{{ $id }}");
Expand All @@ -30,9 +30,4 @@
</blockquote>
{{- warnf "File '%s' not found from Page '%s'" ($.Scratch.Get "filepath") .Page.File }}
{{ end }}
{{ else }}
<div class="diagrams{{ with .Get "class" }} {{ . }}{{ end }}">
{{- .Inner -}}
<div class="diagrams-caption">{{( .Get "title" )}}</div>
</div>
{{ end }}

0 comments on commit 2e3fbd7

Please sign in to comment.