diff --git a/_config.yml b/_config.yml index e49def7f..f4ff7281 100644 --- a/_config.yml +++ b/_config.yml @@ -1,5 +1,6 @@ title: Ladysnake's Website -source: "public" +source: ./public +plugins_dir: ./jekyll_plugins markdown: kramdown sass: style: compressed diff --git a/jekyll_plugins/TabbedBuildscriptTag.rb b/jekyll_plugins/TabbedBuildscriptTag.rb new file mode 100644 index 00000000..6b26d2aa --- /dev/null +++ b/jekyll_plugins/TabbedBuildscriptTag.rb @@ -0,0 +1,39 @@ +module Ladysnake + ## + # A tag that can generate HTML markup for a Gradle buildscript with each tab containing + # instructions for a specific format + # + # Usage: + # "{%- buildscript dependencies={key1: value1, key2: value2} -%} + # [build.gradle] + # Instructions for Groovy build.gradle + # + # [build.gradle.kts] + # Instructions for Kotlin build.gradle.kts + # + # [catalogue] + # Instructions for `libs.versions.toml` + # {%- endbuildscript -%}" + class TabbedBuildScriptTag < Liquid::Block + def initialize(tag_name, text, tokens) + super + @input = text + end + + def render(context) + body = super + mods = Hash[@input.scan(/\[(\w+):(\w+)\]/)] + tabs = Hash[TabbedTag.parse_tabs(body)] + + context["groovy"] = tabs["groovy"] + context["kts"] = tabs["kts"] + context["catalogue"] = tabs["catalogue"] + context["mods"] = mods + + include = "{% include tabbed_buildscript.liquid mods=mods groovy=groovy kts=kts catalogue=catalogue %}" + + Liquid::Template.parse(include).render(context) + end + end +end +Liquid::Template.register_tag('buildscript', Ladysnake::TabbedBuildScriptTag) diff --git a/jekyll_plugins/TabbedTag.rb b/jekyll_plugins/TabbedTag.rb new file mode 100644 index 00000000..561449c4 --- /dev/null +++ b/jekyll_plugins/TabbedTag.rb @@ -0,0 +1,42 @@ +module Ladysnake + ## + # A tag that can generate HTML markup for a section split in multiple toggleable tabs + # + # Usage: + # "{%- tabbed my_key -%} + # [- Tab 1 -] + # Tab 1 content + # + # [- Tab 2 -] + # Tab 2 content + # + # [- Tab 3 -] + # Tab 3 content + # {%- endtabbed %}" + class TabbedTag < Liquid::Block + ## + # Parses a markup string into pairs of [name, content] + # + # "[- Tab 1 -]\nContent" => [["Tab 1", "Content"], ...] + def self.parse_tabs(markup) + markup.scan(/^\[-\s*(.*?)\s*-\]\n(.*?)(?=\n\[-|\Z)/m) + end + + def initialize(tag_name, markup, options) + super + @input = markup + end + + def render(context) + body = super + tabs = TabbedTag.parse_tabs(body) + tab_names, tab_contents = tabs.transpose + context["key"] = @input + context["tab_names"] = tab_names + context["tab_contents"] = tab_contents + Liquid::Template.parse("{% include tabbed.liquid key=key tab_names=tab_names tabs=tab_contents %}").render(context) + end + end +end + +Liquid::Template.register_tag('tabbed', Ladysnake::TabbedTag) diff --git a/jekyll_plugins/TestTag.rb b/jekyll_plugins/TestTag.rb new file mode 100644 index 00000000..a307b270 --- /dev/null +++ b/jekyll_plugins/TestTag.rb @@ -0,0 +1,22 @@ +module Ladysnake + class TestTag < Liquid::Block + def render(context) + + puts @markup + puts "Hello" + puts super + + dependencies = Hash[@markup.scan(/\[(\w+):(\w+)\]/)] + puts dependencies + + # Extract the block content from the @markup variable + content = super + + # Do something with the parameters and content... + + # Return the rendered output + "Rendered output" + end + end +end +Liquid::Template.register_tag('test_tag', Ladysnake::TestTag) diff --git a/public/_includes/tabbed_builscript.liquid b/public/_includes/tabbed_buildscript.liquid similarity index 67% rename from public/_includes/tabbed_builscript.liquid rename to public/_includes/tabbed_buildscript.liquid index 7e2ef606..33574231 100644 --- a/public/_includes/tabbed_builscript.liquid +++ b/public/_includes/tabbed_buildscript.liquid @@ -1,3 +1,4 @@ +{%- comment -%}Prepare tab content{%- endcomment -%} {%- capture groovy_title %} {% include svg/groovy-logo.svg %} build.gradle {%- endcapture %} @@ -9,31 +10,18 @@ {% endcapture %} {%- assign tab_names = "" | split: "," | push: groovy_title | push: kts_title | push: catalogue_title %} {%- assign tabs = "" | split: "," | push: include.groovy | push: include.kts | push: include.catalogue %} -{%- if include.mods %} -{%- assign mods = include.mods %} -{%- else %} -{%- assign mod1 = include.mod1 | split: ":" %} -{%- assign mods = "" | split: "," | push: mod1 %} -{%- if include.mod2 %} -{%- assign mod2 = include.mod2 | split: ":" %} -{%- assign mods = mods | push: mod2 %} -{%- endif %} -{%- if include.mod3 %} -{%- assign mod3 = include.mod3 | split: ":" %} -{%- assign mods = mods | push: mod3 %} -{%- endif %} -{%- endif %} {%- capture result %} {%- include tabbed.liquid key="buildscript" tab_names=tab_names tabs=tabs %} {%- endcapture %} -{% for mod in mods %} +{%- comment -%}Render tabs and version selector{%- endcomment -%} +{% for mod in include.mods %} {%- capture result %} -{%- capture replacement_key %}<{% if mods.size > 1 %}{{ mod[0] | upcase }}_{% endif %}VERSION>{% endcapture %} +{%- capture replacement_key %}<{% if include.mods.size > 1 %}{{ mod[0] | upcase }}_{% endif %}VERSION>{% endcapture %} {%- capture replacement %}{{ replacement_key }}{% endcapture %} {{ result | replace: replacement_key, replacement }} {%- endcapture %} {% endfor %} -{% if mods.size > 0 and mods[0].size > 1 %} +{% if include.mods %} Select a Minecraft Version: Loading... diff --git a/public/_includes/wip.liquid b/public/_includes/wip.liquid index 605b0018..bd816cfa 100644 --- a/public/_includes/wip.liquid +++ b/public/_includes/wip.liquid @@ -4,7 +4,7 @@ {% if include.message %} - {{ include.message }} + {{ include.message | markdownify }} {% else %} Some things may not display correctly, and some information may be inaccurate or missing. Please come back later for the finished product :> diff --git a/public/tools/dependencies.md b/public/tools/dependencies.md index 081a40b7..6ed4a657 100644 --- a/public/tools/dependencies.md +++ b/public/tools/dependencies.md @@ -10,7 +10,7 @@ The version strings may be invalid maven identifiers, as they are currently pull - [Fabric dependency helper](https://fabricmc.net/develop/) - [Quilt dependency helper](https://lambdaurora.dev/tools/import_quilt.html) -{% capture kts %} +{% capture gradleproperties %} `gradle.properties`: ```properties # Blabber (dialogues) @@ -39,7 +39,28 @@ sodium_version = trinkets_version = ``` {% endcapture %} -{% capture catalogue %} + +{%- buildscript + [blabber:2oRMVFgd], + [cca:K01OU20C], + [cloth:9s6osm5g], + [emi:fRiHVvU7], + [geckolib:8BmcQJ2H], + [iris:YL57xq9U], + [midnight:codAaoxh], + [modmenu:mOgUt4GM], + [rei:nfn13YXA], + [satin:fRbqPLg4], + [sodium:AANobbMI], + [trinkets:5aaWibi9], +-%} +[- groovy -] +{{ gradleproperties }} + +[- kts -] +{{ gradleproperties }} + +[- catalogue -] `libs.versions.toml`: ```toml [versions] @@ -83,29 +104,5 @@ satin = { module = "org.ladysnake:satin", version.ref = "satin" } sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" } trinkets = { module = "dev.emi:trinkets", version.ref = "trinkets" } ``` -{% endcapture %} -{%- assign blabber = "blabber:2oRMVFgd" | split: ":" %} -{%- assign mods = "" | split: "," | push: blabber %} -{%- assign cca = "cca:K01OU20C" | split: ":" %} -{%- assign mods = mods | push: cca %} -{%- assign cloth = "cloth:9s6osm5g" | split: ":" %} -{%- assign mods = mods | push: cloth %} -{%- assign emi = "emi:fRiHVvU7" | split: ":" %} -{%- assign mods = mods | push: emi %} -{%- assign geckolib = "geckolib:8BmcQJ2H" | split: ":" %} -{%- assign mods = mods | push: geckolib %} -{%- assign iris = "iris:YL57xq9U" | split: ":" %} -{%- assign mods = mods | push: iris %} -{%- assign midnight = "midnight:codAaoxh" | split: ":" %} -{%- assign mods = mods | push: midnight %} -{%- assign modmenu = "modmenu:mOgUt4GM" | split: ":" %} -{%- assign mods = mods | push: modmenu %} -{%- assign rei = "rei:nfn13YXA" | split: ":" %} -{%- assign mods = mods | push: rei %} -{%- assign satin = "satin:fRbqPLg4" | split: ":" %} -{%- assign mods = mods | push: satin %} -{%- assign sodium = "sodium:AANobbMI" | split: ":" %} -{%- assign mods = mods | push: sodium %} -{%- assign trinkets = "trinkets:5aaWibi9" | split: ":" %} -{%- assign mods = mods | push: trinkets %} -{%- include tabbed_builscript.liquid mods=mods groovy=kts kts=kts catalogue=catalogue %} + +{% endbuildscript %} diff --git a/public/wiki/blabber/index.md b/public/wiki/blabber/index.md index f0688929..e09afdf1 100644 --- a/public/wiki/blabber/index.md +++ b/public/wiki/blabber/index.md @@ -296,7 +296,8 @@ If you are a developer, you can use Blabber as a library for your own project by You can then add the library version to your `gradle.properties`file: -{% capture groovy %} +{%- buildscript %} +[- groovy -] `gradle.properties`: ```properties # Blabber @@ -334,8 +335,8 @@ dependencies { include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cca_version}" } ``` -{% endcapture %} -{% capture kts %} + +[- kts -] `gradle.properties`: ```properties # Blabber @@ -376,8 +377,8 @@ dependencies { include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cca_version}") } ``` -{% endcapture %} -{% capture catalogue %} + +[- catalogue -] `libs.versions.toml`: ```toml [versions] @@ -420,8 +421,8 @@ dependencies { include(libs.bundles.blabber) } ``` -{% endcapture %} -{%- include tabbed_builscript.liquid mod1="blabber:2oRMVFgd" mod2="cca:K01OU20C" groovy=groovy kts=kts catalogue=catalogue %} + +{%- endbuildscript [blabber:2oRMVFgd], [cca:K01OU20C] -%} You can find the current version of Blabber in the [releases](https://github.com/Ladysnake/Blabber/releases) tab of the repository on Github, diff --git a/public/wiki/cardinal-components-api/dev-install.md b/public/wiki/cardinal-components-api/dev-install.md index 9c0b9b5e..a3a71a4e 100644 --- a/public/wiki/cardinal-components-api/dev-install.md +++ b/public/wiki/cardinal-components-api/dev-install.md @@ -11,7 +11,8 @@ mechanism provided by the Fabric toolchain to include Cardinal Components in you Unless specified otherwise, the following block must be added to your `build.gradle` **after** the relevant `repositories` block: -{% capture groovy %} +{% buildscript [cca:K01OU20C] %} +[- groovy -] `gradle.properties`: ```properties cca_version = @@ -26,8 +27,8 @@ dependencies { include "dev.onyxstudios.cardinal-components-api::${project.cca_version}" } ``` -{% endcapture %} -{% capture kts %} + +[- kts -] `gradle.properties`: ```properties cca_version = @@ -43,8 +44,8 @@ dependencies { include("dev.onyxstudios.cardinal-components-api::$ccaVersion") } ``` -{% endcapture %} -{% capture catalogue %} + +[- catalogue -] `libs.versions.toml`: ```toml [versions] @@ -67,9 +68,7 @@ dependencies { include(libs.bundles.cca) } ``` -{% endcapture %} -{%- include tabbed_builscript.liquid mod1="cca:K01OU20C" groovy=groovy kts=kts catalogue=catalogue %} - +{% endbuildscript %} ## Ladysnake Reposilite diff --git a/public/wiki/cardinal-components-api/registration.md b/public/wiki/cardinal-components-api/registration.md index e50ea536..370f87ce 100644 --- a/public/wiki/cardinal-components-api/registration.md +++ b/public/wiki/cardinal-components-api/registration.md @@ -18,7 +18,15 @@ To register a component, you must first **declare your component's identifier** *Note: It is safe to declare a component type that belongs to another mod. It is also safe to declare an id that may not be registered at runtime.* -{% capture quilt %} +{%- capture quilt_title %} +![Quilt Logo](/img/quilt_logo_transparent.png) On Quilt +{%- endcapture %} +{% capture fabric_title %} +![Fabric Logo](/img/fabric-logo.png) On Fabric +{% endcapture %} + +{% tabbed modloader %} +[- {{ quilt_title }} -] Declare your component's identifier in your `quilt.mod.json` at the top level. This is done by adding the identifier to an array of strings with the key `"cardinal-components"`. For more information on the structure of the `quilt.mod.json` file, refer to the [Quilt RFC](https://github.com/QuiltMC/rfcs/blob/master/specification/0002-quilt.mod.json.md#the-entrypoints-field). For example, if your mod uses a component with the id `"mymod:magik"`, your `quilt.mod.json` should contain the following custom field (in addition to everything else that is already there) : @@ -33,8 +41,8 @@ For example, if your mod uses a component with the id `"mymod:magik"`, your `qui ] } ``` -{%- endcapture %} -{%- capture fabric %} + +[- {{ fabric_title}} -] Declare your component's identifier in your `fabric.mod.json`'s `custom` properties. This is done by adding the identifier to an array of strings with the key `"cardinal-components"`. For more information on the structure of the `fabric.mod.json` file, refer to the [fabric wiki](https://fabricmc.net/wiki/documentation:fabric_mod_json_spec). For example, if your mod uses a component with the id `"mymod:magik"`, your `fabric.mod.json` should contain the following custom field (in addition to everything else that is already there) : @@ -50,17 +58,8 @@ For example, if your mod uses a component with the id `"mymod:magik"`, your `fab } } ``` -{%- endcapture %} -{%- capture quilt_title %} -![Quilt Logo](/img/quilt_logo_transparent.png) On Quilt -{%- endcapture %} -{% capture fabric_title %} -![Fabric Logo](/img/fabric-logo.png) On Fabric -{% endcapture %} -{%- assign tab_names = "" | split: "," | push: quilt_title | push: fabric_title %} -{%- assign tabs = "" | split: "," | push: quilt | push: fabric %} -{%- include tabbed.liquid key="modloader" tab_names=tab_names tabs=tabs %} +{% endtabbed %} ### ComponentKey @@ -105,7 +104,10 @@ Where `X` is one of the possible component providers (eg. [`EntityComponentIniti The component registrar should then be added as an entrypoint to your mod's metadata: -{% capture quilt %} +{% tabbed modloader %} + +[- {{ quilt_title }} -] + [Entrypoint documentation](https://github.com/QuiltMC/rfcs/blob/master/specification/0002-quilt.mod.json.md#the-entrypoints-field) ```json @@ -124,8 +126,9 @@ The component registrar should then be added as an entrypoint to your mod's meta ] } ``` -{%- endcapture %} -{%- capture fabric %} + +[- {{ fabric_title }} -] + [Entrypoint documentation](https://fabricmc.net/wiki/documentation:entrypoint) ```json @@ -146,17 +149,8 @@ The component registrar should then be added as an entrypoint to your mod's meta } } ``` -{%- endcapture %} -{%- capture quilt_title %} -![Quilt Logo](/img/quilt_logo_transparent.png) On Quilt -{%- endcapture %} -{% capture fabric_title %} -![Fabric Logo](/img/fabric-logo.png) On Fabric -{% endcapture %} -{%- assign tab_names = "" | split: "," | push: quilt_title | push: fabric_title %} -{%- assign tabs = "" | split: "," | push: quilt | push: fabric %} -{%- include tabbed.liquid key="modloader" tab_names=tab_names tabs=tabs %} +{%- endtabbed -%} --- @@ -189,4 +183,4 @@ public static void useMagik(Entity provider) { // anything will work, as long as } ``` -*Note: if you are using Loom 0.11+ and CCA 4.1+, you can see which objects implement `ComponentProvider`. Otherwise, you can assume objects implement it behind the scenes as long as you have a corresponding module (eg. if you have the `cardinal-components-world` module, any `World` object can be passed to `ComponentKey#get`)* \ No newline at end of file +*Note: if you are using Loom 0.11+ and CCA 4.1+, you can see which objects implement `ComponentProvider`. Otherwise, you can assume objects implement it behind the scenes as long as you have a corresponding module (eg. if you have the `cardinal-components-world` module, any `World` object can be passed to `ComponentKey#get`)* diff --git a/public/wiki/impersonate.md b/public/wiki/impersonate.md index 00724383..bfddd697 100644 --- a/public/wiki/impersonate.md +++ b/public/wiki/impersonate.md @@ -49,13 +49,15 @@ commands. If you are a developer, you can use Impersonate as a library for your own project by inserting the following in your `build.gradle` : +{%- buildscript [impersonate:xBZuWXoj], [cca:K01OU20C] -%} +[- groovy -] ```gradle repositories { maven { name = "Ladysnake Mods" - url = "https://ladysnake.jfrog.io/artifactory/mods" + url = "https://maven.ladysnake.org/releases" content { - includeGroup 'io.github.ladysnake' + includeGroupByRegex 'org\\.ladysnake.*' includeGroupByRegex 'io\\.github\\.onyxstudios.*' } } @@ -66,12 +68,12 @@ repositories { } dependencies { - modImplementation "io.github.ladysnake:Impersonate:${impersonate_version}" - include "io.github.ladysnake:Impersonate:${impersonate_version}" + modImplementation "org.ladysnake:impersonate:${impersonate_version}" + include "org.ladysnake:impersonate:${impersonate_version}" // Impersonate dependencies include "me.lucko:fabric-permissions-api:${fpa_version}" - include "com.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:${cca_version}" - include "com.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${cca_version}" + include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-base:${cca_version}" + include "io.github.onyxstudios.Cardinal-Components-API:cardinal-components-entity:${cca_version}" } ``` @@ -79,13 +81,21 @@ You can then add the library version to your `gradle.properties`file: ```properties # Impersonate -impersonate_version = 1.x.y +impersonate_version = # Fabric Permissions API -fpa_version = 0.1-SNAPSHOT +fpa_version = 0.2-SNAPSHOT # Cardinal Components -cca_version = 2.x.y +cca_version = ``` +[- kts -] +{% include wip.liquid message="*For now, take a look at the groovy build.gradle tab*" %} + +[- catalogue -] +{% include wip.liquid message="*For now, take a look at the groovy build.gradle tab*" %} + +{% endbuildscript %} + You can find the current version of Impersonate in the [releases](https://github.com/Ladysnake/Impersonate/releases) tab of the repository on Github, and the latest CCA version in the [appropriate repository](https://github.com/OnyxStudios/Cardinal-Components-API/releases). diff --git a/public/wiki/locki/index.md b/public/wiki/locki/index.md index 3cce1c5d..823ab62e 100644 --- a/public/wiki/locki/index.md +++ b/public/wiki/locki/index.md @@ -58,7 +58,8 @@ Simply prepend the desired node's full path with `locki.access.` before checking You can add the library by inserting the following in your `build.gradle` : -{% capture groovy %} +{% buildscript [locki:qS8U15sj], [cca:K01OU20C] %} +[- groovy -] `gradle.properties`: ```properties # Locki @@ -96,8 +97,8 @@ dependencies { include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cca_version}" } ``` -{% endcapture %} -{% capture kts %} + +[- kts -] `gradle.properties`: ```properties # Locki @@ -138,8 +139,8 @@ dependencies { include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${cca_version}") } ``` -{% endcapture %} -{% capture catalogue %} + +[- catalogue -] `libs.versions.toml`: ```toml [versions] @@ -182,8 +183,7 @@ dependencies { include(libs.bundles.locki) } ``` -{% endcapture %} -{%- include tabbed_builscript.liquid mod1="locki:qS8U15sj" mod2="cca:K01OU20C" groovy=groovy kts=kts catalogue=catalogue %} +{% endbuildscript %} ### Using Locki's API