Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
name: Run CommonMark specs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: goto-bus-stop/setup-zig@v2
- uses: mlugg/setup-zig@v2
with:
version: 0.14.0
version: 0.15.1
- run: make spec
42 changes: 15 additions & 27 deletions .github/workflows/zig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,26 @@ on:
pull_request:

jobs:
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
- run: zig build
- run: zig build test
test-macos:
runs-on: macos-latest
tests:
strategy:
matrix:
zig-version: ["0.15.1"]
runs-on: ["ubuntu-latest", "macos-latest", "windows-latest"]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@2a9625d550eefc3a9b1a43d342ad655f563f8241
- uses: actions/checkout@v6
- uses: mlugg/setup-zig@v2
with:
version: 0.14.0
- run: zig build
- run: zig build test
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
version: ${{ matrix.zig-version }}
- run: zig build
- run: zig build test
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: mlugg/setup-zig@v2
with:
version: 0.14.0
- run: zig fmt --check src/*.zig
version: 0.15.1
- run: zig fmt --check build.zig src/*.zig
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/result
# generated by htmlentities.zig
src/entities.zig

# example outputs
examples/output-*
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,18 @@ test:
spec:
zig build
cd vendor/cmark-gfm/test && python3 spec_tests.py --program=../../../zig-out/bin/koino

fetch-clap:
zig fetch --save https://github.com/Hejsil/zig-clap/archive/refs/tags/0.11.0.tar.gz

fetch-htmlentities:
zig fetch --save git+https://nossa.ee/~talya/htmlentities.zig

fetch-libpcre:
zig fetch --save git+https://github.com/kivikakk/libpcre.zig

fetch-zunicode:
zig fetch --save git+https://github.com/mishieck/zunicode

example:
zig build example
Comment on lines +16 to +29
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@ Options:

Library:

Documentation is TODO — see [LoLa](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/src/tools/render-md-page.zig#L157) for an example of use. Note also the [`build.zig`](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/build.zig#L41-L50) declaration.
Documentation is TODO — see:

- [LoLa](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/src/tools/render-md-page.zig#L157): for an example of use. Note also the [`build.zig`](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/build.zig#L41-L50) declaration.
- [Markdown to HTML example](./examples/to-html.zig).

48 changes: 42 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ pub fn build(b: *std.Build) !void {

const exe = b.addExecutable(.{
.name = "koino",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),

.target = target,
.optimize = optimize,

.imports = &.{
.{ .name = "test_koino", .module = mod },
},
}),
});
try addCommonRequirements(exe.root_module, &deps);
b.installArtifact(exe);
Expand All @@ -41,10 +48,39 @@ pub fn build(b: *std.Build) !void {
run_cmd.addArgs(args);
}

const example = b.addExecutable(.{
.name = "koino_example",
.root_module = b.createModule(.{
.root_source_file = b.path("examples/to-html.zig"),

.target = target,
.optimize = optimize,

.imports = &.{
.{ .name = "test_koino", .module = mod },
},
}),
});

try addCommonRequirements(example.root_module, &deps);
b.installArtifact(example);

const example_run_cmd = b.addRunArtifact(example);
example_run_cmd.step.dependOn(b.getInstallStep());
const example_run_step = b.step("example", "Run example");
example_run_step.dependOn(&example_run_cmd.step);

const test_exe = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),

.target = target,
.optimize = optimize,

.imports = &.{
.{ .name = "test_koino", .module = mod },
},
}),
});
try addCommonRequirements(test_exe.root_module, &deps);

Expand Down
19 changes: 10 additions & 9 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
.{
.name = .koino,
.version = "0.1.0",
.minimum_zig_version = "0.14.0",
.minimum_zig_version = "0.15.1",
.fingerprint = 0x2af09c5b5aeed24b,
.dependencies = .{
.zunicode = .{
.url = "git+https://nossa.ee/~talya/zunicode#d5527c35892a1e448f65afd127f055251cd26b51",
.hash = "zunicode-0.1.0-AAAAAAn0BQAjplm0OqOuLlE2kcI8p65nBybLoZwsjBrH",
.url = "git+https://github.com/mishieck/zunicode#e765542e914737d313b4a56e946e5adb3d0544b9",
.hash = "zunicode-0.1.0-Ftska3z0BQAecb-Fpt9JXeZJpTOX4ZPOLkTWS5DoUVsP",
},
.clap = .{
.url = "git+https://github.com/Hejsil/zig-clap#a4e784da8399c51d5eeb5783e6a485b960d5c1f9",
.hash = "clap-0.10.0-oBajB8fkAQB0JvsrWLar4YZrseSZ9irFxHB7Hvy_bvxb",
.url = "https://github.com/Hejsil/zig-clap/archive/refs/tags/0.11.0.tar.gz",
.hash = "clap-0.11.0-oBajB-HnAQDPCKYzwF7rO3qDFwRcD39Q0DALlTSz5H7e",
},
.libpcre_zig = .{
.url = "git+https://nossa.ee/~talya/libpcre.zig#04224f0bed09888d043c6fe4352458dbd907c815",
.hash = "libpcre_zig-0.1.0-Dtf6CQg4AACWtDDhtI-rjGGLKdBowMQiQrK1O5sx5icv",
.url = "git+https://github.com/kivikakk/libpcre.zig#3f61efd01ec45281c4bc6f8f6d0ae7b718e7056e",
.hash = "libpcre_zig-0.1.0-Dtf6CQ04AACiOaA107r6fJ9BpThKZCzDeqp-v5Xv0Ixr",
},
.htmlentities_zig = .{
.url = "git+https://nossa.ee/~talya/htmlentities.zig#1a49942505db7bd06770006f66b907bb3a088b9f",
.hash = "htmlentities_zig-0.1.0-zV-DJCAfAwDQMPxoEXaBrDxijlyvCK7HXhz9MIgGYj5l",
.url = "git+https://nossa.ee/~talya/htmlentities.zig#50cb7d848e81389c71fc383534ece76a3fc36284",
.hash = "htmlentities_zig-0.1.0-zV-DJDYiAwAv5XJgsNlBPl79pWgiOkJ4-8OUgV95Ksb2",
},
},

Expand All @@ -27,6 +27,7 @@
"Makefile",
"build.zig.zon",
"src",
"examples",
"LICENSE",
"README.md",
},
Expand Down
Loading
Loading