Work In Progress

This template is not properly implemented yet.

<%*

// 1) Rename if title starts with ā€œNewDistrictā€ let title; if (tp.file.title.startsWith(ā€œNewDistrictā€)) { title = await tp.system.prompt(ā€œEnter Hub Districtā€); if (!title) { new Notice(ā€œNo name entered. Aborting.ā€); return; } await tp.file.rename(title); } else { title = tp.file.title; }

// 2) Gather all region files under 2-World/Regions const regionFiles = tp.app.vault.getMarkdownFiles() .filter(f ⇒ f.path.startsWith(ā€œ2-World/Districts/ā€));

const placeholderLabel = ā€šŸŒ€ No District Selectedā€; const placeholderPath = ā€œplaceholderā€;

// 3) Suggester for picking region (with placeholder) const regionChoices = [placeholderLabel, …regionFiles.map(f ⇒ f.basename)]; const regionValues = [placeholderPath, …regionFiles.map(f ⇒ f.path)]; const chosenPath = await tp.system.suggester(regionChoices, regionValues, true); if (!chosenPath) return;

// 4) Build the wiki-link or fallback let wikiLink = null; if (chosenPath !== placeholderPath) { const chosenAlias = chosenPath.split(ā€/ā€œ).pop().replace(/.md{chosenPath}|${chosenAlias}]]`; }

// 5) Prompt for Hub type (MyCategory) const categoryOptions = [ ā€œGeneric Districtā€, ā€œGovernment & Nobilityā€, ā€œCommerce & Craftā€, ā€œResidentialā€, ā€œFaith & Knowledgeā€, ā€œMilitary & Orderā€, ā€œHidden & Fringeā€ ]; const chosenCat = await tp.system.suggester(categoryOptions, categoryOptions, true); if (!chosenCat) return;

// 6) Write both properties into frontmatter setTimeout(() ⇒ { const newFile = tp.file.find_tfile(tp.file.path(true)); if (!newFile) return; app.fileManager.processFrontMatter(newFile, fm ⇒ { fm[ā€œMyContainerā€] = wikiLink ?? ā€œNoneā€; fm[ā€œMyCategoryā€] = chosenCat; }); }, 100);

%>

