Skip to content

Commit

Permalink
add "needs-transcript" functionality
Browse files Browse the repository at this point in the history
sources suggested for transcription are now accessible
as part of `/status.json`
kouloumos committed Jun 13, 2024
1 parent b0d2fd6 commit 91ecd18
Showing 3 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ DefaultContentLanguage = "en"
category = 'categories'
tag = 'tags'
speaker = 'speakers'
needs = 'needs'

[module]
[[module.mounts]]
29 changes: 27 additions & 2 deletions themes/ace-documentation/layouts/_default/list.status.json
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
{{ $speakerData := slice }}
{{ $tagData := slice }}
{{ $categoryData := slice }}
{{ $needsData := dict }}

{{ range .Site.Taxonomies.speakers }}
{{ $speakerData = $speakerData | append .Page.LinkTitle }}
@@ -47,17 +48,41 @@
{{ $categoryData = $categoryData | append $category }}
{{ end }}

{{ range $need, $pages := .Site.Taxonomies.needs }}
{{ $transcriptsForNeed := slice }}
{{ range $pages }}
{{ $formattedDate := "" }}
{{ if isset .Params "date" }}
{{ $formattedDate = dateFormat "2006-01-02" .Params.date }}
{{ end }}
{{ $transcriptData := dict
"url" .Permalink
"title" .Title
"tags" .Params.tags
"speakers" .Params.speakers
"source_file" .Params.media
"categories" .Params.categories
"date" $formattedDate
"loc" (path.Dir .File.Path)
}}
{{ $transcriptsForNeed = $transcriptsForNeed | append $transcriptData }}
{{ end }}
{{ $needsData = merge $needsData (dict $need $transcriptsForNeed) }}
{{ end }}

{{ $media := slice }}

{{ range .Site.RegularPages }}
{{ $mediaValue := .Params.media }}
{{ if $mediaValue }}
{{ $media = $media | append $mediaValue }}
{{ $needsTranscription := in .Params.needs "transcription" }}
{{ if and $mediaValue (not $needsTranscription) }}
{{ $media = $media | append $mediaValue }}
{{ end }}
{{ end }}

{{ $jsonData := dict "speakers" $speakerData "tags" $tagData "categories" $categoryData "media" $media }}
{{- $.Scratch.SetInMap "status" "existing" $jsonData -}}
{{- $.Scratch.SetInMap "status" "missing" ($.Scratch.Get "missing") -}}
{{- $.Scratch.SetInMap "status" "transcripts" ($.Scratch.Get "transcripts") -}}
{{- $.Scratch.SetInMap "status" "needs" $needsData -}}
{{- $.Scratch.Get "status" | jsonify -}}
17 changes: 16 additions & 1 deletion themes/ace-documentation/layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -16,7 +16,9 @@ <h1>{{ .Title }}</h1>
<p><i>{{ i18n "date" | title }}: {{ .Params.date.Format "January 2, 2006" }}</i></p>
{{ end }}

<p><i>{{ i18n "transcript_by" | title }}: {{ .Params.transcript_by }}</i></p>
{{ if .Params.transcript_by }}
<p><i>{{ i18n "transcript_by" | title }}: {{ .Params.transcript_by }}</i></p>
{{ end }}

{{ if .Params.translation_by }}
<p><i>{{ i18n "translation_by" | title }}: {{ .Params.translation_by }}</i></p>
@@ -59,6 +61,19 @@ <h1>{{ .Title }}</h1>
</div>
{{ end }}

{{ if in .Params.needs "transcript" }}
<div class="alert alert-warning">
<div class="ai-generated">
<i class='fas fa-robot'></i>
<span>This source has been suggested for transcription</span>
</div>
<span>The AI-generated transcript will be available for review shortly.</span>
<a href="https://review.btctranscripts.com" target="_blank" data-umami-event="click-transcript-banner">
Learn More >
</a>
</div>
{{ end }}

{{ .Content }}

{{ if .IsTranslated }}

0 comments on commit 91ecd18

Please sign in to comment.