Skip to content

Commit

Permalink
use pre tag for better copy/pasta experience
Browse files Browse the repository at this point in the history
  • Loading branch information
kaihendry committed Mar 11, 2024
1 parent 6e6e0af commit fe5c46b
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
margin-bottom: 1rem;
}

pre {
white-space: pre-wrap;
word-break: break-all;
font-family: inherit;
}

a {
color: #2a5db0;
text-decoration: none;
Expand All @@ -70,38 +76,25 @@
{{ end }}
</form>
</nav>
<main>
{{ $previousWeek := -1 }} <!-- Initialize a variable to track the previous week number -->

{{range $day := .Days }}

{{ $currentWeek := $day.Date | weekNumber }} <!-- Get the current week number -->

{{ if ne $currentWeek $previousWeek }} <!-- Compare with the previous week number -->

<h2>Week Number: {{ $currentWeek }}</h2> <!-- Print the week number if it's different -->

{{ $previousWeek = $currentWeek }} <!-- Update the previous week number -->

{{ end }}

{{ if eq ($day.Date.Format "2006-01-02") ($.Now.Format "2006-01-02") }}

<p><strong>{{ $day.Date.Format "2006-01-02 Mon" }}</strong></p>

{{ else }}

<p>
{{- $day.Date.Format "2006-01-02 Mon" }}
{{ if $day.IsHoliday }}<span> ({{ $day.HolidaySummary }})</span>{{ end }}
</p>

{{ end }}
{{end}}
<main>
{{- $previousWeek := -1 }}{{/* Initialize a variable to track the previous week number */}}
{{range $day := .Days -}}
{{- $currentWeek := $day.Date | weekNumber }}{{/* Get the current week number */}}
{{- if ne $currentWeek $previousWeek }}{{/* Compare with the previous week number */}}
<h2>Week Number: {{$currentWeek}}</h2>{{/* Print the week number if it's different */}}
{{- $previousWeek = $currentWeek }}{{/* Update the previous week number */}}
{{- end }}
{{- if eq ($day.Date.Format "2006-01-02") ($.Now.Format "2006-01-02") }}
<pre><strong>{{$day.Date.Format "2006-01-02 Mon"}}</strong></pre>
{{- else }}
<pre>{{$day.Date.Format "2006-01-02 Mon"}}{{if $day.IsHoliday}}<span> ({{$day.HolidaySummary}})</span>{{end}}</pre>
{{- end }}
{{- end }}
</main>

<br>
<p><a href="https://github.com/kaihendry/days/commit/{{ .Version }}">Source code</a></p>
</body>

</html>
</html>

0 comments on commit fe5c46b

Please sign in to comment.