gigaherz / Guidebook

Minecraft book API and library
https://www.curseforge.com/minecraft/mc-mods/guidebook
Other
31 stars 16 forks source link

If a template usage only has text, pretend the text is wrapped in a span #78

Closed pkmnfrk closed 6 years ago

pkmnfrk commented 6 years ago

Consider this template:

<template id="t">
    <p align="center" space="8">
        <element index="0" underline="true" />
    </p>
</template>

Clearly, I want to apply a bunch of formatting to something, probably a header or title.

Currently, you use this like so:

<t><span>Hello world!</span></t>

Ew, why do I have to put that extra span in?

With this patch, we can now do this instead:

<t>Hello World!</t>

Much nicer!

gigaherz commented 6 years ago

I wonder if this could be done a bit more generally: if a template has a (meaningful) text node in it, make that text into a span, even if there are more things in it. I will have to give it some thought. Looks good though so I'll be merging this as-is for now.