Parent Hub: INPUT[inlineListSuggester(optionQuery(#Category/Hub)):MyContainer]

Column

Map

id: DistrictExample ### Must be unique with no spaces  
image: [[Map_District_Placeholder.png]] ### Link to the map image file. Do not add a ! in front of the image  
bounds: [[0,0], [846, 846]] ### Size of the map in px Height_y, Width_x. Ignore 0,0  
height: 500px ### Size of the leaflet embed in px on your screen  
width: 95% ### Size of the leaflet embed in your note  
lat: 423 ### To center the map, make this half of the map height.  
long: 423 ### To center the map, make this half of the map width.  
minZoom: -3 ### Controls how far away from the map you can zoom out. Hover over the target icon to see the current level.  
maxZoom: 1 ### Controls how far towards the map you can zoom in. Hover over the target icon to see the current level.  
defaultZoom: -0.5 ### Sets the default zoom level when the map loads. Hover over the target icon to see the current level.  
zoomDelta: 0.5 ### Adjust how much the zoom changes when you zoom in or out.  
unit: mi ### The value displayed when measuring so you know what type of unit is being measure.  
scale: 0.09328358208955223 ### Real units/px (resolution) of your map  
recenter: false  
darkmode: false ### marker

Town Name

INPUT[select(
option(1, ā„¹ļøGeneral),
option(2, šŸƒā€ā™‚ļøā€āž”ļøNPCs),
option(3, šŸ“GM Notes),
class(tabbed)
)]

Tabbed

NOTE

INPUT[select(
option(1, šŸ›’Commerce),
option(2, šŸŽAgriculture),
option(3, āš”ļøMilitary),
option(4, šŸ’­Philosophy),
option(5, āš™ļøIndustrial),
option(6, šŸ Nesting),
option(7, šŸ‘‘Government),
class(tabbed)
)]

Tabbed


General

Select Hub: INPUT[inlineListSuggester(optionQuery(#Category/Hub)):MyContainer]

Select Category: INPUT[template-district-category][:MyCategory]

This is the district description.

NPCs

BUTTON[button_person] List important NPCs here.

filters:
  and:
    - file.inFolder("2-World/People")
formulas:
  LinkedViaPlace: |
    list(MyContainer)                                          
      .filter( file(value)                                     
               && list(file(value).properties.MyContainer)     
                    .contains(this) )                          
      .length > 0
  PlacesForThis: |
    list(MyContainer)
      .filter( file(value)
               && list(file(value).properties.MyContainer).contains(this) )
      .map( link(value, file(value).name) )
properties:
  file.name:
    displayName: Person
  PlacesForThis:
    displayName: Places (for this note)
  note.char_race:
    displayName: Race
  note.char_gender:
    displayName: Gender
  note.char_age:
    displayName: Age
views:
  - type: cards
    name: People linked via Places → this note
    filters:
      or:
        - formula.LinkedViaPlace
        - list(MyContainer).contains(this)
    order:
      - file.name
      - char_age
      - char_gender
      - char_race
    image: note.image
    cardSize: 100
  - type: table
    name: View
 

GM Notes

Make notes of what you need to track in the town here.

CAMPING

C - Commerce (Economics and Entertainment) - Shops, Malls, Theatres, Markets, Carnivals, Electronics A - Agriculture (Resource Production and Collection) - Farms, Mines, Fisheries, Lumber Yards, Oil Rigs, Power Plants M - Military (Protection and Transportation) - Forts, Bases, Armories, Walls, Seaports, Airports, Spaceports P - Philosophy (Religion and Education) - Houses of Worship, Schools, Universities, Laboratories, Arboretums I - Industrial (Resource Utilization and Processing) - Factories, Metalworks, Bakeries, Artisans, Jewelers N - Nesting (Housing and Civil Engineering) - Residential Areas, Inns/Hotels G - Government (Legislation and Judicial) - Town Halls, Courthouses, Tourist Stops, Monuments/Landmarks

Commerce

BUTTON[button_place] BUTTON[button_person] C - Commerce (Economics and Entertainment) - Shops, Malls, Theatres, Markets, Carnivals, Electronics

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Commerce"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Commerce"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Agriculture

BUTTON[button_place] BUTTON[button_person] A - Agriculture (Resource Production and Collection) - Farms, Mines, Fisheries, Lumber Yards, Oil Rigs, Power Plants

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Agriculture"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Agriculture"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Military

BUTTON[button_place] BUTTON[button_person] M - Military (Protection and Transportation) - Forts, Bases, Armories, Walls, Seaports, Airports, Spaceports

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Military"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Military"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Philosophy

BUTTON[button_place] BUTTON[button_person] P - Philosophy (Religion and Education) - Houses of Worship, Schools, Universities, Laboratories, Arboretums

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Philosophy"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Philosophy"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Industrial

BUTTON[button_place] BUTTON[button_person] I - Industrial (Resource Utilization and Processing) - Factories, Metalworks, Bakeries, Artisans, Jewelers

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Industrial"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Industrial"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Nesting

BUTTON[button_place] BUTTON[button_person] N - Nesting (Housing and Civil Engineering) - Residential Areas, Bridges, Parks, Inns/Hotels

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Nesting"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Nesting"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182
 

Government

BUTTON[button_place] BUTTON[button_person] G - Government (Legislation and Judicial) - Town Halls, Courthouses, Tourist Stops, Monuments/Landmarks

properties:
  file.name:
    displayName: Places Name
  note.MyCategory:
    displayName: Type of Place
views:
  - type: cards
    name: Region - Cards
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Government"
    order:
      - file.name
      - MyCategory
    image: note.image
  - type: table
    name: Region - Table
    filters:
      and:
        - file.folder == "2-World/Places"
        - list(MyContainer).contains(this)
        - MyCategory == "Government"
    order:
      - file.name
      - MyContainer
    sort:
      - property: file.name
        direction: ASC
    columnSize:
      file.name: 182