Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Format.jl instead of Formatting.jl #23

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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 Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name = "mPulseAPI"
uuid = "314d2b54-f2c3-11ea-15f2-0bcf2fc50b35"
authors = ["Akamai mPulse DSWB <[email protected]>"]
version = "1.2.1"
version = "1.2.2"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0"
Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"

[compat]
DataFrames = "1.6.1"
Formatting = "0.4.2"
Format = "1.3"
HTTP = "1.9.15"
JSON = "0.21.4"
LightXML = "0.9.1"
Expand Down
16 changes: 8 additions & 8 deletions docs/build-docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
###############################################################################################

using ArgParse
import Formatting, Pkg, YAML, InteractiveUtils
import Format, Pkg, YAML, InteractiveUtils
import InteractiveUtils.subtypes

s = ArgParseSettings()
Expand Down Expand Up @@ -114,7 +114,7 @@ function symbol2dict(file_deets::Dict, k, k_doc)
text = "",
binding = k
)]
local cm = `grep -rEl ^$(Formatting.format(declarator[Base.Docs.Binding], name)) $(dirname(pathof(modl)))`
local cm = `grep -rEl ^$(Format.format(declarator[Base.Docs.Binding], name)) $(dirname(pathof(modl)))`

possible_path = filter(x -> !occursin(".swp", x), readlines(cm))
if !isempty(length(possible_path))
Expand Down Expand Up @@ -174,7 +174,7 @@ function symbol2dict(file_deets::Dict, k, k_doc)

if string(fn) != name
# This is an alias, so we should use its own documentation
line = findlast(contains(Regex("^$(Formatting.format(declarator[Base.Docs.Binding], name))")), lines)
line = findlast(contains(Regex("^$(Format.format(declarator[Base.Docs.Binding], name))")), lines)
push!(retvals, Dict(
:module => string(modl),
:name => name,
Expand Down Expand Up @@ -298,15 +298,15 @@ function symbol2dict(file_deets::Dict, k, k_doc)
retvals[1][:name] = retvals[1][:basename]
end
else
line = findlast(contains(Regex("^\\s*$(Formatting.format(declarator[typ], replace(name, r"([{}])" => s"\\\1")))")), lines)
line = findlast(contains(Regex("^\\s*$(Format.format(declarator[typ], replace(name, r"([{}])" => s"\\\1")))")), lines)

# We couldn't find the exact type, but it's possible this was an alias of a type, so is defined as a `const`
if line == nothing && typeof(k) == Base.Docs.Binding
line = findlast(contains(Regex("^$(Formatting.format(declarator[Base.Docs.Binding], replace(name, r"([{}])" => s"\\\1")))")), lines)
line = findlast(contains(Regex("^$(Format.format(declarator[Base.Docs.Binding], replace(name, r"([{}])" => s"\\\1")))")), lines)
end

if line == nothing
println(Regex("^\\s*$(Formatting.format(declarator[typ], replace(name, r"([{}])" => s"\\\1")))"))
println(Regex("^\\s*$(Format.format(declarator[typ], replace(name, r"([{}])" => s"\\\1")))"))
printwarn("$typ $name not found in $file")
return retvals
end
Expand Down Expand Up @@ -527,7 +527,7 @@ function getSymbols(modl::Module; order=[Module, DataType, Macro, Function, Base
expo_order = Dict(true => "1", false => "2")
type_order = Dict(zip(order, 1:length(order)))

sort!(symbols, by = x -> Formatting.format("{3}.{1}.{2}.{4:04d}.{5}", expo_order[x[:exported]], type_order[x[:type]], x[:file], x[:line], x[:name]))
sort!(symbols, by = x -> Format.format("{3}.{1}.{2}.{4:04d}.{5}", expo_order[x[:exported]], type_order[x[:type]], x[:file], x[:line], x[:name]))

if Pkg.project().path != proj_path
Pkg.activate(dirname(proj_path))
Expand Down Expand Up @@ -649,7 +649,7 @@ function processModulePage(page::Page, mdfile_path::AbstractString)
# Use HTML here because markdown doesn't support inserting classes into UL and LI elements
println(md, """<ul class="symbols">""")
for s in Base.sort(filter(s -> s[:type] != Module, file_symbs), by = s->(!s[:exported], s[:name]))
Formatting.printfmtln(md, """<li class="{3:s}" title="{3:s}"><a href="{2:s}">{1:s}</a></li>""", s[:name], joinpath("..", replace(refids[string(s[:module], ".", s[:name])], r"\.md($|#)" => s".html\1")), s[:exported] ? "exported" : "internal")
Format.printfmtln(md, """<li class="{3:s}" title="{3:s}"><a href="{2:s}">{1:s}</a></li>""", s[:name], joinpath("..", replace(refids[string(s[:module], ".", s[:name])], r"\.md($|#)" => s".html\1")), s[:exported] ? "exported" : "internal")
end
println(md, """</ul>""")
end
Expand Down
2 changes: 1 addition & 1 deletion src/QueryAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
###################################################

using DataFrames, JSON, Formatting
using DataFrames, JSON, Format

const nullval = missing

Expand Down
4 changes: 2 additions & 2 deletions src/mPulseAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module mPulseAPI

using Dates

using LightXML, Formatting, TimeZones, DataFrames
using LightXML, Format, TimeZones, DataFrames
import HTTP
export LightXML

Expand Down Expand Up @@ -123,7 +123,7 @@ function readdocs(name::AbstractString, replacers=[]; indent=0)

# And run the whole thing through format
try
data = Formatting.format(data, replacers...)
data = Format.format(data, replacers...)
catch
@warn replacers
@warn data
Expand Down