Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add ability to add stem type(s) #412

Merged
merged 3 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/google/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ function gDocParse (catalog, jsonDoc) {
const regPhotoCredit = /\(pc (.*)\)/gim
const photoCreditMatch = regPhotoCredit.exec(cellString)

const regStemType = /\(stemtype\s+((?:topre|mx|alps|tmx|choc|bs)(?:\s+(?:topre|mx|alps|tmx|choc|bs))*)\b\)/gim
const stemTypeMatch = regStemType.exec(cellString)

let releaseDate
let totalCount
let commissioned
let giveaway
let photoCredit
let stemType

if (dateMatch) {
// eslint-disable-next-line prefer-destructuring
Expand All @@ -106,6 +110,12 @@ function gDocParse (catalog, jsonDoc) {
cellString = cellString.replace(regPhotoCredit, '')
}

if (stemTypeMatch) {
stemType = stemTypeMatch.slice(1)
stemType = stemType[0].split(' ')
cellString = cellString.replace(regStemType, '')
}

const sanitizedName = cellString.trim()
const imgKixId = imgId[0]
catalog.sculpts[catalog.sculpts.length - 1].colorways.push(
Expand All @@ -119,6 +129,7 @@ function gDocParse (catalog, jsonDoc) {
commissioned,
giveaway,
photoCredit,
stemType,
note: ''
}
)
Expand Down
1 change: 1 addition & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ To manipulate some attributes of the catalogs you can add those to the gdoc:
- **Colorway Header** `(*)` will add a "Commission" tag to the colorway page. `(*)` is removed from the colorway title.
- **Colorway Header** `(giveaway)` or `(give-away)` to note if a colorway was specificly for a giveaway
- **Colorway Header** `(pc Name)` will add photo credit to denote who owns the photo: `(pc Brandon Stanton)`
- **Colorway Header** `(stemtype mx|topre|alps|choc|tmx|bs)` will add stem types to each colorway. Any number of options can be listed separated by a space: `(stemtype topre)` `(stemtype mx topre alps)`

## Source Catalogs

Expand Down
Loading