If you're looking at the internals, you are probably good enough at reading documentation... Here are the doc-strings, my friend. Thank you for contributing.
Base.write — MethodInternals
write(s::SpoofStream, e::Any) -> _
A binding to Base.write that allows one to write to SpoofStream.text.
example
s = SpoofStream()
write(s, "hi")
println(s.text)
hiBase.write — MethodInternals
write(s::SpoofStream, e::Servable) -> _
A binding to Base.write that allows one to write a Servable to SpoofStream.text.
example
s = SpoofStream()
write(s, p("hello"))
println(s.text)
<p id = "hello"></p>Toolips.create_serverdeps — FunctionInternals
create_serverdeps(name::String, inc::String) -> _
Creates the essential portions of the webapp file structure, where name is the project's name and inc is any extensions or strings to incorporate at the top of the file.
example
create_serverdeps("ToolipsApp")Toolips.serverfuncdefs — FunctionCore
serverfuncdefs(::AbstractVector, ::String, ::Integer,
::Dict) -> (::Function, ::Function, ::Function)
This method is used internally by a constructor to generate the functions add, start, and remove for the ServerTemplate.
example
Toolips._start — FunctionCore - Internals
_start(routes::AbstractVector, ip::String, port::Integer,
extensions::Dict, c::Type) -> ::WebServer
This is an internal function for the ServerTemplate. This function is binded to the ServerTemplate.start field.
example
st = ServerTemplate()
st.start()Toolips.generate_router — FunctionCore - Internals
generate_router(routes::AbstractVector, server::Any, extensions::Dict,
conn::Type)This method is used internally by the _start method. It returns a closure function that both routes and calls functions.
example
server = Sockets.listen(Sockets.InetAddr(parse(IPAddr, ip), port))
if has_extension(extensions, Logger)
extensions[Logger].log(1,
"Toolips Server starting on port " * string(port))
end
routefunc, rdct, extensions = generate_router(routes, server, extensions,
Connection)
@async HTTP.listen(routefunc, ip, port, server = server)Toolips._log — FunctionExtensions
_log(level::Int64, message::String, levels::Dict, out::String) -> _
Binded call for the field log() inside of Logger(). See ?(Logger) for more details on the field log. All arguments are fields of that type. Return is a printout into the REPL as well as an append to the log file, provided by the out URI. –––––––––
example (Closure from Logger)
log(level::Int64, message::String) = _log(level, message, levels, out)
log(message::String) = _log(1, message, levels, out)Extensions
_log(http::HTTP.Stream, message::String) -> _
Binded call for the field log() inside of Logger(). This will log both to the JavaScript/HTML console. –––––––––
example (Closure from Logger)
log(http::HTTP.Stream, message::String) = _log(http, message)Base.string — FunctionInternals
string(r::Vector{UInt8}) -> ::String
Turns a vector of UInt8s into a string.
Interface
string(c::Component) -> ::String
Shows c as a string representation of itself.
example
c = divider("example", align = "center")
string(c)
"divider: align = center"Toolips.SpoofConnection — TypeSpoofConnection <: AbstractConnection
- routes::Dict
- http::SpoofStream
- extensions::Dict -
Builds a fake connection with a SpoofStream. Useful if you want to write a Servable without a server.
example
fakec = SpoofConnection()
servable = Component()
# write!(::AbstractConnection, ::Servable):
write!(fakec, servable)field info
- routes::Dict - A dictionary of routes, usually left empty.
- http::SpoofStream - A fake http stream that instead writes output to a string.
- extensions::Dict - A dictionary of extensions, usually empty.
constructors
- SpoofStream(r::Dict, http::SpoofStream, extensions::Dict)
- SpoofStream()
Toolips.SpoofStream — TypeSpoofStream
- text::String
The SpoofStream allows us to fake a connection by building a SpoofConnection which will write to the SpoofStream.text field whenever write! is called. This is useful for testing, or just writing servables into a string.
example
stream = SpoofStream()
write(stream, "hello!")
println(stream.text)
hello!
conn = SpoofConnection()
servab = Component()
write!(conn, servab)field info
- text::String - The text written to the stream.
constructors
- SpoofStream()
Toolips.route_from_dir — FunctionExtensions
routefromdir(dir::String) -> ::Vector{String}
Recursively appends filenames for a directory AND all subsequent directories.
example
x::Vector{String} = route_from_dir("mypath")Base.show — MethodInterface
show(t::Base.TTY, x::Component) -> _
Shows a component as markdown in a terminal.
example
# In the terminal, elsewhere the component will show as HTML.
show(x)Base.show — MethodInterface
show(x::Component) -> _
Shows a component as HTML.
example
show(x)Toolips.show_log — FunctionExtensions
show_log(level::Int64, message::String, levels::Dict{Any, Crayon},
prefix::String, time::Any)Prints a log to the screen.
example
show_log(1, "hello!", levels, "toolips> ", now()
[2022:05:23:22:01] toolips> hello!Toolips.@L_str — MacroInterface
L_str(s::String) -> ::String
Creates a literal string
example
x = 5
L"dollar_signx" # pretend dollar_sign is a dollar sign.Toolips.has_extension — MethodInternals
has_extension(d::Dict, t::Type) -> ::Bool
Checks if d has an extension of type t.
example
if has_extension(d, Logger)
d[:Logger].log("it has a logger, I think.")
endToolips.argsplit — FunctionInternals
argsplit(args::Vector{AbstractString}) -> ::Dict{Symbol, Any}
Used by the getargs method to parse GET arguments into a Dict.
example
argsplit(["c=5", "b=8"])
Dict(:c => 5, :b => 8)Base.string — MethodInternals
string(r::Vector{UInt8}) -> ::String
Turns a vector of UInt8s into a string.
Toolips.showchildren — FunctionInternals
showchildren(x::Component) -> ::String
Get the children of x as a markdown string.
example
c = divider("example")
child = p("mychild")
push!(c, child)
s = showchildren(c)
println(s)
"##### children
|-- mychild