Skip to content

Commit

Permalink
Apply Runic formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Dec 11, 2024
1 parent 51cee54 commit 2964c27
Show file tree
Hide file tree
Showing 9 changed files with 1,342 additions and 1,268 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/Check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Check
on:
push:
branches:
- 'master'
- 'release-'
tags:
- '*'
pull_request:
jobs:
runic:
name: Runic formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1.11'
- uses: julia-actions/cache@v2
- uses: fredrikekre/runic-action@v1
with:
version: '1.2'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ running these commands from the package root of Literate.jl:

````julia
using Literate
Literate.markdown("examples/README.jl", "."; flavor=Literate.CommonMarkFlavor())
Literate.markdown("examples/README.jl", "."; flavor = Literate.CommonMarkFlavor())
````

### Related packages
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if haskey(ENV, "GITHUB_ACTIONS")
end

deployconfig = Documenter.auto_detect_deploy_system()
Documenter.post_status(deployconfig; type="pending", repo="github.com/fredrikekre/Literate.jl.git")
Documenter.post_status(deployconfig; type = "pending", repo = "github.com/fredrikekre/Literate.jl.git")
using Literate
using Plots # to not capture precompilation output

Expand All @@ -14,7 +14,7 @@ EXAMPLE = joinpath(@__DIR__, "..", "examples", "example.jl")
OUTPUT = joinpath(@__DIR__, "src/generated")

function preprocess(str)
str = replace(str, "x = 123" => "y = 321"; count=1)
str = replace(str, "x = 123" => "y = 321"; count = 1)
return str
end

Expand Down
4 changes: 2 additions & 2 deletions docs/src/outputformats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# In julia rational numbers can be constructed with the `//` operator.
# Lets define two rational numbers, `x` and `y`:

x = 1//3
x = 1 // 3
#-
y = 2//5
y = 2 // 5

# When adding `x` and `y` together we obtain a new rational number:

Expand Down
2 changes: 1 addition & 1 deletion examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# running these commands from the package root of Literate.jl:

using Literate
Literate.markdown("examples/README.jl", "."; flavor=Literate.CommonMarkFlavor())
Literate.markdown("examples/README.jl", "."; flavor = Literate.CommonMarkFlavor())


# ### Related packages
Expand Down
6 changes: 3 additions & 3 deletions examples/example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
# as markdown, and all the other lines are interpreted as code. Here is some code:

#nb %% A slide [code] {"slideshow": {"slide_type": "fragment"}}
x = 1//3
y = 2//5
x = 1 // 3
y = 2 // 5

#nb # %% A slide [markdown] {"slideshow": {"slide_type": "subslide"}}
# In markdown sections we can use markdown syntax. For example, we can
Expand Down Expand Up @@ -96,7 +96,7 @@ foo()

#nb %% A slide [code] {"slideshow": {"slide_type": "subslide"}}
using Plots
x = range(0, stop=6π, length=1000)
x = range(0, stop = 6π, length = 1000)
y1 = sin.(x)
y2 = cos.(x)
plot(x, [y1, y2])
Expand Down
6 changes: 3 additions & 3 deletions src/IJulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const application_vnd_vegalite_v2 = MIME("application/vnd.vegalite.v2+json")
# return a String=>String dictionary of mimetype=>data
# for passing to Jupyter display_data and execute_result messages.
function display_dict(x)
data = Dict{String,Any}("text/plain" => limitstringmime(text_plain, x))
data = Dict{String, Any}("text/plain" => limitstringmime(text_plain, x))
if showable(application_vnd_vegalite_v2, x)
data[string(application_vnd_vegalite_v2)] = JSON.parse(limitstringmime(application_vnd_vegalite_v2, x))
end
Expand Down Expand Up @@ -57,14 +57,14 @@ function limitstringmime(mime::MIME, x)
if israwtext(mime, x)
return String(x)
else
show(IOContext(buf, :limit=>true, :color=>true), mime, x)
show(IOContext(buf, :limit => true, :color => true), mime, x)
end
else
b64 = Base64EncodePipe(buf)
if isa(x, Vector{UInt8})
write(b64, x) # x assumed to be raw binary data
else
show(IOContext(b64, :limit=>true, :color=>true), mime, x)
show(IOContext(b64, :limit => true, :color => true), mime, x)
end
close(b64)
end
Expand Down
Loading

0 comments on commit 2964c27

Please sign in to comment.