
In my custom character sheet, I've been using Jakob's Better Default Template. I want to add one pre-defined property, similar to Title, Subtitle, and Desc(ription). (Actually, just like 'desc' but have one left-justified and one centered.) According to the wiki, all I need to do is add a div with {{myproperty}} in double curly brackets, and to have it only show up when myproperty is not empty, I should wrap that div in {{#myproperty}} and {{/myproperty}}. I want it to display in one continuous block like the 'desc' property, so I basically copied the 'desc' CSS styling and just changed the name and text-align. After doing that (and a dozen iterations of that) I end up with two copies of 'myproperty' being displayed in the template. It DOES notice that myproperty is not empty, it does seem to recognize that myproperty is not just some random word but is a purposefully defined property and therefore displays it the way I wanted it formatted (one block and centered), BUT it also shows a duplicate of myproperty further up as if it is a random pair of 'key=value'. I've tried this with any number of other property names, I've tried moving the myproperty div into different parts of the template, etc, and I always get the weird duplicate entry. Any suggestions? My end goal is just to have one 'desc' that is left justified and one that is centered, and to be able to show them both simultaneously in one template. I thought the easiest way to do that would be to just copy 'desc' and give it a new name and new CSS. I was planning to change those property names to 'descleft' and 'desccenter' once I got this working. <rolltemplate class="sheet-rolltemplate-custom">
<div class="sheet-container sheet-color-{{color}}">
<div class="sheet-header">
{{#title}}
<div class="sheet-title">{{title}}</div>
{{/title}}
{{#subtitle}}
<div class="sheet-subtitle">{{subtitle}}</div>
{{/subtitle}}
</div>
<div class="sheet-content">
{{#allprops() title subtitle desc color}}
<div class="sheet-key">{{key}}</div>
<div class="sheet-value">{{value}}</div>
{{/allprops() title subtitle desc color}}
{{#desc}}
<div class="sheet-desc">{{desc}}</div>
{{/desc}}
{{#myproperty}}
<div class="sheet-myprop">{{myproperty}}</div>
{{/myproperty}}
</div>
</div>
</rolltemplate>
<button type="roll" name="roll_testroll" value="&{template:custom}{{title=this is the title}}{{subtitle=this is the subtitle}}{{random=random key, value}}{{this is unlabled}}{{desc=this is the description, aligned left}}{{myproperty=This is my property, centered}}">Click Me</button>
<div style="width:400px;">
I can't figure out why when I add my own property to the rolltemplate, apparently following the directions in the wiki,
the new property shows up twice... once as a 'key = value' (which is what should not be happening) and once as it
should appear (all in one block, centered). I would expect it to behave exactly like the property 'desc', so I am not
at all understanding why it is duplicating it as if it were a totally random 'key = value'
</div> /* Jakob's Rolltemplate */
/* Smaller margins - remove these if you want the huge default left margin */
.sheet-rolltemplate-custom {
margin-left: -37px;
}
.withoutavatars .sheet-rolltemplate-custom {
margin-left: -7px;
}
.sheet-rolltemplate-custom .sheet-container {
border: 1px solid;
/* by default, the border is the same color as the header. You can change this here, e.g. to black */
border-color: var(--header-bg-color);
}
/* Header formatting - title and subtitle */
.sheet-rolltemplate-custom .sheet-header {
background-color: var(--header-bg-color);
/* change text-align to center to center the header text */
text-align: left;
color: var(--header-text-color);
padding: 5px;
}
.sheet-rolltemplate-custom .sheet-title {
font-size:1.1em;
}
.sheet-rolltemplate-custom .sheet-subtitle {
font-size:.9em;
}
/* example colors */
.sheet-rolltemplate-custom .sheet-container {
/* this is the default color */
--header-bg-color: rgba(112,32,130,1);
--header-text-color: #FFF;
}
.sheet-rolltemplate-custom .sheet-container.sheet-color-red {
--header-bg-color: #F00;
}
.sheet-rolltemplate-custom .sheet-container.sheet-color-green {
--header-bg-color: #0F0;
--header-text-color: #000;
}
/* Allprops part */
.sheet-rolltemplate-custom .sheet-content {
display: grid;
background: #FFF;
/* Header formatting - modify the column layout below */
grid-template-columns: auto auto;
/* Line height to match default roll template */
line-height:1.4em;
}
.sheet-rolltemplate-custom .sheet-content > div {
padding: 5px;
}
/* Left column */
.sheet-rolltemplate-custom .sheet-content .sheet-key {
font-weight: bold;
padding-right: 10px;
text-align: right;
}
/* Empty rule, use this if you want to change the right column
.sheet-rolltemplate-custom .sheet-value {
}
*/
/* Make even-numbered rows grey */
.sheet-rolltemplate-custom .sheet-content :nth-child(4n+3),
.sheet-rolltemplate-custom .sheet-content :nth-child(4n) {
background:#EEE;
}
/* Description field */
.sheet-rolltemplate-custom .sheet-desc {
grid-column: span 2;
padding: 5px;
text-align: left;
}
/* This is my own field which is acting quite strangely, duplicating itself as a random key=value*/
.sheet-rolltemplate-custom .sheet-myprop {
grid-column: span 2;
padding: 5px;
text-align: center;
}
/* END JAKOB'S ROLLTEMPLATE */