Skip to content

Instantly share code, notes, and snippets.

@bdarcus
Created May 24, 2023 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdarcus/7688fa75f848f49e95118a1234c3647f to your computer and use it in GitHub Desktop.
Save bdarcus/7688fa75f848f49e95118a1234c3647f to your computer and use it in GitHub Desktop.
converted from typescript style model to go, using quicktype
// This file was generated from JSON Schema using quicktype, do not modify it directly.
// To parse and unparse this JSON data, add this code to your project and do:
//
// localizationTerms, err := UnmarshalLocalizationTerms(bytes)
// bytes, err = localizationTerms.Marshal()
//
// lang, err := UnmarshalLang(bytes)
// bytes, err = lang.Marshal()
//
// localizedTermName, err := UnmarshalLocalizedTermName(bytes)
// bytes, err = localizedTermName.Marshal()
//
// localizedTermNameMisc, err := UnmarshalLocalizedTermNameMisc(bytes)
// bytes, err = localizedTermNameMisc.Marshal()
//
// localizedTermNameLocator, err := UnmarshalLocalizedTermNameLocator(bytes)
// bytes, err = localizedTermNameLocator.Marshal()
//
// localizedTermNameLocatorNumber, err := UnmarshalLocalizedTermNameLocatorNumber(bytes)
// bytes, err = localizedTermNameLocatorNumber.Marshal()
//
// localizedTermFormat, err := UnmarshalLocalizedTermFormat(bytes)
// bytes, err = localizedTermFormat.Marshal()
//
// standaloneLocalize, err := UnmarshalStandaloneLocalize(bytes)
// bytes, err = standaloneLocalize.Marshal()
//
// localizedTerm, err := UnmarshalLocalizedTerm(bytes)
// bytes, err = localizedTerm.Marshal()
//
// optionsFile, err := UnmarshalOptionsFile(bytes)
// bytes, err = optionsFile.Marshal()
//
// sortRules, err := UnmarshalSortRules(bytes)
// bytes, err = sortRules.Marshal()
//
// groupSortKeys, err := UnmarshalGroupSortKeys(bytes)
// bytes, err = groupSortKeys.Marshal()
//
// substitute, err := UnmarshalSubstitute(bytes)
// bytes, err = substitute.Marshal()
//
// options, err := UnmarshalOptions(bytes)
// bytes, err = options.Marshal()
//
// optionGroup, err := UnmarshalOptionGroup(bytes)
// bytes, err = optionGroup.Marshal()
//
// localization, err := UnmarshalLocalization(bytes)
// bytes, err = localization.Marshal()
//
// sortGroup, err := UnmarshalSortGroup(bytes)
// bytes, err = sortGroup.Marshal()
//
// sortConfig, err := UnmarshalSortConfig(bytes)
// bytes, err = sortConfig.Marshal()
//
// group, err := UnmarshalGroup(bytes)
// bytes, err = group.Marshal()
//
// disambiguation, err := UnmarshalDisambiguation(bytes)
// bytes, err = disambiguation.Marshal()
//
// substitution, err := UnmarshalSubstitution(bytes)
// bytes, err = substitution.Marshal()
//
// dateFormatting, err := UnmarshalDateFormatting(bytes)
// bytes, err = dateFormatting.Marshal()
//
// dateStyle, err := UnmarshalDateStyle(bytes)
// bytes, err = dateStyle.Marshal()
//
// yearStyle, err := UnmarshalYearStyle(bytes)
// bytes, err = yearStyle.Marshal()
//
// timeStyle, err := UnmarshalTimeStyle(bytes)
// bytes, err = timeStyle.Marshal()
//
// monthStyle, err := UnmarshalMonthStyle(bytes)
// bytes, err = monthStyle.Marshal()
//
// andAsString, err := UnmarshalAndAsString(bytes)
// bytes, err = andAsString.Marshal()
//
// contributorScope, err := UnmarshalContributorScope(bytes)
// bytes, err = contributorScope.Marshal()
//
// roleOption, err := UnmarshalRoleOption(bytes)
// bytes, err = roleOption.Marshal()
//
// contributorListShortening, err := UnmarshalContributorListShortening(bytes)
// bytes, err = contributorListShortening.Marshal()
//
// contributorListFormatting, err := UnmarshalContributorListFormatting(bytes)
// bytes, err = contributorListFormatting.Marshal()
//
// dateFormat, err := UnmarshalDateFormat(bytes)
// bytes, err = dateFormat.Marshal()
//
// wrapPunctuation, err := UnmarshalWrapPunctuation(bytes)
// bytes, err = wrapPunctuation.Marshal()
//
// delimiterPunctuation, err := UnmarshalDelimiterPunctuation(bytes)
// bytes, err = delimiterPunctuation.Marshal()
//
// matchWhich, err := UnmarshalMatchWhich(bytes)
// bytes, err = matchWhich.Marshal()
//
// templateComponent, err := UnmarshalTemplateComponent(bytes)
// bytes, err = templateComponent.Marshal()
//
// template, err := UnmarshalTemplate(bytes)
// bytes, err = template.Marshal()
//
// templateKey, err := UnmarshalTemplateKey(bytes)
// bytes, err = templateKey.Marshal()
//
// namedTemplate, err := UnmarshalNamedTemplate(bytes)
// bytes, err = namedTemplate.Marshal()
//
// topLevelTemplate, err := UnmarshalTopLevelTemplate(bytes)
// bytes, err = topLevelTemplate.Marshal()
//
// templateFile, err := UnmarshalTemplateFile(bytes)
// bytes, err = templateFile.Marshal()
//
// calledTemplate, err := UnmarshalCalledTemplate(bytes)
// bytes, err = calledTemplate.Marshal()
//
// inlineTemplate, err := UnmarshalInlineTemplate(bytes)
// bytes, err = inlineTemplate.Marshal()
//
// cond, err := UnmarshalCond(bytes)
// bytes, err = cond.Marshal()
//
// match, err := UnmarshalMatch(bytes)
// bytes, err = match.Marshal()
//
// isNumber, err := UnmarshalIsNumber(bytes)
// bytes, err = isNumber.Marshal()
//
// isEDTFDate, err := UnmarshalIsEDTFDate(bytes)
// bytes, err = isEDTFDate.Marshal()
//
// isRefType, err := UnmarshalIsRefType(bytes)
// bytes, err = isRefType.Marshal()
//
// hasVariable, err := UnmarshalHasVariable(bytes)
// bytes, err = hasVariable.Marshal()
//
// dataMatch, err := UnmarshalDataMatch(bytes)
// bytes, err = dataMatch.Marshal()
//
// condition, err := UnmarshalCondition(bytes)
// bytes, err = condition.Marshal()
//
// locale, err := UnmarshalLocale(bytes)
// bytes, err = locale.Marshal()
//
// renderList, err := UnmarshalRenderList(bytes)
// bytes, err = renderList.Marshal()
//
// renderListBlock, err := UnmarshalRenderListBlock(bytes)
// bytes, err = renderListBlock.Marshal()
//
// renderSimple, err := UnmarshalRenderSimple(bytes)
// bytes, err = renderSimple.Marshal()
//
// renderText, err := UnmarshalRenderText(bytes)
// bytes, err = renderText.Marshal()
//
// renderTerm, err := UnmarshalRenderTerm(bytes)
// bytes, err = renderTerm.Marshal()
//
// renderDate, err := UnmarshalRenderDate(bytes)
// bytes, err = renderDate.Marshal()
//
// renderTitle, err := UnmarshalRenderTitle(bytes)
// bytes, err = renderTitle.Marshal()
//
// renderContributors, err := UnmarshalRenderContributors(bytes)
// bytes, err = renderContributors.Marshal()
//
// renderLocators, err := UnmarshalRenderLocators(bytes)
// bytes, err = renderLocators.Marshal()
//
// csl, err := UnmarshalCsl(bytes)
// bytes, err = csl.Marshal()
//
// referenceTypes, err := UnmarshalReferenceTypes(bytes)
// bytes, err = referenceTypes.Marshal()
//
// contributorRoles, err := UnmarshalContributorRoles(bytes)
// bytes, err = contributorRoles.Marshal()
//
// dates, err := UnmarshalDates(bytes)
// bytes, err = dates.Marshal()
//
// titles, err := UnmarshalTitles(bytes)
// bytes, err = titles.Marshal()
//
// locators, err := UnmarshalLocators(bytes)
// bytes, err = locators.Marshal()
//
// simpleTypes, err := UnmarshalSimpleTypes(bytes)
// bytes, err = simpleTypes.Marshal()
//
// variables, err := UnmarshalVariables(bytes)
// bytes, err = variables.Marshal()
//
// styleCategory, err := UnmarshalStyleCategory(bytes)
// bytes, err = styleCategory.Marshal()
//
// style, err := UnmarshalStyle(bytes)
// bytes, err = style.Marshal()
//
// styleMetadata, err := UnmarshalStyleMetadata(bytes)
// bytes, err = styleMetadata.Marshal()
//
// hasFormatting, err := UnmarshalHasFormatting(bytes)
// bytes, err = hasFormatting.Marshal()
//
// citationStyle, err := UnmarshalCitationStyle(bytes)
// bytes, err = citationStyle.Marshal()
//
// bibliographyStyle, err := UnmarshalBibliographyStyle(bytes)
// bytes, err = bibliographyStyle.Marshal()
//
// recordLocalizedTermNameLocalizedTerm, err := UnmarshalRecordLocalizedTermNameLocalizedTerm(bytes)
// bytes, err = recordLocalizedTermNameLocalizedTerm.Marshal()
package main
import "bytes"
import "errors"
import "encoding/json"
func UnmarshalLocalizationTerms(data []byte) (LocalizationTerms, error) {
var r LocalizationTerms
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizationTerms) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLang(data []byte) (Lang, error) {
var r Lang
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Lang) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTermName(data []byte) (LocalizedTermName, error) {
var r LocalizedTermName
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTermName) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTermNameMisc(data []byte) (LocalizedTermNameMisc, error) {
var r LocalizedTermNameMisc
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTermNameMisc) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTermNameLocator(data []byte) (LocalizedTermNameLocator, error) {
var r LocalizedTermNameLocator
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTermNameLocator) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTermNameLocatorNumber(data []byte) (LocalizedTermNameLocatorNumber, error) {
var r LocalizedTermNameLocatorNumber
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTermNameLocatorNumber) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTermFormat(data []byte) (LocalizedTermFormat, error) {
var r LocalizedTermFormat
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTermFormat) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalStandaloneLocalize(data []byte) (StandaloneLocalize, error) {
var r StandaloneLocalize
err := json.Unmarshal(data, &r)
return r, err
}
func (r *StandaloneLocalize) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalizedTerm(data []byte) (LocalizedTerm, error) {
var r LocalizedTerm
err := json.Unmarshal(data, &r)
return r, err
}
func (r *LocalizedTerm) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalOptionsFile(data []byte) (OptionsFile, error) {
var r OptionsFile
err := json.Unmarshal(data, &r)
return r, err
}
func (r *OptionsFile) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSortRules(data []byte) (SortRules, error) {
var r SortRules
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SortRules) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalGroupSortKeys(data []byte) (GroupSortKeys, error) {
var r GroupSortKeys
err := json.Unmarshal(data, &r)
return r, err
}
func (r *GroupSortKeys) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSubstitute(data []byte) (Substitute, error) {
var r Substitute
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Substitute) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalOptions(data []byte) (Options, error) {
var r Options
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Options) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalOptionGroup(data []byte) (OptionGroup, error) {
var r OptionGroup
err := json.Unmarshal(data, &r)
return r, err
}
func (r *OptionGroup) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocalization(data []byte) (Localization, error) {
var r Localization
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Localization) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSortGroup(data []byte) (SortGroup, error) {
var r SortGroup
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SortGroup) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSortConfig(data []byte) (SortConfig, error) {
var r SortConfig
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SortConfig) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalGroup(data []byte) (Group, error) {
var r Group
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Group) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDisambiguation(data []byte) (Disambiguation, error) {
var r Disambiguation
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Disambiguation) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSubstitution(data []byte) (Substitution, error) {
var r Substitution
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Substitution) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDateFormatting(data []byte) (DateFormatting, error) {
var r DateFormatting
err := json.Unmarshal(data, &r)
return r, err
}
func (r *DateFormatting) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDateStyle(data []byte) (DateStyle, error) {
var r DateStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *DateStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalYearStyle(data []byte) (YearStyle, error) {
var r YearStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *YearStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTimeStyle(data []byte) (TimeStyle, error) {
var r TimeStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TimeStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalMonthStyle(data []byte) (MonthStyle, error) {
var r MonthStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *MonthStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalAndAsString(data []byte) (AndAsString, error) {
var r AndAsString
err := json.Unmarshal(data, &r)
return r, err
}
func (r *AndAsString) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalContributorScope(data []byte) (ContributorScope, error) {
var r ContributorScope
err := json.Unmarshal(data, &r)
return r, err
}
func (r *ContributorScope) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRoleOption(data []byte) (RoleOption, error) {
var r RoleOption
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RoleOption) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalContributorListShortening(data []byte) (ContributorListShortening, error) {
var r ContributorListShortening
err := json.Unmarshal(data, &r)
return r, err
}
func (r *ContributorListShortening) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalContributorListFormatting(data []byte) (ContributorListFormatting, error) {
var r ContributorListFormatting
err := json.Unmarshal(data, &r)
return r, err
}
func (r *ContributorListFormatting) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDateFormat(data []byte) (DateFormat, error) {
var r DateFormat
err := json.Unmarshal(data, &r)
return r, err
}
func (r *DateFormat) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalWrapPunctuation(data []byte) (WrapPunctuation, error) {
var r WrapPunctuation
err := json.Unmarshal(data, &r)
return r, err
}
func (r *WrapPunctuation) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDelimiterPunctuation(data []byte) (DelimiterPunctuation, error) {
var r DelimiterPunctuation
err := json.Unmarshal(data, &r)
return r, err
}
func (r *DelimiterPunctuation) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalMatchWhich(data []byte) (MatchWhich, error) {
var r MatchWhich
err := json.Unmarshal(data, &r)
return r, err
}
func (r *MatchWhich) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTemplateComponent(data []byte) (TemplateComponent, error) {
var r TemplateComponent
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TemplateComponent) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTemplate(data []byte) (Template, error) {
var r Template
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Template) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type TemplateKey string
func UnmarshalTemplateKey(data []byte) (TemplateKey, error) {
var r TemplateKey
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TemplateKey) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalNamedTemplate(data []byte) (NamedTemplate, error) {
var r NamedTemplate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *NamedTemplate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTopLevelTemplate(data []byte) (TopLevelTemplate, error) {
var r TopLevelTemplate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TopLevelTemplate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTemplateFile(data []byte) (TemplateFile, error) {
var r TemplateFile
err := json.Unmarshal(data, &r)
return r, err
}
func (r *TemplateFile) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalCalledTemplate(data []byte) (CalledTemplate, error) {
var r CalledTemplate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *CalledTemplate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalInlineTemplate(data []byte) (InlineTemplate, error) {
var r InlineTemplate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *InlineTemplate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalCond(data []byte) (Cond, error) {
var r Cond
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Cond) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalMatch(data []byte) (Match, error) {
var r Match
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Match) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalIsNumber(data []byte) (IsNumber, error) {
var r IsNumber
err := json.Unmarshal(data, &r)
return r, err
}
func (r *IsNumber) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalIsEDTFDate(data []byte) (IsEDTFDate, error) {
var r IsEDTFDate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *IsEDTFDate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalIsRefType(data []byte) (IsRefType, error) {
var r IsRefType
err := json.Unmarshal(data, &r)
return r, err
}
func (r *IsRefType) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalHasVariable(data []byte) (HasVariable, error) {
var r HasVariable
err := json.Unmarshal(data, &r)
return r, err
}
func (r *HasVariable) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDataMatch(data []byte) (DataMatch, error) {
var r DataMatch
err := json.Unmarshal(data, &r)
return r, err
}
func (r *DataMatch) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalCondition(data []byte) (Condition, error) {
var r Condition
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Condition) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocale(data []byte) (Locale, error) {
var r Locale
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Locale) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderList(data []byte) (RenderList, error) {
var r RenderList
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderList) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderListBlock(data []byte) (RenderListBlock, error) {
var r RenderListBlock
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderListBlock) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderSimple(data []byte) (RenderSimple, error) {
var r RenderSimple
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderSimple) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderText(data []byte) (RenderText, error) {
var r RenderText
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderText) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderTerm(data []byte) (RenderTerm, error) {
var r RenderTerm
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderTerm) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderDate(data []byte) (RenderDate, error) {
var r RenderDate
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderDate) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderTitle(data []byte) (RenderTitle, error) {
var r RenderTitle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderTitle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderContributors(data []byte) (RenderContributors, error) {
var r RenderContributors
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderContributors) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRenderLocators(data []byte) (RenderLocators, error) {
var r RenderLocators
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RenderLocators) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalCsl(data []byte) (Csl, error) {
var r Csl
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Csl) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalReferenceTypes(data []byte) (ReferenceTypes, error) {
var r ReferenceTypes
err := json.Unmarshal(data, &r)
return r, err
}
func (r *ReferenceTypes) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalContributorRoles(data []byte) (ContributorRoles, error) {
var r ContributorRoles
err := json.Unmarshal(data, &r)
return r, err
}
func (r *ContributorRoles) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalDates(data []byte) (Dates, error) {
var r Dates
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Dates) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalTitles(data []byte) (Titles, error) {
var r Titles
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Titles) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalLocators(data []byte) (Locators, error) {
var r Locators
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Locators) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalSimpleTypes(data []byte) (SimpleTypes, error) {
var r SimpleTypes
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SimpleTypes) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalVariables(data []byte) (Variables, error) {
var r Variables
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Variables) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalStyleCategory(data []byte) (StyleCategory, error) {
var r StyleCategory
err := json.Unmarshal(data, &r)
return r, err
}
func (r *StyleCategory) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalStyle(data []byte) (Style, error) {
var r Style
err := json.Unmarshal(data, &r)
return r, err
}
func (r *Style) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalStyleMetadata(data []byte) (StyleMetadata, error) {
var r StyleMetadata
err := json.Unmarshal(data, &r)
return r, err
}
func (r *StyleMetadata) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalHasFormatting(data []byte) (HasFormatting, error) {
var r HasFormatting
err := json.Unmarshal(data, &r)
return r, err
}
func (r *HasFormatting) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalCitationStyle(data []byte) (CitationStyle, error) {
var r CitationStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *CitationStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalBibliographyStyle(data []byte) (BibliographyStyle, error) {
var r BibliographyStyle
err := json.Unmarshal(data, &r)
return r, err
}
func (r *BibliographyStyle) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func UnmarshalRecordLocalizedTermNameLocalizedTerm(data []byte) (RecordLocalizedTermNameLocalizedTerm, error) {
var r RecordLocalizedTermNameLocalizedTerm
err := json.Unmarshal(data, &r)
return r, err
}
func (r *RecordLocalizedTermNameLocalizedTerm) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type LocalizationTerms struct {
Description *string `json:"description,omitempty"`
Locale Lang `json:"locale"`
PunctuationInQuote *bool `json:"punctuationInQuote,omitempty"`
Terms RecordLocalizedTermNameLocalizedTerm `json:"terms"`
Title *string `json:"title,omitempty"`
}
type RecordLocalizedTermNameLocalizedTerm struct {
Accessed LocalizedTerm `json:"accessed"`
Act LocalizedTerm `json:"act"`
Ad LocalizedTerm `json:"ad"`
AdvanceOnlinePublication LocalizedTerm `json:"advance-online-publication"`
Album LocalizedTerm `json:"album"`
And LocalizedTerm `json:"and"`
AndOthers LocalizedTerm `json:"and-others"`
Anonymous LocalizedTerm `json:"anonymous"`
Appendix LocalizedTerm `json:"appendix"`
ArticleLocator LocalizedTerm `json:"article-locator"`
At LocalizedTerm `json:"at"`
AudioRecording LocalizedTerm `json:"audio-recording"`
AvailableAt LocalizedTerm `json:"available-at"`
Bc LocalizedTerm `json:"bc"`
Bce LocalizedTerm `json:"bce"`
Book LocalizedTerm `json:"book"`
By LocalizedTerm `json:"by"`
Canon LocalizedTerm `json:"canon"`
Ce LocalizedTerm `json:"ce"`
Chapter LocalizedTerm `json:"chapter"`
Circa LocalizedTerm `json:"circa"`
Cited LocalizedTerm `json:"cited"`
Column LocalizedTerm `json:"column"`
Elocation LocalizedTerm `json:"elocation"`
Equation LocalizedTerm `json:"equation"`
EtAl LocalizedTerm `json:"et-al"`
Figure LocalizedTerm `json:"figure"`
Film LocalizedTerm `json:"film"`
Folio LocalizedTerm `json:"folio"`
Forthcoming LocalizedTerm `json:"forthcoming"`
From LocalizedTerm `json:"from"`
Henceforth LocalizedTerm `json:"henceforth"`
Ibid LocalizedTerm `json:"ibid"`
In LocalizedTerm `json:"in"`
InPress LocalizedTerm `json:"in-press"`
Internet LocalizedTerm `json:"internet"`
Interview LocalizedTerm `json:"interview"`
Issue LocalizedTerm `json:"issue"`
Letter LocalizedTerm `json:"letter"`
Line LocalizedTerm `json:"line"`
LOCCit LocalizedTerm `json:"loc-cit"`
NoDate LocalizedTerm `json:"no date"`
NoPlace LocalizedTerm `json:"no-place"`
NoPublisher LocalizedTerm `json:"no-publisher"`
Note LocalizedTerm `json:"note"`
On LocalizedTerm `json:"on"`
Online LocalizedTerm `json:"online"`
OpCit LocalizedTerm `json:"op-cit"`
Opus LocalizedTerm `json:"opus"`
OriginalWorkPublished LocalizedTerm `json:"original-work-published"`
Page LocalizedTerm `json:"page"`
Paragraph LocalizedTerm `json:"paragraph"`
Part LocalizedTerm `json:"part"`
PersonalCommunication LocalizedTerm `json:"personal-communication"`
Podcast LocalizedTerm `json:"podcast"`
PodcastEpisode LocalizedTerm `json:"podcast-episode"`
Preprint LocalizedTerm `json:"preprint"`
PresentedAt LocalizedTerm `json:"presented-at"`
RadioBroadcast LocalizedTerm `json:"radio-broadcast"`
RadioSeries LocalizedTerm `json:"radio-series"`
RadioSeriesEpisode LocalizedTerm `json:"radio-series-episode"`
Reference LocalizedTerm `json:"reference"`
Retrieved LocalizedTerm `json:"retrieved"`
ReviewOf LocalizedTerm `json:"review-of"`
Rule LocalizedTerm `json:"rule"`
Scale LocalizedTerm `json:"scale"`
Scene LocalizedTerm `json:"scene"`
Section LocalizedTerm `json:"section"`
SpecialIssue LocalizedTerm `json:"special-issue"`
SpecialSection LocalizedTerm `json:"special-section"`
SubVerbo LocalizedTerm `json:"sub-verbo"`
Supplement LocalizedTerm `json:"supplement"`
Table LocalizedTerm `json:"table"`
TelevisionBroadcast LocalizedTerm `json:"television-broadcast"`
TelevisionSeries LocalizedTerm `json:"television-series"`
TelevisionSeriesEpisode LocalizedTerm `json:"television-series-episode"`
Timestamp LocalizedTerm `json:"timestamp"`
TitleLocator LocalizedTerm `json:"title-locator"`
Verse LocalizedTerm `json:"verse"`
Version LocalizedTerm `json:"version"`
Video LocalizedTerm `json:"video"`
Volume LocalizedTerm `json:"volume"`
WorkingPaper LocalizedTerm `json:"working-paper"`
}
type LocalizedTerm struct {
Format *LocalizedTermFormat `json:"format,omitempty"`
Multiple *string `json:"multiple,omitempty"`
Single *string `json:"single,omitempty"`
}
type StandaloneLocalize struct {
Description *string `json:"description,omitempty"`
Format *LocalizedTermFormat `json:"format,omitempty"`
Multiple *string `json:"multiple,omitempty"`
Rights *string `json:"rights,omitempty"`
Single *string `json:"single,omitempty"`
Translators []string `json:"translators,omitempty"`
}
// Option model for style configuration.
type OptionsFile struct {
}
type SortRules struct {
Key GroupSortKeys `json:"key"`
// The order to sort the list.
Order Order `json:"order"`
}
type Options struct {
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
}
// Parameter groups.
type OptionGroup struct {
// Contributor list formatting configuration.
Contributors *ContributorListFormatting `json:"contributors,omitempty"`
// Date formatting configuration.
Dates *DateFormatting `json:"dates,omitempty"`
// Disambiguation configuration of rendererd group display names.
Disambiguate *Disambiguation `json:"disambiguate,omitempty"`
// Grouping configuration.
Group []GroupSortKeys `json:"group,omitempty"`
// Localization configuration.
Localization *Localization `json:"localization,omitempty"`
// Sorting configuration.
Sort []SortConfig `json:"sort,omitempty"`
// Substitution configuration.
Substitute *Substitution `json:"substitute,omitempty"`
}
// Contributor list formatting configuration.
type ContributorListFormatting struct {
// The delimiter between last and second-to-last item.
//
// The default "text" value produces:
//
// > Doe, Johnson and Smith
//
// The "symbol" value produces:
//
// > Doe, Johnson & Smith
AndAs *AndAsString `json:"andAs,omitempty"`
Bold *bool `json:"bold,omitempty"`
// Format a contributor name as sorted.
DisplayAsSort *ContributorScope `json:"displayAsSort,omitempty"`
Emph *bool `json:"emph,omitempty"`
// Configuring of the display of contributor rolee annotations.
Role *RoleOption `json:"role,omitempty"`
// Configuration for contributor list shortening.
Shorten *ContributorListShortening `json:"shorten,omitempty"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// Configuring of the display of contributor rolee annotations.
//
// Contributor role configuration.
type RoleOption struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
// The display form of the role.
//
// ### `long`
//
// The full name of the role.
//
// > Jane Smith (editor)
//
// ### `short`
//
// > Jane Smith (ed.)
//
// ### `verb`
//
// > edited by Jane Smith
//
// ### `verb-short`
//
// > ed. Jane Smith
Form *Form `json:"form,omitempty"`
// Contributor roles for which to omit the role description.
//
// The default value is `["author"]`, which omits the role for authors, including for any
// author substitutions.
Omit []ContributorRoles `json:"omit,omitempty"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// Configuration for contributor list shortening.
type ContributorListShortening struct {
// When shortening, replace omitted names with this term form.
//
// ### `short`
//
// > Doe, Johnson, et al.
//
// ### `long`
//
// > Doe, Johnson, and others
AtAl *AtAl `json:"atAl,omitempty"`
// Determines when the delimiter or a space is used between a truncated contributor list
// and the “et-al” (or “and others”) term in case of et-al abbreviation.
//
// Allowed values:
//
// ### `contextual`
//
// Delimiter is only used for contributor lists truncated to two or more items:
//
// - 1 name: “J. Doe et al.”
// - 2 names: “J. Doe, S. Smith, et al.”
//
// ### `after-inverted-name`
//
// Delimiter is only used if the preceding name is inverted as a result of the `asSort`
// parameter.
// E.g. with `asSort` set to “first”:
//
// - “Doe, J., et al.”
// - “Doe, J., S. Smith et al.”
//
// ### `always`
//
// Delimiter is always used:
//
// - 1 name: “J. Doe, et al.”
// - 2 names: “J. Doe, S. Smith, et al.”
//
// ### `never`
//
// Delimiter is never used:
// - 1 name: “J. Doe et al.”
// - 2 names: “J. Doe, S. Smith et al.”
DelimiterPrecedesEtAl *DelimiterPrecedes `json:"delimiterPrecedesEtAl,omitempty"`
// Determines when the delimiter is used to separate the second to last and the last
// item in contributor lists (if `and` is not set, the name delimiter is always used,
// regardless of the value of `delimiterPrecedesLast`). Allowed values:
//
// ### `contextual`
//
// The contributor delimiter is only used for lists of three or more:
//
// - 2 names: “J. Doe and T. Williams”
// - 3 names: “J. Doe, S. Smith, and T. Williams”
//
// ### `after-inverted-name`
//
// Delimiter is only used if the preceding name is inverted as a result of the
// `asSort` parameter. E.g. with `asSort` set to “first”:
//
// - “Doe, J., and T. Williams”
// - “Doe, J., S. Smith and T. Williams”
//
// ### `always`
//
// Delimiter is always used:
//
// - 2 names: “J. Doe, and T. Williams”
// - 3 names: “J. Doe, S. Smith, and T. Williams”
//
// ### `never`
//
// Delimiter is never used:
//
// - 2 names: “J. Doe and T. Williams”
// - 3 names: “J. Doe, S. Smith and T. Williams”
DelimiterPrecedesLast *DelimiterPrecedes `json:"delimiterPrecedesLast,omitempty"`
// The minimum length of the before acitvating shortening
Min *float64 `json:"min,omitempty"`
// When shortening, use the first number of contributors.
UseFirst *float64 `json:"useFirst,omitempty"`
}
// Date formatting configuration.
type DateFormatting struct {
Date *TimeStyle `json:"date,omitempty"`
Month *MonthStyle `json:"month,omitempty"`
Time *TimeStyle `json:"time,omitempty"`
Year *YearStyle `json:"year,omitempty"`
}
// Disambiguation configuration of rendererd group display names.
//
// Disambiguation of rendered group display name configuration.
type Disambiguation struct {
AddNames *AddNames `json:"addNames,omitempty"`
AddYearSuffix *bool `json:"addYearSuffix,omitempty"`
}
// Localization configuration.
//
// Terms and data localization configuration.
type Localization struct {
// The scope to use for localization.
//
// "per-item" uses the locale of the reference item, and "global" uses the target language
// across all references.
Scope *Scope `json:"scope,omitempty"`
}
// Reference sorting configuration.
type SortConfig struct {
Key GroupSortKeys `json:"key"`
Order Order `json:"order"`
}
// Substitution configuration.
//
// Substitution of variable configuration.
type Substitution struct {
// When author is nil, substitute the first non-nil listed variable.
// Once a substitution is made, the substituted variable shall be set to nil for purposes of
// later rendering.
Author []Substitute `json:"author"`
}
type SortGroup struct {
Key GroupSortKeys `json:"key"`
}
// Reference grouping of configuration.
type Group struct {
// The string with which to join two or more rendering comnponents.
Delimiter *string `json:"delimiter,omitempty"`
Key GroupSortKeys `json:"key"`
}
type MatchWhich struct {
// The conditions that must be true for the templates to render.
Match MatchEnum `json:"match"`
}
// Template property definition in the Style.
type TopLevelTemplate struct {
Templates NamedTemplate `json:"templates"`
}
// A global template that can be referenced by unique key.
type NamedTemplate struct {
}
// A standlone template file.
type TemplateFile struct {
Description *string `json:"description,omitempty"`
Templates NamedTemplate `json:"templates"`
Title *string `json:"title,omitempty"`
}
// A template is called by name.
type CalledTemplate struct {
TemplateKey string `json:"templateKey"`
}
// A template defined inline.
type InlineTemplate struct {
Template []TemplateComponent `json:"template"`
}
type Condition struct {
// Is the item variable a number?
IsNumber *Locators `json:"isNumber,omitempty"`
// The conditions that must be true for the templates to render.
Match MatchEnum `json:"match"`
Template []TemplateComponent `json:"template,omitempty"`
// Does the date conform to EDTF?
IsEDTFDate *Dates `json:"isEDTFDate,omitempty"`
// Is the item reference type among the listed reference types?
IsRefType []ReferenceTypes `json:"isRefType,omitempty"`
// Does the item reference include one of the listed variables?
HasVariable []Variables `json:"hasVariable,omitempty"`
// The item reference locale; to allow multilingual output.
Locale *string `json:"locale,omitempty"`
}
// When all of the when conditions are nil, format the children.
//
// The rendering of style templates can be specified by reference to a template name or by
// inline definition.
//
// A template defined inline.
//
// A template is called by name.
type Template struct {
Template []TemplateComponent `json:"template,omitempty"`
TemplateKey *string `json:"templateKey,omitempty"`
}
// A component of a CSL style template.
//
// Integral citations are those where the author is printed inline in the text; aka "in
// text" or "narrative" citations.
//
// Non-integral citations are those where the author is incorporated in the citation, and
// not printed inline in the text.
//
// A template is called by name.
//
// A template component for rendering contributors.
//
// A template component for rendering locators.
//
// A template component for rendering dates.
//
// A template component for rendering title.
//
// Non-localized plain text.
//
// Localized strings.
type TemplateComponent struct {
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template,omitempty"`
TemplateKey *string `json:"templateKey,omitempty"`
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
Variable *SimpleTypes `json:"variable,omitempty"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
Contributor *ContributorRoles `json:"contributor,omitempty"`
Locator *Locators `json:"locator,omitempty"`
Date *Dates `json:"date,omitempty"`
Format *TemplateComponentFormat `json:"format,omitempty"`
Title *Titles `json:"title,omitempty"`
Text *string `json:"text,omitempty"`
Term *LocalizedTermName `json:"term,omitempty"`
// When all of the when conditions are nil, format the children.
Else *Template `json:"else,omitempty"`
// For the first condition that is non-nil, format the children.
When []Condition `json:"when,omitempty"`
}
type Cond struct {
// When all of the when conditions are nil, format the children.
Else *Template `json:"else,omitempty"`
// For the first condition that is non-nil, format the children.
When []Condition `json:"when,omitempty"`
}
type MatchClass struct {
// The conditions that must be true for the templates to render.
Match MatchEnum `json:"match"`
}
type IsNumber struct {
// Is the item variable a number?
IsNumber Locators `json:"isNumber"`
}
type IsEDTFDate struct {
// Does the date conform to EDTF?
IsEDTFDate Dates `json:"isEDTFDate"`
}
type IsRefType struct {
// Is the item reference type among the listed reference types?
IsRefType []ReferenceTypes `json:"isRefType"`
}
type HasVariable struct {
// Does the item reference include one of the listed variables?
HasVariable []Variables `json:"hasVariable"`
}
type DataMatch struct {
// Is the item variable a number?
IsNumber *Locators `json:"isNumber,omitempty"`
// Does the date conform to EDTF?
IsEDTFDate *Dates `json:"isEDTFDate,omitempty"`
// Is the item reference type among the listed reference types?
IsRefType []ReferenceTypes `json:"isRefType,omitempty"`
// Does the item reference include one of the listed variables?
HasVariable []Variables `json:"hasVariable,omitempty"`
// The item reference locale; to allow multilingual output.
Locale *string `json:"locale,omitempty"`
}
type Locale struct {
// The item reference locale; to allow multilingual output.
Locale string `json:"locale"`
}
type RenderListBlock struct {
ListStyle *string `json:"listStyle,omitempty"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template"`
}
type RenderSimple struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
Variable SimpleTypes `json:"variable"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// Non-localized plain text.
type RenderText struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
Text string `json:"text"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// Localized strings.
type RenderTerm struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
Format LocalizedTermFormat `json:"format"`
Term LocalizedTermName `json:"term"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// A template component for rendering dates.
type RenderDate struct {
Bold *bool `json:"bold,omitempty"`
Date Dates `json:"date"`
Emph *bool `json:"emph,omitempty"`
Format DateFormat `json:"format"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// A template component for rendering title.
type RenderTitle struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
Format *RenderTitleFormat `json:"format,omitempty"`
Title Titles `json:"title"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
// A template component for rendering contributors.
type RenderContributors struct {
Contributor ContributorRoles `json:"contributor"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template"`
}
// A template component for rendering locators.
type RenderLocators struct {
Locator Locators `json:"locator"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template"`
}
// The CSL NEXT style model.
//
// Option model for style configuration.
//
// A standlone template file.
//
// A CSL Style.
type Csl struct {
// The description of the style.
Description *string `json:"description,omitempty"`
Locale *Lang `json:"locale,omitempty"`
PunctuationInQuote *bool `json:"punctuationInQuote,omitempty"`
Terms *RecordLocalizedTermNameLocalizedTerm `json:"terms,omitempty"`
// The human-readable name of the style.
Title *string `json:"title,omitempty"`
Templates *NamedTemplate `json:"templates,omitempty"`
// The bibliography specification.
Bibliography *BibliographyStyle `json:"bibliography,omitempty"`
// The categories the style belongs to; for purposes of indexing.
Categories []StyleCategory `json:"categories,omitempty"`
// The citation specification.
Citation *CitationStyle `json:"citation,omitempty"`
// The machine-readable token that uniquely identifies the style.
ID *string `json:"id,omitempty"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
}
// The bibliography specification.
type BibliographyStyle struct {
Heading *string `json:"heading,omitempty"`
ListStyle *string `json:"listStyle,omitempty"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template"`
}
// The citation specification.
type CitationStyle struct {
// Integral citations are those where the author is printed inline in the text; aka "in
// text" or "narrative" citations.
Integral *RenderList `json:"integral,omitempty"`
// Non-integral citations are those where the author is incorporated in the citation, and
// not printed inline in the text.
NonIntegral *RenderList `json:"nonIntegral,omitempty"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Placement *Placement `json:"placement,omitempty"`
Template []TemplateComponent `json:"template"`
}
// Integral citations are those where the author is printed inline in the text; aka "in
// text" or "narrative" citations.
//
// Non-integral citations are those where the author is incorporated in the citation, and
// not printed inline in the text.
type RenderList struct {
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Template []TemplateComponent `json:"template"`
}
// A CSL Style.
type Style struct {
// The bibliography specification.
Bibliography *BibliographyStyle `json:"bibliography,omitempty"`
// The categories the style belongs to; for purposes of indexing.
Categories []StyleCategory `json:"categories,omitempty"`
// The citation specification.
Citation *CitationStyle `json:"citation,omitempty"`
// The description of the style.
Description *string `json:"description,omitempty"`
// The machine-readable token that uniquely identifies the style.
ID *string `json:"id,omitempty"`
// Parameter groups.
Options *OptionGroup `json:"options,omitempty"`
Templates NamedTemplate `json:"templates"`
// The human-readable name of the style.
Title *string `json:"title,omitempty"`
}
type StyleMetadata struct {
// The categories the style belongs to; for purposes of indexing.
Categories []StyleCategory `json:"categories,omitempty"`
// The description of the style.
Description *string `json:"description,omitempty"`
// The machine-readable token that uniquely identifies the style.
ID *string `json:"id,omitempty"`
// The human-readable name of the style.
Title *string `json:"title,omitempty"`
}
type HasFormatting struct {
Bold *bool `json:"bold,omitempty"`
Emph *bool `json:"emph,omitempty"`
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
Wrap *WrapPunctuation `json:"wrap,omitempty"`
}
type Lang string
const (
AFZA Lang = "af-ZA"
Ar Lang = "ar"
BgBG Lang = "bg-BG"
CAAD Lang = "ca-AD"
CSCZ Lang = "cs-CZ"
DaDK Lang = "da-DK"
DeAT Lang = "de-AT"
DeCH Lang = "de-CH"
DeDE Lang = "de-DE"
ElGR Lang = "el-GR"
EnGB Lang = "en-GB"
EnUS Lang = "en-US"
EsES Lang = "es-ES"
EtEE Lang = "et-EE"
Eu Lang = "eu"
FaIR Lang = "fa-IR"
FiFI Lang = "fi-FI"
FrCA Lang = "fr-CA"
FrFR Lang = "fr-FR"
HeIL Lang = "he-IL"
HrHR Lang = "hr-HR"
HuHU Lang = "hu-HU"
IsIS Lang = "is-IS"
ItIT Lang = "it-IT"
JaJP Lang = "ja-JP"
KMKH Lang = "km-KH"
KoKR Lang = "ko-KR"
LVLV Lang = "lv-LV"
LtLT Lang = "lt-LT"
MnMN Lang = "mn-MN"
NbNO Lang = "nb-NO"
NlNL Lang = "nl-NL"
PlPL Lang = "pl-PL"
PtBR Lang = "pt-BR"
PtPT Lang = "pt-PT"
RoRO Lang = "ro-RO"
RuRU Lang = "ru-RU"
SkSK Lang = "sk-SK"
SlSI Lang = "sl-SI"
SrRS Lang = "sr-RS"
SvSE Lang = "sv-SE"
ThTH Lang = "th-TH"
TrTR Lang = "tr-TR"
UkUA Lang = "uk-UA"
ViVN Lang = "vi-VN"
ZhCN Lang = "zh-CN"
ZhTW Lang = "zh-TW"
)
type LocalizedTermFormat string
const (
PurpleShort LocalizedTermFormat = "short"
PurpleSymbol LocalizedTermFormat = "symbol"
)
type LocalizedTermNameMisc string
const (
LocalizedTermNameMiscAccessed LocalizedTermNameMisc = "accessed"
LocalizedTermNameMiscAd LocalizedTermNameMisc = "ad"
LocalizedTermNameMiscAdvanceOnlinePublication LocalizedTermNameMisc = "advance-online-publication"
LocalizedTermNameMiscAlbum LocalizedTermNameMisc = "album"
LocalizedTermNameMiscAnd LocalizedTermNameMisc = "and"
LocalizedTermNameMiscAndOthers LocalizedTermNameMisc = "and-others"
LocalizedTermNameMiscAnonymous LocalizedTermNameMisc = "anonymous"
LocalizedTermNameMiscAt LocalizedTermNameMisc = "at"
LocalizedTermNameMiscAudioRecording LocalizedTermNameMisc = "audio-recording"
LocalizedTermNameMiscAvailableAt LocalizedTermNameMisc = "available-at"
LocalizedTermNameMiscBc LocalizedTermNameMisc = "bc"
LocalizedTermNameMiscBce LocalizedTermNameMisc = "bce"
LocalizedTermNameMiscBy LocalizedTermNameMisc = "by"
LocalizedTermNameMiscCe LocalizedTermNameMisc = "ce"
LocalizedTermNameMiscCirca LocalizedTermNameMisc = "circa"
LocalizedTermNameMiscCited LocalizedTermNameMisc = "cited"
LocalizedTermNameMiscEtAl LocalizedTermNameMisc = "et-al"
LocalizedTermNameMiscFilm LocalizedTermNameMisc = "film"
LocalizedTermNameMiscForthcoming LocalizedTermNameMisc = "forthcoming"
LocalizedTermNameMiscFrom LocalizedTermNameMisc = "from"
LocalizedTermNameMiscHenceforth LocalizedTermNameMisc = "henceforth"
LocalizedTermNameMiscIbid LocalizedTermNameMisc = "ibid"
LocalizedTermNameMiscIn LocalizedTermNameMisc = "in"
LocalizedTermNameMiscInPress LocalizedTermNameMisc = "in-press"
LocalizedTermNameMiscInternet LocalizedTermNameMisc = "internet"
LocalizedTermNameMiscInterview LocalizedTermNameMisc = "interview"
LocalizedTermNameMiscLOCCit LocalizedTermNameMisc = "loc-cit"
LocalizedTermNameMiscLetter LocalizedTermNameMisc = "letter"
LocalizedTermNameMiscNoDate LocalizedTermNameMisc = "no date"
LocalizedTermNameMiscNoPlace LocalizedTermNameMisc = "no-place"
LocalizedTermNameMiscNoPublisher LocalizedTermNameMisc = "no-publisher"
LocalizedTermNameMiscOn LocalizedTermNameMisc = "on"
LocalizedTermNameMiscOnline LocalizedTermNameMisc = "online"
LocalizedTermNameMiscOpCit LocalizedTermNameMisc = "op-cit"
LocalizedTermNameMiscOriginalWorkPublished LocalizedTermNameMisc = "original-work-published"
LocalizedTermNameMiscPersonalCommunication LocalizedTermNameMisc = "personal-communication"
LocalizedTermNameMiscPodcast LocalizedTermNameMisc = "podcast"
LocalizedTermNameMiscPodcastEpisode LocalizedTermNameMisc = "podcast-episode"
LocalizedTermNameMiscPreprint LocalizedTermNameMisc = "preprint"
LocalizedTermNameMiscPresentedAt LocalizedTermNameMisc = "presented-at"
LocalizedTermNameMiscRadioBroadcast LocalizedTermNameMisc = "radio-broadcast"
LocalizedTermNameMiscRadioSeries LocalizedTermNameMisc = "radio-series"
LocalizedTermNameMiscRadioSeriesEpisode LocalizedTermNameMisc = "radio-series-episode"
LocalizedTermNameMiscReference LocalizedTermNameMisc = "reference"
LocalizedTermNameMiscRetrieved LocalizedTermNameMisc = "retrieved"
LocalizedTermNameMiscReviewOf LocalizedTermNameMisc = "review-of"
LocalizedTermNameMiscScale LocalizedTermNameMisc = "scale"
LocalizedTermNameMiscSpecialIssue LocalizedTermNameMisc = "special-issue"
LocalizedTermNameMiscSpecialSection LocalizedTermNameMisc = "special-section"
LocalizedTermNameMiscTelevisionBroadcast LocalizedTermNameMisc = "television-broadcast"
LocalizedTermNameMiscTelevisionSeries LocalizedTermNameMisc = "television-series"
LocalizedTermNameMiscTelevisionSeriesEpisode LocalizedTermNameMisc = "television-series-episode"
LocalizedTermNameMiscVideo LocalizedTermNameMisc = "video"
LocalizedTermNameMiscWorkingPaper LocalizedTermNameMisc = "working-paper"
)
type LocalizedTermNameLocator string
const (
LocalizedTermNameLocatorAct LocalizedTermNameLocator = "act"
LocalizedTermNameLocatorAppendix LocalizedTermNameLocator = "appendix"
LocalizedTermNameLocatorArticleLocator LocalizedTermNameLocator = "article-locator"
LocalizedTermNameLocatorBook LocalizedTermNameLocator = "book"
LocalizedTermNameLocatorCanon LocalizedTermNameLocator = "canon"
LocalizedTermNameLocatorChapter LocalizedTermNameLocator = "chapter"
LocalizedTermNameLocatorColumn LocalizedTermNameLocator = "column"
LocalizedTermNameLocatorElocation LocalizedTermNameLocator = "elocation"
LocalizedTermNameLocatorEquation LocalizedTermNameLocator = "equation"
LocalizedTermNameLocatorFigure LocalizedTermNameLocator = "figure"
LocalizedTermNameLocatorFolio LocalizedTermNameLocator = "folio"
LocalizedTermNameLocatorLine LocalizedTermNameLocator = "line"
LocalizedTermNameLocatorNote LocalizedTermNameLocator = "note"
LocalizedTermNameLocatorOpus LocalizedTermNameLocator = "opus"
LocalizedTermNameLocatorParagraph LocalizedTermNameLocator = "paragraph"
LocalizedTermNameLocatorRule LocalizedTermNameLocator = "rule"
LocalizedTermNameLocatorScene LocalizedTermNameLocator = "scene"
LocalizedTermNameLocatorSubVerbo LocalizedTermNameLocator = "sub-verbo"
LocalizedTermNameLocatorTable LocalizedTermNameLocator = "table"
LocalizedTermNameLocatorTimestamp LocalizedTermNameLocator = "timestamp"
LocalizedTermNameLocatorTitleLocator LocalizedTermNameLocator = "title-locator"
LocalizedTermNameLocatorVerse LocalizedTermNameLocator = "verse"
)
type LocalizedTermNameLocatorNumber string
const (
LocalizedTermNameLocatorNumberIssue LocalizedTermNameLocatorNumber = "issue"
LocalizedTermNameLocatorNumberPage LocalizedTermNameLocatorNumber = "page"
LocalizedTermNameLocatorNumberPart LocalizedTermNameLocatorNumber = "part"
LocalizedTermNameLocatorNumberSection LocalizedTermNameLocatorNumber = "section"
LocalizedTermNameLocatorNumberSupplement LocalizedTermNameLocatorNumber = "supplement"
LocalizedTermNameLocatorNumberVersion LocalizedTermNameLocatorNumber = "version"
LocalizedTermNameLocatorNumberVolume LocalizedTermNameLocatorNumber = "volume"
)
type GroupSortKeys string
const (
AsCited GroupSortKeys = "as-cited"
GroupSortKeysAuthor GroupSortKeys = "author"
GroupSortKeysTitle GroupSortKeys = "title"
GroupSortKeysYear GroupSortKeys = "year"
)
// The order to sort the list.
type Order string
const (
Ascending Order = "ascending"
Descending Order = "descending"
)
// The delimiter between last and second-to-last item.
//
// The default "text" value produces:
//
// > Doe, Johnson and Smith
//
// The "symbol" value produces:
//
// > Doe, Johnson & Smith
type AndAsString string
const (
AndAsSymbol AndAsString = "symbol"
Text AndAsString = "text"
)
// Format a contributor name as sorted.
//
// Which of the contributor names in a list to apply the transformation.
type ContributorScope string
const (
DisplayAsSortAll ContributorScope = "all"
DisplayAsSortNone ContributorScope = "none"
First ContributorScope = "first"
)
// The display form of the role.
//
// ### `long`
//
// The full name of the role.
//
// > Jane Smith (editor)
//
// ### `short`
//
// > Jane Smith (ed.)
//
// ### `verb`
//
// > edited by Jane Smith
//
// ### `verb-short`
//
// > ed. Jane Smith
type Form string
const (
FormLong Form = "long"
FormShort Form = "short"
Verb Form = "verb"
VerbShort Form = "verb-short"
)
type ContributorRoles string
const (
ContributorRolesAuthor ContributorRoles = "author"
ContributorRolesEditor ContributorRoles = "editor"
ContributorRolesPublisher ContributorRoles = "publisher"
)
// The symbol pair to wrap around one or more rendering components.
// Interaction with surrounding punctuation is localized.
type WrapPunctuation string
const (
Brackets WrapPunctuation = "brackets"
Parentheses WrapPunctuation = "parentheses"
Quotes WrapPunctuation = "quotes"
)
// When shortening, replace omitted names with this term form.
//
// ### `short`
//
// > Doe, Johnson, et al.
//
// ### `long`
//
// > Doe, Johnson, and others
type AtAl string
const (
AtAlLong AtAl = "long"
AtAlShort AtAl = "short"
)
// Determines when the delimiter or a space is used between a truncated contributor list
// and the “et-al” (or “and others”) term in case of et-al abbreviation.
//
// Allowed values:
//
// ### `contextual`
//
// Delimiter is only used for contributor lists truncated to two or more items:
//
// - 1 name: “J. Doe et al.”
// - 2 names: “J. Doe, S. Smith, et al.”
//
// ### `after-inverted-name`
//
// Delimiter is only used if the preceding name is inverted as a result of the `asSort`
// parameter.
// E.g. with `asSort` set to “first”:
//
// - “Doe, J., et al.”
// - “Doe, J., S. Smith et al.”
//
// ### `always`
//
// Delimiter is always used:
//
// - 1 name: “J. Doe, et al.”
// - 2 names: “J. Doe, S. Smith, et al.”
//
// ### `never`
//
// Delimiter is never used:
// - 1 name: “J. Doe et al.”
// - 2 names: “J. Doe, S. Smith et al.”
//
// Determines when the delimiter is used to separate the second to last and the last
// item in contributor lists (if `and` is not set, the name delimiter is always used,
// regardless of the value of `delimiterPrecedesLast`). Allowed values:
//
// ### `contextual`
//
// The contributor delimiter is only used for lists of three or more:
//
// - 2 names: “J. Doe and T. Williams”
// - 3 names: “J. Doe, S. Smith, and T. Williams”
//
// ### `after-inverted-name`
//
// Delimiter is only used if the preceding name is inverted as a result of the
// `asSort` parameter. E.g. with `asSort` set to “first”:
//
// - “Doe, J., and T. Williams”
// - “Doe, J., S. Smith and T. Williams”
//
// ### `always`
//
// Delimiter is always used:
//
// - 2 names: “J. Doe, and T. Williams”
// - 3 names: “J. Doe, S. Smith, and T. Williams”
//
// ### `never`
//
// Delimiter is never used:
//
// - 2 names: “J. Doe and T. Williams”
// - 3 names: “J. Doe, S. Smith and T. Williams”
type DelimiterPrecedes string
const (
Always DelimiterPrecedes = "always"
Contextual DelimiterPrecedes = "contextual"
Never DelimiterPrecedes = "never"
)
type TimeStyle string
const (
DateFull TimeStyle = "full"
DateLong TimeStyle = "long"
DateShort TimeStyle = "short"
Medium TimeStyle = "medium"
)
type MonthStyle string
const (
Month2Digit MonthStyle = "2-digit"
MonthLong MonthStyle = "long"
MonthNumeric MonthStyle = "numeric"
MonthShort MonthStyle = "short"
Narrow MonthStyle = "narrow"
)
type YearStyle string
const (
Year2Digit YearStyle = "2-digit"
YearNumeric YearStyle = "numeric"
)
type AddNames string
const (
AddNamesAll AddNames = "all"
AllWithInitials AddNames = "all-with-initials"
ByCite AddNames = "by-cite"
Primary AddNames = "primary"
PrimaryWithInitials AddNames = "primary-with-initials"
)
// The scope to use for localization.
//
// "per-item" uses the locale of the reference item, and "global" uses the target language
// across all references.
type Scope string
const (
Global Scope = "global"
PerItem Scope = "per-item"
)
type Substitute string
const (
SubstituteEditor Substitute = "editor"
SubstituteTitle Substitute = "title"
Translator Substitute = "translator"
)
type DelimiterPunctuation string
const (
Colon DelimiterPunctuation = "colon"
Comma DelimiterPunctuation = "comma"
Period DelimiterPunctuation = "period"
Semicolon DelimiterPunctuation = "semicolon"
Space DelimiterPunctuation = "space"
)
// The conditions that must be true for the templates to render.
type MatchEnum string
const (
Any MatchEnum = "any"
MatchAll MatchEnum = "all"
MatchNone MatchEnum = "none"
)
type Variables string
const (
VariablesAccessed Variables = "accessed"
VariablesArticle Variables = "article"
VariablesAuthor Variables = "author"
VariablesBook Variables = "book"
VariablesChapter Variables = "chapter"
VariablesContainerTitle Variables = "container-title"
VariablesEditor Variables = "editor"
VariablesIssue Variables = "issue"
VariablesIssued Variables = "issued"
VariablesPages Variables = "pages"
VariablesPublisher Variables = "publisher"
VariablesTitle Variables = "title"
VariablesVolume Variables = "volume"
)
// Does the date conform to EDTF?
type Dates string
const (
DatesAccessed Dates = "accessed"
DatesIssued Dates = "issued"
)
// Is the item variable a number?
type Locators string
const (
LocatorsChapter Locators = "chapter"
LocatorsPage Locators = "page"
)
type ReferenceTypes string
const (
ReferenceTypesArticle ReferenceTypes = "article"
ReferenceTypesBook ReferenceTypes = "book"
ReferenceTypesChapter ReferenceTypes = "chapter"
)
type TemplateComponentFormat string
const (
FluffyShort TemplateComponentFormat = "short"
FluffySymbol TemplateComponentFormat = "symbol"
FormatMonthDay TemplateComponentFormat = "month-day"
FormatYear TemplateComponentFormat = "year"
FormatYearMonth TemplateComponentFormat = "year-month"
PurpleFull TemplateComponentFormat = "full"
PurpleMain TemplateComponentFormat = "main"
PurpleSub TemplateComponentFormat = "sub"
)
// The unique human-readable identifier for a term.
type LocalizedTermName string
const (
LocalizedTermNameAccessed LocalizedTermName = "accessed"
LocalizedTermNameAct LocalizedTermName = "act"
LocalizedTermNameAd LocalizedTermName = "ad"
LocalizedTermNameAdvanceOnlinePublication LocalizedTermName = "advance-online-publication"
LocalizedTermNameAlbum LocalizedTermName = "album"
LocalizedTermNameAnd LocalizedTermName = "and"
LocalizedTermNameAndOthers LocalizedTermName = "and-others"
LocalizedTermNameAnonymous LocalizedTermName = "anonymous"
LocalizedTermNameAppendix LocalizedTermName = "appendix"
LocalizedTermNameArticleLocator LocalizedTermName = "article-locator"
LocalizedTermNameAt LocalizedTermName = "at"
LocalizedTermNameAudioRecording LocalizedTermName = "audio-recording"
LocalizedTermNameAvailableAt LocalizedTermName = "available-at"
LocalizedTermNameBc LocalizedTermName = "bc"
LocalizedTermNameBce LocalizedTermName = "bce"
LocalizedTermNameBook LocalizedTermName = "book"
LocalizedTermNameBy LocalizedTermName = "by"
LocalizedTermNameCanon LocalizedTermName = "canon"
LocalizedTermNameCe LocalizedTermName = "ce"
LocalizedTermNameChapter LocalizedTermName = "chapter"
LocalizedTermNameCirca LocalizedTermName = "circa"
LocalizedTermNameCited LocalizedTermName = "cited"
LocalizedTermNameColumn LocalizedTermName = "column"
LocalizedTermNameElocation LocalizedTermName = "elocation"
LocalizedTermNameEquation LocalizedTermName = "equation"
LocalizedTermNameEtAl LocalizedTermName = "et-al"
LocalizedTermNameFigure LocalizedTermName = "figure"
LocalizedTermNameFilm LocalizedTermName = "film"
LocalizedTermNameFolio LocalizedTermName = "folio"
LocalizedTermNameForthcoming LocalizedTermName = "forthcoming"
LocalizedTermNameFrom LocalizedTermName = "from"
LocalizedTermNameHenceforth LocalizedTermName = "henceforth"
LocalizedTermNameIbid LocalizedTermName = "ibid"
LocalizedTermNameIn LocalizedTermName = "in"
LocalizedTermNameInPress LocalizedTermName = "in-press"
LocalizedTermNameInternet LocalizedTermName = "internet"
LocalizedTermNameInterview LocalizedTermName = "interview"
LocalizedTermNameIssue LocalizedTermName = "issue"
LocalizedTermNameLOCCit LocalizedTermName = "loc-cit"
LocalizedTermNameLetter LocalizedTermName = "letter"
LocalizedTermNameLine LocalizedTermName = "line"
LocalizedTermNameNoDate LocalizedTermName = "no date"
LocalizedTermNameNoPlace LocalizedTermName = "no-place"
LocalizedTermNameNoPublisher LocalizedTermName = "no-publisher"
LocalizedTermNameNote LocalizedTermName = "note"
LocalizedTermNameOn LocalizedTermName = "on"
LocalizedTermNameOnline LocalizedTermName = "online"
LocalizedTermNameOpCit LocalizedTermName = "op-cit"
LocalizedTermNameOpus LocalizedTermName = "opus"
LocalizedTermNameOriginalWorkPublished LocalizedTermName = "original-work-published"
LocalizedTermNamePage LocalizedTermName = "page"
LocalizedTermNameParagraph LocalizedTermName = "paragraph"
LocalizedTermNamePart LocalizedTermName = "part"
LocalizedTermNamePersonalCommunication LocalizedTermName = "personal-communication"
LocalizedTermNamePodcast LocalizedTermName = "podcast"
LocalizedTermNamePodcastEpisode LocalizedTermName = "podcast-episode"
LocalizedTermNamePreprint LocalizedTermName = "preprint"
LocalizedTermNamePresentedAt LocalizedTermName = "presented-at"
LocalizedTermNameRadioBroadcast LocalizedTermName = "radio-broadcast"
LocalizedTermNameRadioSeries LocalizedTermName = "radio-series"
LocalizedTermNameRadioSeriesEpisode LocalizedTermName = "radio-series-episode"
LocalizedTermNameReference LocalizedTermName = "reference"
LocalizedTermNameRetrieved LocalizedTermName = "retrieved"
LocalizedTermNameReviewOf LocalizedTermName = "review-of"
LocalizedTermNameRule LocalizedTermName = "rule"
LocalizedTermNameScale LocalizedTermName = "scale"
LocalizedTermNameScene LocalizedTermName = "scene"
LocalizedTermNameSection LocalizedTermName = "section"
LocalizedTermNameSpecialIssue LocalizedTermName = "special-issue"
LocalizedTermNameSpecialSection LocalizedTermName = "special-section"
LocalizedTermNameSubVerbo LocalizedTermName = "sub-verbo"
LocalizedTermNameSupplement LocalizedTermName = "supplement"
LocalizedTermNameTable LocalizedTermName = "table"
LocalizedTermNameTelevisionBroadcast LocalizedTermName = "television-broadcast"
LocalizedTermNameTelevisionSeries LocalizedTermName = "television-series"
LocalizedTermNameTelevisionSeriesEpisode LocalizedTermName = "television-series-episode"
LocalizedTermNameTimestamp LocalizedTermName = "timestamp"
LocalizedTermNameTitleLocator LocalizedTermName = "title-locator"
LocalizedTermNameVerse LocalizedTermName = "verse"
LocalizedTermNameVersion LocalizedTermName = "version"
LocalizedTermNameVideo LocalizedTermName = "video"
LocalizedTermNameVolume LocalizedTermName = "volume"
LocalizedTermNameWorkingPaper LocalizedTermName = "working-paper"
)
type Titles string
const (
TitlesContainerTitle Titles = "container-title"
TitlesTitle Titles = "title"
)
type SimpleTypes string
const (
SimpleTypesIssue SimpleTypes = "issue"
SimpleTypesPages SimpleTypes = "pages"
SimpleTypesVolume SimpleTypes = "volume"
)
type DateFormat string
const (
DateFormatFull DateFormat = "full"
DateFormatMonthDay DateFormat = "month-day"
DateFormatYear DateFormat = "year"
DateFormatYearMonth DateFormat = "year-month"
)
type RenderTitleFormat string
const (
FluffyFull RenderTitleFormat = "full"
FluffyMain RenderTitleFormat = "main"
FluffySub RenderTitleFormat = "sub"
TentacledShort RenderTitleFormat = "short"
)
type StyleCategory string
const (
Biology StyleCategory = "biology"
Science StyleCategory = "science"
SocialScience StyleCategory = "social science"
)
type Placement string
const (
Inline Placement = "inline"
PlacementNote Placement = "note"
)
type Match struct {
AnythingArray []interface{}
Bool *bool
Double *float64
Integer *int64
MatchClass *MatchClass
String *string
}
func (x *Match) UnmarshalJSON(data []byte) error {
x.AnythingArray = nil
x.MatchClass = nil
var c MatchClass
object, err := unmarshalUnion(data, &x.Integer, &x.Double, &x.Bool, &x.String, true, &x.AnythingArray, true, &c, false, nil, false, nil, true)
if err != nil {
return err
}
if object {
x.MatchClass = &c
}
return nil
}
func (x *Match) MarshalJSON() ([]byte, error) {
return marshalUnion(x.Integer, x.Double, x.Bool, x.String, x.AnythingArray != nil, x.AnythingArray, x.MatchClass != nil, x.MatchClass, false, nil, false, nil, true)
}
func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) {
if pi != nil {
*pi = nil
}
if pf != nil {
*pf = nil
}
if pb != nil {
*pb = nil
}
if ps != nil {
*ps = nil
}
dec := json.NewDecoder(bytes.NewReader(data))
dec.UseNumber()
tok, err := dec.Token()
if err != nil {
return false, err
}
switch v := tok.(type) {
case json.Number:
if pi != nil {
i, err := v.Int64()
if err == nil {
*pi = &i
return false, nil
}
}
if pf != nil {
f, err := v.Float64()
if err == nil {
*pf = &f
return false, nil
}
return false, errors.New("Unparsable number")
}
return false, errors.New("Union does not contain number")
case float64:
return false, errors.New("Decoder should not return float64")
case bool:
if pb != nil {
*pb = &v
return false, nil
}
return false, errors.New("Union does not contain bool")
case string:
if haveEnum {
return false, json.Unmarshal(data, pe)
}
if ps != nil {
*ps = &v
return false, nil
}
return false, errors.New("Union does not contain string")
case nil:
if nullable {
return false, nil
}
return false, errors.New("Union does not contain null")
case json.Delim:
if v == '{' {
if haveObject {
return true, json.Unmarshal(data, pc)
}
if haveMap {
return false, json.Unmarshal(data, pm)
}
return false, errors.New("Union does not contain object")
}
if v == '[' {
if haveArray {
return false, json.Unmarshal(data, pa)
}
return false, errors.New("Union does not contain array")
}
return false, errors.New("Cannot handle delimiter")
}
return false, errors.New("Cannot unmarshal union")
}
func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) {
if pi != nil {
return json.Marshal(*pi)
}
if pf != nil {
return json.Marshal(*pf)
}
if pb != nil {
return json.Marshal(*pb)
}
if ps != nil {
return json.Marshal(*ps)
}
if haveArray {
return json.Marshal(pa)
}
if haveObject {
return json.Marshal(pc)
}
if haveMap {
return json.Marshal(pm)
}
if haveEnum {
return json.Marshal(pe)
}
if nullable {
return json.Marshal(nil)
}
return nil, errors.New("Union must not be null")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment