ops: added a lint rule and adjusted the build workflow
Build and Bundle Gleam App / format (push) Failing after 9s
Build and Bundle Gleam App / build-and-bundle (push) Successful in 14s
Build and Bundle Gleam App / publish (push) Failing after 0s

This commit is contained in:
2026-07-10 00:23:48 +02:00
parent 5bcae0e0d6
commit a45e622bb3
11 changed files with 93 additions and 51 deletions
+18 -3
View File
@@ -7,6 +7,21 @@ on:
- "**" # Triggers on every commit to any branch - "**" # Triggers on every commit to any branch
jobs: jobs:
format:
runs-on: ubuntu-latest
container:
image: jaypoch/lumabuilder:latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checking the format
run: gleam format --check
publish:
runs-on: ubuntu-latest
container:
image: jaypoch/lumabuilder:latest
build-and-bundle: build-and-bundle:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
@@ -16,13 +31,13 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Build Gleam to JavaScript - name: Build Gleam to JavaScript
run: gleam build --target javascript run: gleam build --target javascript
- name: Build bundle - name: Build bundle
run: | run: |
esbuild build/dev/javascript/markdown2/markdown2.mjs \ esbuild build/dev/javascript/luma/luma.mjs \
--bundle \ --bundle \
--outfile=parser.js \ --outfile=parser.js \
--format=iife \ --format=iife \
@@ -31,4 +46,4 @@ jobs:
uses: https://gitea.com/actions/upload-artifact@v3 uses: https://gitea.com/actions/upload-artifact@v3
with: with:
name: parser-js name: parser-js
path: parser.js path: parser.js
+8
View File
@@ -0,0 +1,8 @@
name: formatcheck
on:
pull_request:
push:
branches: [main]
jobs:
+20
View File
@@ -0,0 +1,20 @@
MIT License
Copyright (c) 2026 Jaypoch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1 -1
View File
@@ -1,4 +1,4 @@
ljiosfgdjiosdfgj some text about cats
@2! A slightly important statement !1 I believe is wrong, !- quoted inside another quote. @2! A slightly important statement !1 I believe is wrong, !- quoted inside another quote.
!3 A slightly important statement I believe is wrong, quoted inside another quote. !3 A slightly important statement I believe is wrong, quoted inside another quote.
#3!2@2 A slightly important statement I believe is wrong, quoted inside another quote. #3!2@2 A slightly important statement I believe is wrong, quoted inside another quote.
+3 -8
View File
@@ -1,16 +1,11 @@
name = "markdown2" name = "luma"
version = "1.0.0" version = "1.0.0"
# Fill out these fields if you intend to generate HTML documentation or publish # Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager. # your project to the Hex package manager.
# #
# description = "" description = "A parser for a made up markup language"
# licences = ["Apache-2.0"] licences = ["MIT"]
# repository = { type = "github", user = "", repo = "" }
# links = [{ title = "Website", href = "" }]
#
# For a full reference of all the available options, you can have a look at
# https://gleam.run/writing-gleam/gleam-toml/.
[dependencies] [dependencies]
gleam_stdlib = ">= 1.0.0 and < 2.0.0" gleam_stdlib = ">= 1.0.0 and < 2.0.0"
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"name": "markdown2", "name": "luma",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
+20
View File
@@ -0,0 +1,20 @@
//// The Main function definitions
import luma/definition
import gleam/io
import gleam/json
import luma/parser
/// example main function that parses some text into json
pub fn main() ->Nil{
io.print("This is a debug function only used for testing")
io.print(parse_to_json("!2 @3 important >1 quoted"))
}
/// same as parse but formats The text instructions as a json string for easier use with javascript
pub fn parse_to_json(input: String) -> String {
let definition.TextInstructions(inlines) = parser.handler(input)
json.array(inlines, definition.inline_to_json)
|> json.to_string
}
@@ -1,24 +1,30 @@
import gleam/json ////Main definitions used throughout the programm
import mode
pub type Line { import gleam/json
Line(List(Inline)) import luma/mode
/// A list of single instructions
pub type TextInstructions {
TextInstructions(List(Instruction))
} }
pub type Inline { /// a single Instruction on how to change the state or to render text
pub type Instruction {
Text(String) Text(String)
Push(Feeling) Push(StateObject)
//pop ignores the number ///pop ignores the number
Pop(mode.Type) Pop(mode.Type)
} }
pub type Feeling { /// A single primitive and its modifier
pub type StateObject {
Hirachy(Int) Hirachy(Int)
Truth(Int) Truth(Int)
Marking(Int) Marking(Int)
Quote(Int) Quote(Int)
} }
/// The main state of the parser with a list of each primitives and there state lists
pub type State { pub type State {
State( State(
hirachystate: List(Int), hirachystate: List(Int),
@@ -28,7 +34,7 @@ pub type State {
) )
} }
pub fn inline_to_json(inline: Inline) -> json.Json { pub fn inline_to_json(inline: Instruction) -> json.Json {
case inline { case inline {
Text(text) -> Text(text) ->
json.object([ json.object([
+7 -5
View File
@@ -1,18 +1,20 @@
import definition import luma/definition
import gleam/dict import gleam/dict
import gleam/int import gleam/int
import gleam/list import gleam/list
import gleam/result import gleam/result
import gleam/string import gleam/string
import mode import luma/mode
pub fn handler(line: String) -> definition.Line { /// main parse function
/// takes in some input text and returns instructions on how to parse it
pub fn handler(line: String) -> definition.TextInstructions {
let result = parse(line) let result = parse(line)
let result = list.map(result, whatsthat) let result = list.map(result, whatsthat)
definition.Line(result) definition.TextInstructions(result)
} }
fn whatsthat(mod: String) -> definition.Inline { fn whatsthat(mod: String) -> definition.Instruction {
let modes = let modes =
dict.from_list([ dict.from_list([
#("!", #(mode.Marking, definition.Marking)), #("!", #(mode.Marking, definition.Marking)),
-24
View File
@@ -1,24 +0,0 @@
import definition
import gleam/io
import gleam/json
import parser
pub fn main() -> Nil {
io.print("This is a debug function only used for testing")
io.print(parse_to_json("!2 @3 important >1 quoted"))
}
fn line_to_json(line: definition.Line) -> String {
let definition.Line(inlines) = line
json.array(inlines, definition.inline_to_json)
|> json.to_string
}
pub fn parse(input: String) -> definition.Line {
parser.handler(input)
}
pub fn parse_to_json(input: String) -> String {
line_to_json(parser.handler(input))
}