Skip to content

Commit

Permalink
Add aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Lotes committed May 29, 2024
1 parent 5f65e52 commit 7ce4268
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Building an Extension"
weight: 5
aliases:
- /tutorials/building_an_extension
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/minilogo/customizing_cli.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Customizing the CLI"
weight: 2
aliases:
- /tutorials/customizing_cli
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/minilogo/generation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Generation"
weight: 3
aliases:
- /tutorials/generation
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/minilogo/generation_in_the_web.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Generation in the Web"
weight: 7
aliases:
- /tutorials/generation_in_the_web
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/minilogo/langium_and_monaco.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Langium + Monaco Editor"
weight: 6
aliases:
- /tutorials/langium_and_monaco
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/minilogo/validation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Validation"
weight: 1
aliases:
- /tutorials/validation
---

{{< toc format=html >}}
Expand Down
3 changes: 3 additions & 0 deletions hugo/content/docs/learn/minilogo/writing_a_grammar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "Writing a Grammar"
weight: 0
aliases:
- /tutorials/writing_a_grammar
- /writing_a_grammar
---

{{< toc format=html >}}
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/learn/workflow/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Langium's workflow"
weight: 0
url: /docs/learn/workflow/
aliases:
- /docs/getting-started
---

Langium's workflow can be expressed as a flow chart diagram, which boils down to the following steps in the diagram.
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/recipes/code-bundling.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Code Bundling"
weight: 900
aliases:
- /guides/code-bundling
---

When you first create a Langium project using the [Yeoman generator](/docs/learn/workflow/install), it will only contain a plain TypeScript configuration, without any additional build processes.
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/recipes/scoping/class-member.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Class Member Scoping"
weight: 200
aliases:
- /class-member
---

In this guide we will take a look at member based scoping. It's a mechanism you are likely familiar with from object oriented languages such as Java, C# and JavaScript:
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/recipes/scoping/qualified-name.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Qualified Name Scoping"
weight: 100
aliases:
- /qualified-name
---

Qualified name scoping refers to a style of referencing elements using a fully qualified name.
Expand Down
2 changes: 2 additions & 0 deletions hugo/content/docs/reference/document-lifecycle.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: 'Document Lifecycle'
weight: 300
aliases:
- /docs/document-lifecycle
---

`LangiumDocument` is the central data structure in Langium that represents a text file of your DSL. Its main purpose is to hold the parsed Abstract Syntax Tree (AST) plus additional information derived from it. After its creation, a `LangiumDocument` must be "built" before it can be used in any way. The service responsible for building documents is called `DocumentBuilder`.
Expand Down
3 changes: 3 additions & 0 deletions hugo/content/docs/reference/grammar-language.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "Grammar Language"
weight: 100
aliases:
- /grammar-language
- /docs/grammar-language
---

{{< toc format=html >}}
Expand Down
3 changes: 3 additions & 0 deletions hugo/content/docs/reference/semantic-model.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: "Semantic Model Inference"
weight: 400
aliases:
- /sematic-model
- /semantic-model
---

When AST nodes are created during the parsing of a document, they are given a type. The language grammar dictates the shape of those types and how they might be related to each other. All types form the *semantic model* of your language. There are two ways by which Langium derives semantic model types from the grammar, by **[inference](#inferred-types)** and by **[declaration](#declared-types)**.
Expand Down
21 changes: 15 additions & 6 deletions scripts/check-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,28 @@ async function main() {
const markdownFiles: MarkdownFile[] = await readMarkdownFiles();
//collect what is there
const setOfUrls = new Set<string>([
urlToString('http://langium.org/')
]);
'http://langium.org/',
"/showcase",
"/playground"
].map(urlToString));
for (const file of markdownFiles) {
for (const url of file.aliases) {
setOfUrls.add(urlToString(url));
}
}
//check what is missing
for (const file of markdownFiles) {
console.log(`${relative(contentDir, file.localPath)}:`);
let out = false;
for (const link of file.links) {
if(link.startsWith("http")) {
if(link.startsWith("http") || link.endsWith(".png") || link.endsWith(".jpg")) {
continue;
}
const url = urlToString(link);
if(!setOfUrls.has(url)) {
if(!out) {
console.log(`${relative(contentDir, file.localPath)}:`);
out = true;
}
console.log(`- MISSING LINK: ${url.toString()}`);
success = false;
}
Expand Down Expand Up @@ -86,9 +92,9 @@ async function readMarkdownFiles() {
}

function getAllLinks(content: string) {
const regexMdLinks = /\[([^\[]+)\](\(.*\))/gm
const regexMdLinks = /\[([^\[]+)\](\(.*?\))/gm
const matches = content.match(regexMdLinks)
const singleMatch = /\[([^\[]+)\]\((.*)\)/;
const singleMatch = /\[([^\[]+)\]\((.*?)\)/;
const result: string[] = [];
for (var i = 0; i < matches?.length ?? 0; i++) {
var text = singleMatch.exec(matches[i])
Expand All @@ -100,6 +106,9 @@ function getAllLinks(content: string) {
function urlToString(link: string): string {
const url = new URL(link, 'http://langium.org');
url.hash = "";
if(url.pathname.endsWith("/")) {
url.pathname = url.pathname.substring(0, url.pathname.length-1)
}
return url.toString();
}

Expand Down

0 comments on commit 7ce4268

Please sign in to comment.