@@ -0,0 +1,23 @@
|
|||||||
|
name: test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: "29"
|
||||||
|
gleam-version: "1.17.0"
|
||||||
|
rebar3-version: "3"
|
||||||
|
# elixir-version: "1"
|
||||||
|
- run: gleam deps download
|
||||||
|
- run: gleam test
|
||||||
|
- run: gleam format --check src test
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
*.beam
|
||||||
|
*.ez
|
||||||
|
/build
|
||||||
|
erl_crash.dump
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# luma_markdown
|
||||||
|
|
||||||
|
[](https://hex.pm/packages/luma_markdown)
|
||||||
|
[](https://hexdocs.pm/luma_markdown/)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gleam add luma_markdown@1
|
||||||
|
```
|
||||||
|
```gleam
|
||||||
|
import luma_markdown
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
// TODO: An example of the project in use
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Further documentation can be found at <https://hexdocs.pm/luma_markdown>.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gleam run # Run the project
|
||||||
|
gleam test # Run the tests
|
||||||
|
```
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
name = "luma_markdown"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
# Fill out these fields if you intend to generate HTML documentation or publish
|
||||||
|
# your project to the Hex package manager.
|
||||||
|
#
|
||||||
|
# description = ""
|
||||||
|
# licences = ["Apache-2.0"]
|
||||||
|
# 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]
|
||||||
|
gleam_stdlib = ">= 1.0.0 and < 2.0.0"
|
||||||
|
luma = ">= 1.0.0 and < 2.0.0"
|
||||||
|
simplifile = ">= 2.5.0 and < 3.0.0"
|
||||||
|
argv = ">= 1.1.0 and < 2.0.0"
|
||||||
|
|
||||||
|
[dev_dependencies]
|
||||||
|
gleeunit = ">= 1.0.0 and < 2.0.0"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Do not manually edit this file, it is managed by Gleam.
|
||||||
|
#
|
||||||
|
# This file locks the dependency versions used, to make your build
|
||||||
|
# deterministic and to prevent unexpected versions from being included
|
||||||
|
# in your application.
|
||||||
|
#
|
||||||
|
# You should check this file into your source control repository.
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
{ name = "argv", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "3277D100448BDB4A29B6D58C0F36F631CBC349E8BDD09766C6309DF202831140" },
|
||||||
|
{ name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" },
|
||||||
|
{ name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" },
|
||||||
|
{ name = "gleam_stdlib", version = "1.0.3", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1F543AFBA5D33DA493E6087F4E4C4F20D899411343512686C98A8ABB2963CF22" },
|
||||||
|
{ name = "gleeunit", version = "1.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "EC31ABA74256AEA531EDF8169931D775BBB384FED0A8A1BDC4DD9354E3E21826" },
|
||||||
|
{ name = "luma", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "simplifile"], otp_app = "luma", source = "hex", outer_checksum = "29735CECF484D4482F223EF9546C17D4B7614F3FFBE4653D7B17F944316C1E2A" },
|
||||||
|
{ name = "simplifile", version = "2.5.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "6C72DCCDF25C38A5931740B30E823969F33106831FD1637719B5EDBCA30027A4" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[requirements]
|
||||||
|
argv = { version = ">= 1.1.0 and < 2.0.0" }
|
||||||
|
gleam_stdlib = { version = ">= 1.0.0 and < 2.0.0" }
|
||||||
|
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
|
||||||
|
luma = { version = ">= 1.0.0 and < 2.0.0" }
|
||||||
|
simplifile = { version = ">= 2.5.0 and < 3.0.0" }
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import luma/definition
|
||||||
|
import gleam/list
|
||||||
|
import gleam/io
|
||||||
|
import argv
|
||||||
|
import luma/parser
|
||||||
|
import simplifile
|
||||||
|
type Information {
|
||||||
|
Information(lowesthirachy: Int,
|
||||||
|
highesthirachy: Int)
|
||||||
|
}
|
||||||
|
fn gather(instructions: List(definition.Instruction))-> Information {
|
||||||
|
let pushes =
|
||||||
|
instructions
|
||||||
|
|> list.filter_map(fn(instruction) {
|
||||||
|
case instruction {
|
||||||
|
definition.Push(pusher) -> case pusher {
|
||||||
|
definition.Hirachy(push) -> Ok(push)
|
||||||
|
_ -> Error(Nil)
|
||||||
|
}
|
||||||
|
_ -> Error(Nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
echo pushes
|
||||||
|
|
||||||
|
let min_max =
|
||||||
|
case pushes {
|
||||||
|
[] -> Error(Nil)
|
||||||
|
[first, ..rest] ->
|
||||||
|
Ok(
|
||||||
|
list.fold(rest, #(first, first), fn(acc, n) {
|
||||||
|
let #(min, max) = acc
|
||||||
|
|
||||||
|
#(
|
||||||
|
case n < min {
|
||||||
|
True -> n
|
||||||
|
False -> min
|
||||||
|
},
|
||||||
|
case n > max {
|
||||||
|
True -> n
|
||||||
|
False -> max
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
case min_max {
|
||||||
|
Ok(#(min, max)) -> {
|
||||||
|
Information(min, max)
|
||||||
|
}
|
||||||
|
Error(_) -> {
|
||||||
|
Information(0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
case argv.load().arguments {
|
||||||
|
[filename] -> {
|
||||||
|
case simplifile.read(filename) {
|
||||||
|
Ok(contents) -> {
|
||||||
|
//programm goes here
|
||||||
|
let instructins = parser.handler(contents)
|
||||||
|
let result = case instructins {
|
||||||
|
definition.TextInstructions(instruction) -> gather(instruction)
|
||||||
|
_ -> Information(-124, 41234)
|
||||||
|
}
|
||||||
|
echo result
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
Error(_) -> io.println("Couldn't read file")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ -> io.println("Usage: gleam run <file>")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
some text about cats
|
||||||
|
@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!2@2 A slightly important statement I believe is wrong, quoted inside another quote.
|
||||||
|
|
||||||
|
!2@3 important trusted but @- important !5 more important !- 2 important and !- normal
|
||||||
|
#1 heading #- !1 important !- @2 true @- >3 quote >-
|
||||||
|
#4
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import gleeunit
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
gleeunit.main()
|
||||||
|
}
|
||||||
|
|
||||||
|
// gleeunit test functions end in `_test`
|
||||||
|
pub fn hello_world_test() {
|
||||||
|
let name = "Joe"
|
||||||
|
let greeting = "Hello, " <> name <> "!"
|
||||||
|
|
||||||
|
assert greeting == "Hello, Joe!"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user