1.8 KiB
<%* const thisFile = tp.config.target_file; const campaignData = tp.user.ttrpg.campaignData(thisFile) const settingData = tp.user.ttrpg.settingData(thisFile); const title = tp.file.title === "Untitled" ? await tp.system.prompt("Region Name") : tp.file.title; const adjective = tp.frontmatter?.adjective ?? ""; const types = [ "nation", "duchy", "county", "state", "star system", "planet", "sector", "continent", ]; const govTypes = [ "anarchy", "athenian democracy", "caste", "city-states", "clan/tribal", "corporate state", "dictatorship", "feudal", "hive mind", "representative democracy", "technocracy", "theocracy", "bureaucracy", "charismatic rule", "cybercracy/machine civilization", "meritocracy", "military government", "oligarchy", "thaumatocracy", ]; const type = tp.frontmatter.regionType ?? await tp.system.suggester(v => v, types, true, "Type of Region"); const metadata = { tags: ['ttrpg/place/region'], data: { icon: "map", title, pronunciation: tp.frontmatter.pronunciation ?? "", summary: tp.frontmatter?.summary ?? "", campaigns: [campaignData.link], setting: settingData.link, regionType: type, capital: tp.frontmatter?.capital ?? "", location: tp.frontmatter?.location ?? "", population: tp.frontmatter?.population ?? 0, government: tp.frontmatter?.government ?? (await tp.system.suggester(v => v, govTypes, false, "Type of Government")) ?? "", leader: tp.frontmatter?.leader ?? "", adjective: tp.frontmatter?.adjective ?? "", }, title, }; await tp.user.util.updateMetadata(tp, metadata); %>
<% tp.file.cursor() %>