<%*
// 1) Rename if the file starts with āNewContinentā let title; if (tp.file.title.startsWith(āNewContinentā)) { title = await tp.system.prompt(āEnter Continent Nameā); if (!title) { new Notice(āNo title entered. Aborting.ā); return; } await tp.file.rename(title); } else { title = tp.file.title; }
// 2) Gather all planet files under 2-World/Planets/ const planetFiles = tp.app.vault.getMarkdownFiles() .filter(f ā f.path.startsWith(ā2-World/Planets/ā));
const placeholderLabel = āš No Continent Selectedā; const placeholderPath = āplaceholderā;
// 3) Build options list with placeholder const planetChoices = [placeholderLabel, ā¦planetFiles.map(f ā f.basename)]; const planetValues = [placeholderPath, ā¦planetFiles.map(f ā f.path)];
// 4) Prompt user to select const chosenPath = await tp.system.suggester(planetChoices, planetValues, true); if (!chosenPath) return;
// 5) Build wiki-link or fallback let wikiLink = null; if (chosenPath !== placeholderPath) { const chosenAlias = chosenPath.split(ā/ā).pop().replace(/.md{chosenPath}|${chosenAlias}]]`; }
// 6) Write to frontmatter setTimeout(() ā { const newFile = tp.file.find_tfile(tp.file.path(true)); if (!newFile) { new Notice(āCould not find file after rename.ā); return; } app.fileManager.processFrontMatter(newFile, fm ā { fm[āMyContainerā] = wikiLink ?? āNoneā; }); }, 100);
%>
Parent Planet:
INPUT[suggester(optionQuery(#Category/Planet)):MyContainer]
Column
Map
Town Name
INPUT[select( option(1, ā¹ļøGeneral Info), option(2, šRegion Details), option(3, šGM Notes), class(tabbed) )]Tabbed
NOTE
INPUT[select( option(1, šŗļøRegions), option(2, āļøCapital Cities), class(tabbed) )]Tabbed
General Info
This is the continent description.
Region Details
Dominant Races:
Climate:
GM Notes
Make notes of what you need to track in the region here.
Regions
BUTTON[button_region] continent Places where people live - Cities, Towns, Villages, Hamlets, Encampment, Keeps, Fortresses, Strongholds.
properties:
file.name:
displayName: Region Name
views:
- type: cards
name: Region - Cards
filters:
and:
- file.folder == "2-World/Regions"
- list(MyContainer).contains(this)
order:
- file.name
image: note.image
- type: table
name: Region - Table
filters:
and:
- file.folder == "2-World/Regions"
- list(MyContainer).contains(this)
order:
- file.name
- MyContainer
sort:
- property: file.name
direction: ASC
columnSize:
file.name: 182
Capital Cities
BUTTON[button_group] Groups of people and power - religious, cults, guilds, military
formulas:
LinkedToThisContinent: |
list(MyContainer)
.map(link(value))
.filter(file(value))
.filter(
list(file(value).properties.MyContainer)
.map(link(value))
.contains(this)
)
.length > 0
RegionsForThis: |
list(MyContainer)
.map(link(value))
.filter(file(value))
.filter(
list(file(value).properties.MyContainer)
.map(link(value))
.contains(this)
)
.map(link(value, file(value).name))
properties:
file:
displayName: Hub
MyCategory:
displayName: Type
RegionsForThis:
displayName: Region(s)
views:
- type: cards
name: Capital Cities (Cards)
image: note.image
filters:
and:
- file.inFolder("2-World/Hubs")
- formula.LinkedToThisContinent
- or:
- MyCategory.contains("City +1500")
- list(MyCategory).contains("City +1500")
- type: table
name: Capital Cities (List)
filters:
and:
- file.inFolder("2-World/Hubs")
- formula.LinkedToThisContinent
- or:
- MyCategory.contains("City +1500")
- list(MyCategory).contains("City +1500")
order:
- file
- MyCategory
- RegionsForThis