Skip to content

Commit

Permalink
added favicon to redochtml and removed it's external dependency on an…
Browse files Browse the repository at this point in the history
… unused font
  • Loading branch information
ndortega committed Apr 2, 2024
1 parent 1fbea7b commit 1ec3a83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/autodoc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function readstaticfile(filepath::String) :: String
return read(path, String)
end

function redochtml(schemapath::String) :: HTTP.Response
function redochtml(schemapath::String, docspath::String) :: HTTP.Response
redocjs = readstaticfile("$REDOC_VERSION/redoc.standalone.js")

html("""
Expand All @@ -351,7 +351,7 @@ function redochtml(schemapath::String) :: HTTP.Response
<meta charset="utf-8"/>
<meta name="description" content="Docs" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="$docspath/metrics/favicon.ico">
</head>
<body>
Expand All @@ -366,7 +366,7 @@ end
"""
Return HTML page to render the autogenerated docs
"""
function swaggerhtml(schemapath::String; docspath::String = "/docs") :: HTTP.Response
function swaggerhtml(schemapath::String, docspath::String) :: HTTP.Response

# load static content files
swaggerjs = readstaticfile("$SWAGGER_VERSION/swagger-ui-bundle.js")
Expand Down
6 changes: 3 additions & 3 deletions src/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ end
# add the swagger and swagger/schema routes
function setupdocs(router::Router, schema::Dict, docspath::String, schemapath::String)
full_schema = "$docspath$schemapath"
register(router, "GET", "$docspath", () -> swaggerhtml(full_schema, docspath = docspath))
register(router, "GET", "$docspath/swagger", () -> swaggerhtml(full_schema, docspath = docspath))
register(router, "GET", "$docspath/redoc", () -> redochtml(full_schema))
register(router, "GET", "$docspath", () -> swaggerhtml(full_schema, docspath))
register(router, "GET", "$docspath/swagger", () -> swaggerhtml(full_schema, docspath))
register(router, "GET", "$docspath/redoc", () -> redochtml(full_schema, docspath))
register(router, "GET", full_schema, () -> schema)
end

Expand Down

0 comments on commit 1ec3a83

Please sign in to comment.