Skip to content

Commit ac45b1b

Browse files
authored
Jmt update (#166)
* update jmt * update jmt * update workflow * pass on code cov * fix errors * arghh, copy-n-paste * use separate action for docs
1 parent 897cb34 commit ac45b1b

File tree

5 files changed

+67
-45
lines changed

5 files changed

+67
-45
lines changed

.github/workflows/ci-nightly.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919
os:
2020
- ubuntu-latest
2121
- macos-latest
22-
# - windows-latest
22+
#- windows-latest
2323
arch:
2424
- x64
2525
steps:
26-
- uses: actions/checkout@v2
27-
- uses: julia-actions/setup-julia@v1
26+
- uses: actions/checkout@v4
27+
- uses: julia-actions/setup-julia@v2
2828
with:
2929
version: ${{ matrix.version }}
3030
arch: ${{ matrix.arch }}
31-
- uses: actions/cache@v1
31+
- uses: actions/cache@v4
3232
env:
3333
cache-name: cache-artifacts
3434
with:
@@ -39,4 +39,4 @@ jobs:
3939
${{ runner.os }}-test-
4040
${{ runner.os }}-
4141
- uses: julia-actions/julia-buildpkg@v1
42-
- uses: julia-actions/julia-runtest@v1
42+
- uses: julia-actions/julia-runtest@v1

.github/workflows/ci.yml

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ on:
77
branches:
88
- master
99
tags: '*'
10+
11+
concurrency:
12+
# Skip intermediate builds: always.
13+
# Cancel intermediate builds: only if it is a pull request build.
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
16+
1017
jobs:
1118
test:
1219
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
@@ -15,22 +22,22 @@ jobs:
1522
fail-fast: false
1623
matrix:
1724
version:
18-
- '1.0' # lowest supports, possible errors
19-
- '1.6' # lowest supported version; no errors
25+
- '1.0' # lowest supported version; though possibly with errors
26+
- '1.6' # LTS support
2027
- '1' # last released version
2128
os:
2229
- ubuntu-latest
2330
- macos-latest
24-
# - windows-latest
31+
#- windows-latest
2532
arch:
2633
- x64
2734
steps:
28-
- uses: actions/checkout@v2
29-
- uses: julia-actions/setup-julia@v1
35+
- uses: actions/checkout@v4
36+
- uses: julia-actions/setup-julia@v2
3037
with:
3138
version: ${{ matrix.version }}
3239
arch: ${{ matrix.arch }}
33-
- uses: actions/cache@v1
40+
- uses: actions/cache@v4
3441
env:
3542
cache-name: cache-artifacts
3643
with:
@@ -42,29 +49,3 @@ jobs:
4249
${{ runner.os }}-
4350
- uses: julia-actions/julia-buildpkg@v1
4451
- uses: julia-actions/julia-runtest@v1
45-
- uses: julia-actions/julia-processcoverage@v1
46-
- uses: codecov/codecov-action@v1
47-
with:
48-
file: lcov.info
49-
docs:
50-
name: Documentation
51-
runs-on: ubuntu-latest
52-
steps:
53-
- uses: actions/checkout@v2
54-
- uses: julia-actions/setup-julia@v1
55-
with:
56-
version: '1'
57-
- run: |
58-
julia --project=docs -e '
59-
using Pkg
60-
Pkg.develop(PackageSpec(path=pwd()))
61-
Pkg.instantiate()'
62-
- run: |
63-
julia --project=docs -e '
64-
using Documenter: doctest
65-
using Mustache
66-
doctest(Mustache)'
67-
- run: julia --project=docs docs/make.jl
68-
env:
69-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master # update to match your development branch (master, main, dev, trunk, ...)
7+
tags: '*'
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
# These permissions are needed to:
13+
# - Deploy the documentation: https://documenter.juliadocs.org/stable/man/hosting/#Permissions
14+
# - Delete old caches: https://github.com/julia-actions/cache#usage
15+
permissions:
16+
actions: write
17+
contents: write
18+
pull-requests: read
19+
statuses: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: julia-actions/setup-julia@v2
24+
with:
25+
version: '1'
26+
- uses: julia-actions/cache@v2
27+
- name: Install dependencies
28+
shell: julia --color=yes --project=docs {0}
29+
run: |
30+
using Pkg
31+
Pkg.develop(PackageSpec(path=pwd()))
32+
Pkg.instantiate()
33+
- name: Build and deploy
34+
run: julia --color=yes --project=docs docs/make.jl
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
37+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Mustache"
22
uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
3-
version = "1.0.20"
3+
version = "1.0.21"
44

55
[deps]
66
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

src/parse.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ end
163163
164164
String macro that interpolates values escaped by dollar signs, then parses strings.
165165
166-
Note: modified from a macro in [HypertextLiteral](https://github.com/clarkevans/HypertextLiteral.jl/blob/master/src/macros.jl).
166+
Note: very lightly modified from a macro in [HypertextLiteral](https://github.com/JuliaPluto/HypertextLiteral.jl/blob/master/src/macro.jl).
167167
168168
Example:
169169
@@ -177,21 +177,26 @@ macro jmt_str(expr::String)
177177
# Essentially this is an ad-hoc scanner of the string, splitting
178178
# it by `$` to find interpolated parts and delegating the hard work
179179
# to `Meta.parse`, treating everything else as a literal string.
180-
181180
args = Any[]
182181
start = idx = 1
183-
strlen = length(expr)
182+
strlen = lastindex(expr)
184183
while true
185184
idx = findnext(isequal('$'), expr, start)
186185
if idx == nothing
186+
chunk = expr[start:strlen]
187187
push!(args, expr[start:strlen])
188188
break
189189
end
190-
push!(args, expr[start:idx-1])
191-
start = idx + 1
190+
push!(args, expr[start:prevind(expr, idx)])
191+
start = nextind(expr, idx)
192+
if length(expr) >= start && expr[start] == '$'
193+
push!(args, "\$")
194+
start += 1
195+
continue
196+
end
192197
(nest, tail) = Meta.parse(expr, start; greedy=false)
193198
if nest == nothing
194-
throw("missing interpolation expression")
199+
throw("missing expression at $idx: $(expr[start:end])")
195200
end
196201
if !(expr[start] == '(' || nest isa Symbol)
197202
throw(DomainError(nest,
@@ -208,7 +213,6 @@ macro jmt_str(expr::String)
208213
push!(args, nest)
209214
start = tail
210215
end
211-
212216
quote
213217
Mustache.parse(string($(map(esc, args)...)))
214218
end

0 commit comments

Comments
 (0)