Skip to content

Commit

Permalink
Rename db.SpotlightRawEmbedOrTextTag
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed May 21, 2024
1 parent 086b940 commit cb1d9ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions internal/db/gdocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type GDocsMetadata struct {
}

const (
ImageEmbedTag = "image"
RawEmbedTag = "raw"
ToCEmbedTag = "toc"
SpotlightRawEmbedTag = "spl"
PartnerRawEmbedTag = "partner-embed"
PartnerTextTag = "partner-text"
ImageEmbedTag = "image"
RawEmbedTag = "raw"
ToCEmbedTag = "toc"
SpotlightRawEmbedOrTextTag = "spl"
PartnerRawEmbedTag = "partner-embed"
PartnerTextTag = "partner-text"
)

type Embed struct {
Expand All @@ -58,7 +58,7 @@ func (em *Embed) UnmarshalJSON(data []byte) error {
return err
}
em.Value = img
case RawEmbedTag, ToCEmbedTag, SpotlightRawEmbedTag, PartnerRawEmbedTag, PartnerTextTag:
case RawEmbedTag, ToCEmbedTag, SpotlightRawEmbedOrTextTag, PartnerRawEmbedTag, PartnerTextTag:
var s string
if err := json.Unmarshal(temp.Value, &s); err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions pkg/almanack/service-gdocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ func (svc Services) ProcessGDocsDoc(ctx context.Context, dbDoc db.GDocsDoc) (err
n++
case "spl", "spl-embed":
embedHTML := xhtml.InnerText(rows.At(1, 0))
embed.Type = db.SpotlightRawEmbedTag
embed.Type = db.SpotlightRawEmbedOrTextTag
embed.Value = embedHTML
value := must.Get(json.Marshal(embed))
data := xhtml.New("data", "value", string(value))
xhtml.ReplaceWith(tbl, data)
case "spl-text":
embed.Type = db.SpotlightRawEmbedTag
embed.Type = db.SpotlightRawEmbedOrTextTag
n := xhtml.Clone(rows.At(1, 0))
blocko.MergeSiblings(n)
blocko.RemoveEmptyP(n)
Expand Down Expand Up @@ -539,7 +539,7 @@ func fixRichTextPlaceholders(richText *html.Node) {
for _, dataEl := range embeds {
embed := extractEmbed(dataEl)
switch embed.Type {
case db.SpotlightRawEmbedTag:
case db.SpotlightRawEmbedOrTextTag:
dataEl.Parent.RemoveChild(dataEl)
continue
case db.PartnerTextTag:
Expand Down Expand Up @@ -569,7 +569,7 @@ func fixRawHTMLPlaceholders(rawHTML *html.Node) {
for _, dataEl := range embeds {
embed := extractEmbed(dataEl)
switch embed.Type {
case db.SpotlightRawEmbedTag:
case db.SpotlightRawEmbedOrTextTag:
dataEl.Parent.RemoveChild(dataEl)
case db.RawEmbedTag, db.ToCEmbedTag, db.PartnerRawEmbedTag, db.PartnerTextTag:
xhtml.ReplaceWith(dataEl, &html.Node{
Expand All @@ -593,7 +593,7 @@ func fixMarkdownPlaceholders(rawHTML *html.Node) {
switch embed.Type {
case db.PartnerRawEmbedTag, db.PartnerTextTag:
dataEl.Parent.RemoveChild(dataEl)
case db.RawEmbedTag, db.SpotlightRawEmbedTag:
case db.RawEmbedTag, db.SpotlightRawEmbedOrTextTag:
xhtml.ReplaceWith(dataEl, &html.Node{
Type: html.RawNode,
Data: embed.Value.(string),
Expand Down

0 comments on commit cb1d9ff

Please sign in to comment.