-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
33 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,53 @@ import ( | |
) | ||
|
||
const templateFile = "./internal/output/output_html_template.html" | ||
const templateRaw = `<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>{{ .Target }} - linx report</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="mb-5 pb-3 fs-4 border-bottom"> | ||
{{ .Target }} | ||
</div> | ||
<div class="table-responsive"> | ||
<table class="table table-striped table-hover"> | ||
<thead> | ||
<tr> | ||
<th scope="col">URL</th> | ||
<th scope="col">Location in file</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Results}} | ||
<tr> | ||
<td>{{ .URL }}</td> | ||
<td> | ||
<pre><code>{{ .Location }}</code></pre> | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="mt-5 pt-3 text-muted border-top"> | ||
created with <a href="https://github.com/riza/linx">linx</a> | ||
</div> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" | ||
crossorigin="anonymous"></script> | ||
</body> | ||
</html>` | ||
|
||
type OutputHTML struct { | ||
output OutputData | ||
|
@@ -22,7 +69,7 @@ func (oh OutputHTML) RenderAndSave() error { | |
} | ||
defer f.Close() | ||
|
||
t, err := template.ParseFiles(templateFile) | ||
t, err := template.New("output").Parse(templateRaw) | ||
if err != nil { | ||
return err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,40 +9,35 @@ | |
</head> | ||
<body> | ||
|
||
<div class="col-lg-8 mx-auto p-3 py-md-5"> | ||
<header class="d-flex align-items-center pb-3 mb-5 border-bottom"> | ||
<a href="/" class="d-flex align-items-center text-dark text-decoration-none"> | ||
<span class="fs-4">{{ .Target }}</span> | ||
</a> | ||
</header> | ||
<div class="container"> | ||
<div class="mb-5 pb-3 fs-4 border-bottom"> | ||
{{ .Target }} | ||
</div> | ||
|
||
<main> | ||
<div class="row g-12"> | ||
<div class="col-md-12"> | ||
<table style="table-layout: fixed" class="table table-striped table-hover"> | ||
<thead> | ||
<tr> | ||
<th scope="col">URL</th> | ||
<th scope="col">Location in file</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Results}} | ||
<tr> | ||
<td>{{ .URL }}</td> | ||
<td> | ||
<pre><code>{{ .Location }}</code></pre> | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</main> | ||
<footer class="pt-5 my-5 text-muted border-top"> | ||
<div class="table-responsive"> | ||
<table class="table table-striped table-hover"> | ||
<thead> | ||
<tr> | ||
<th scope="col">URL</th> | ||
<th scope="col">Location in file</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{range .Results}} | ||
<tr> | ||
<td>{{ .URL }}</td> | ||
<td> | ||
<pre><code>{{ .Location }}</code></pre> | ||
</td> | ||
</tr> | ||
{{end}} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<div class="mt-5 pt-3 text-muted border-top"> | ||
created with <a href="https://github.com/riza/linx">linx</a> | ||
</footer> | ||
</div> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
|