Skip to content

Commit

Permalink
Update Style for Generating Reference Model Anchors at Build Time (#1789
Browse files Browse the repository at this point in the history
)

* isset Did not seem to work - changed it to ne (!= or <>)

* Second part of the Anchor-JS unhooking and static Anchor Generated

* hooled up the renamed class name .reference-element-anchor

* Adding metaschema submodule changes (fixed with merge conflict).
  • Loading branch information
JustKuzya authored and aj-stein-nist committed Jul 10, 2023
1 parent ff951bd commit 97dcbc1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 13 deletions.
30 changes: 30 additions & 0 deletions docs/assets/scss/schema-docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,34 @@
@include u-text('bold');
}
}
}


.reference-element-anchor {
// : :after
font-style: normal;
font-variant: normal;
font-kerning: auto;
font-optical-sizing: auto;
font-feature-settings: normal;
font-variation-settings: normal;
font-weight: normal;
font-stretch: normal;
font-size: 1em;
line-height: inherit;
font-family: anchorjs-icons;
position: absolute;
margin-left: -1em;
padding-right: 0.5em;
}

.reference-element-anchor:hover {
text-decoration: underline;
transform: scale(1.06);
border-image: "";
}

.reference-element-anchor :hover::before {
font-family: anchorjs-icons;
background-image: "";
}
45 changes: 32 additions & 13 deletions docs/layouts/partials/foot.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
{{ if not .Site.IsServer }}
<script type="text/javascript" src="https://pages.nist.gov/leaveNotice/js/jquery.leaveNotice-nist.min.js"></script>
<script>
$(document).ready(function () {
$('a[href*="//"]{{ if .Site.IsServer }}:not([href*="http://localhost:1313/"]){{ end }}:not([href*="pages.nist.gov"]):not([href*="www.nist.gov"]):not([href^="#"]):not([href^="/"])').addClass('usa-link usa-link--external');
$('a.usa-link--external').leaveNotice();
});
$(document).ready(function () {
$('a[href*="//"]{{ if .Site.IsServer }}:not([href*="http://localhost:1313/"]){{ end }}:not([href*="pages.nist.gov"]):not([href*="www.nist.gov"]):not([href^="#"]):not([href^="/"])').addClass('usa-link usa-link--external');
$('a.usa-link--external').leaveNotice();
});
</script>
{{ end }}

{{ $generateAnchors := true }}
{{- if isset .Page.Params "generateanchors" -}}
{{ $generateAnchors = .Page.Params.generateanchors }}
{{- end -}}
{{ if $generateAnchors -}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.0/anchor.min.js" integrity="sha512-G2OGlm41XXw+fcgDcRPjVYEn7qCY6qiKWNqDGT37SnKh0qtRXTuKZ5/UQR0kDN0PZRNWcGExd3lAeqEH0I36bQ==" crossorigin="anonymous"></script>
{{ $generateAnchors:= true }}

{{ if ne .Page.Params.generateanchors nil }}
{{ $generateAnchors = .Page.Params.generateanchors }}
{{ end }}

{{ if $generateAnchors }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.0/anchor.min.js"
integrity="sha512-G2OGlm41XXw+fcgDcRPjVYEn7qCY6qiKWNqDGT37SnKh0qtRXTuKZ5/UQR0kDN0PZRNWcGExd3lAeqEH0I36bQ=="
crossorigin="anonymous">
</script>
<script>

/*
anchors.options = {
placement: 'left'
placement: 'left'
};
anchors.add();
anchors.add();
*/

document.addEventListener('DOMContentLoaded', function (event) {

anchors.options = {
placement: 'left',
icon: "⚓",
};
// anchors.add();
anchors.add('.name:not(.reference-element-anchor)');
// $("a").not(".anchor-xslt").add();
});
</script>
{{- end }}
{{ end }}

0 comments on commit 97dcbc1

Please sign in to comment.