diff --git a/assets/2020-04-26-a-new-landscape-of-life-and-learning.md b/assets/2020-04-26-a-new-landscape-of-life-and-learning.md index 82d71cb..c6a3e0c 100644 --- a/assets/2020-04-26-a-new-landscape-of-life-and-learning.md +++ b/assets/2020-04-26-a-new-landscape-of-life-and-learning.md @@ -399,7 +399,7 @@ DB: Interesting. But now do you think the same opportunities would be had by peo RP: No, I've heard people express attitudes that you have to be qualified to have access to certain instruments. -[1:35:40] Did you read the book [[Arp, Halton, > Seeing Red]]? +[1:35:40] Did you read the book [[Arp, Halton > Seeing Red]]? DB: No, I have not. diff --git a/cmd/ray-peat-rodeo/main.go b/cmd/ray-peat-rodeo/main.go index fc57955..83eb7d5 100644 --- a/cmd/ray-peat-rodeo/main.go +++ b/cmd/ray-peat-rodeo/main.go @@ -87,8 +87,16 @@ func main() { return nil }) - catalog.WriteMentionPages() - catalog.WritePopups() + err = catalog.WriteMentionPages() + if err != nil { + log.Fatal("Failed to build mention pages:", err) + + } + err = catalog.WritePopups() + if err != nil { + log.Fatal("Failed to build mention popup page:", err) + + } slices.SortFunc(completedAssets, rprCatalog.SortAssetsByDateAdded) diff --git a/internal/catalog/asset.go b/internal/catalog/asset.go index 02cb1ce..ca7c55b 100644 --- a/internal/catalog/asset.go +++ b/internal/catalog/asset.go @@ -112,7 +112,6 @@ type AssetFrontMatter struct { } func NewAsset(assetPath string, markdownParser goldmark.Markdown, httpCache *cache.HTTPCache, avatarPaths *AvatarPaths) (*Asset, error) { - fmt.Println("new asset: " + assetPath) fileName := filepath.Base(assetPath) fileStem := strings.TrimSuffix(fileName, filepath.Ext(assetPath)) @@ -123,7 +122,6 @@ func NewAsset(assetPath string, markdownParser goldmark.Markdown, httpCache *cac // 🔗 Details - fmt.Println("File stem: ", fileStem) id := fileStem[11:] urlAbsPath := "/" + id editPermalink := global.GITHUB_LINK + path.Join("/edit/main", assetPath) diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index d229b79..1f4a04d 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -151,7 +151,7 @@ func (c *Catalog) WriteMentionPages() error { primaries := mentionsByFileBySecondary[ast.EmptyMentionablePart] delete(mentionsByFileBySecondary, ast.EmptyMentionablePart) - file, _ := utils.MakePage(unencode(primary.ID())) + file, _ := utils.MakePage(primary.ID()) component := MentionPage(primary, primaries, mentionsByFileBySecondary, c.HttpCache) err := component.Render(context.Background(), file) if err != nil { @@ -175,9 +175,10 @@ func (c *Catalog) WritePopups() error { } } - f, _ := utils.MakePage(unencode(location)) + f, _ := utils.MakePage(location) component := MentionablePopup(mentionable, mentionsByFile, otherMentionables) err := component.Render(context.Background(), f) + fmt.Println("Wrote Location: ", location) if err != nil { return fmt.Errorf("Failed to render template: %v", err) } diff --git a/internal/markdown/ast/mentionable_part.go b/internal/markdown/ast/mentionable_part.go index e981bc7..9fb8d40 100644 --- a/internal/markdown/ast/mentionable_part.go +++ b/internal/markdown/ast/mentionable_part.go @@ -9,6 +9,7 @@ import ( "net/url" "strings" + "github.com/gosimple/slug" "github.com/marcuswhybrow/ray-peat-rodeo/internal/cache" ) @@ -34,13 +35,10 @@ func (m *MentionablePart) HasPrefix() bool { func (m *MentionablePart) ID() string { id := m.Cardinal if m.HasPrefix() { - id = m.Prefix + "-" + m.Cardinal + id = m.Prefix + " " + m.Cardinal } - id = strings.ToLower(id) - id = strings.ReplaceAll(id, " ", "-") - id = strings.ReplaceAll(id, "'", "") - id = url.QueryEscape(id) - return id + slug.Lowercase = false + return slug.Make(id) } func (m *MentionablePart) TitleOrPrefixFirst() string {