Skip to content

Commit 2c336a5

Browse files
committed
OpenCodeLaw: add spec-url attribute
Signed-off-by: kiranpranay <[email protected]>
1 parent 91eb249 commit 2c336a5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="stylesheet" href="./css/style.css" />
88
</head>
99
<body>
10+
<opencodelaw spec-url="specs/opencon.yaml"></opencodelaw>
1011
<!-- Include opencon.js -->
1112
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
1213
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.0.0/js-yaml.min.js"></script>

js/opencodelaw.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ function convertMarkdownToHTML(markdown) {
1010
// return markdown;
1111
}
1212

13-
fetch("specs/opencon.yaml")
13+
// get src content from "<opencodelaw src="specs/opencon.yaml"></opencodelaw>" tag
14+
const opencodelawtag = document.querySelector("opencodelaw");
15+
const src = opencodelawtag.getAttribute("spec-url");
16+
17+
fetch(src)
1418
.then((response) => response.text())
1519
.then((yamlData) => {
1620
const jsonData = jsyaml.load(yamlData);
@@ -193,8 +197,6 @@ fetch("specs/opencon.yaml")
193197
const subMenus = document.querySelectorAll(".sub-menu");
194198
const navLinks = document.querySelectorAll(".nav-a");
195199

196-
console.log(subMenus);
197-
198200
// Function to toggle visibility of sub-menus
199201
function toggleSubMenu(event) {
200202
const subMenu = event.currentTarget.querySelector(".sub-nav");

0 commit comments

Comments
 (0)