Skip to content

Commit

Permalink
Backport the hexdoc-hexcasting web book to 1.19 (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object authored Apr 6, 2024
2 parents 17afe2b + 2486d61 commit 4f1cfef
Show file tree
Hide file tree
Showing 75 changed files with 2,348 additions and 1,022 deletions.
73 changes: 52 additions & 21 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
name: Build the Python doc-gen
name: Build the web book

on:
push:
branches: [main]
branches: '1.19'
workflow_dispatch:
inputs:
release:
description: Release this version
type: boolean
default: false
publish:
description: Package index to publish to
type: choice
options:
- none
- PyPI

env:
PYPI_PACKAGE: hexdoc-hexcasting

permissions:
contents: read

jobs:
build_docs:
runs-on: ubuntu-latest
hexdoc:
uses: hexdoc-dev/hexdoc/.github/workflows/hexdoc.yml@main
permissions:
contents: write
pages: read
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
python-version: "3.11"
release: |-
${{
github.event_name != 'push' && inputs.release
|| github.event_name == 'push' && startsWith(github.event.head_commit.message, '[Release]')
}}
publish-pypi:
runs-on: ubuntu-latest
needs: hexdoc
if: |-
needs.hexdoc.outputs.release == 'true' &&
(github.event_name == 'push' || inputs.publish == 'PyPI')
environment:
name: pypi
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Generate file
run: doc/collate_data.py Common/src/main/resources hexcasting thehexbook doc/template.html index.html.uncommitted
- name: Check out gh-pages
uses: actions/checkout@v3
with:
clean: false
ref: gh-pages
- name: Overwrite file and commmit
run: |
mv index.html.uncommitted index.html
git config user.name "Documentation Generation Bot"
git config user.email "[email protected]"
git add index.html
git diff-index --quiet HEAD || git commit -m "Update docs at index.html from $GITHUB_REF"
- name: Upload changes
run: git push
- name: Download package artifact
uses: actions/download-artifact@v3
with:
name: hexdoc-build
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
166 changes: 166 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# hexdoc
doc/**/_export/generated/
/_site/
/_checkout/
__gradle_version__.py
.hexdoc/

# eclipse
bin
*.launch
Expand All @@ -21,9 +28,168 @@ build
eclipse
run

# MacOS moment
.DS_Store

# Files from Forge MDK
forge*changelog.txt

Session.vim
plot/


# Python

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
8 changes: 4 additions & 4 deletions Common/src/main/resources/assets/hexcasting/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
"hexcasting.page.101.4.header": "An Example",
"hexcasting.page.101.4": "It's interesting to note that the $(italic)rotation/$ of a pattern doesn't seem to matter at all. These two patterns both perform an action called $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$, for example.",
"hexcasting.page.101.5": "A _Hex is cast by drawing (valid) actions in sequence. Each action might do one of a few things:$(li)Gather some information about the environment, leaving it on the top of the stack;$(li)manipulate the info gathered (e.g. adding two numbers); or$(li)perform some magical effect, like summoning lightning or an explosion. (These actions are called \"spells.\")$(p)When I start casting a _Hex, it creates an empty stack. Actions manipulate the top of that stack.",
"hexcasting.page.101.6": "For example, $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$ will create an iota representing $(italic)me/$, the caster, and add it to the top of the stack. $(l:patterns/basics#hexcasting:get_entity_pos)$(action)Compass Purification/$ will take the iota at the top the stack, if it represents an entity, and transform it into an iota representing that entity's location.$(br2)So, drawing those patterns in that order would result in an iota on the stack representing my position.",
"hexcasting.page.101.6": "For example, $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$ will create an iota representing $(italic)me/$, the caster, and add it to the top of the stack. $(l:patterns/basics#hexcasting:entity_pos/eye)$(action)Compass Purification/$ will take the iota at the top the stack, if it represents an entity, and transform it into an iota representing that entity's location.$(br2)So, drawing those patterns in that order would result in an iota on the stack representing my position.",
"hexcasting.page.101.7": "$(thing)Iotas/$ can represent things like myself or my position, but there are several other types I can manipulate with $(thing)Actions/$. Here's a comprehensive list:$(li)Numbers (which some legends called \"doubles\");$(li)Vectors, a collection of three numbers representing a position, movement, or direction in the world;$(li)Booleans or \"bools\" for short, representing an abstract True or False,",
"hexcasting.page.101.8": "$(li)Entities, like myself, chickens, and minecarts;$(li)Influences, peculiar types of iota that seem to represent abstract ideas;$(li)Patterns themselves, used for crafting magic items and truly mind-boggling feats like $(italic)spells that cast other spells/$; and$(li)A list of several of the above, gathered into a single iota.",
"hexcasting.page.101.9": "Of course, there's no such thing as a free lunch. All spells, and certain other actions, require _media as payment.$(br2)The best I can figure, a _Hex is a little bit like a plan of action presented to Nature-- in this analogy, the _media is used to provide the arguments to back it up, so Nature will accept your plan and carry it out.",
Expand Down Expand Up @@ -864,7 +864,7 @@
"hexcasting.page.basics_pattern.get_entity_look": "Transforms an entity on the stack into the direction it's looking in, as a unit vector.",
"hexcasting.page.basics_pattern.print": "Displays the top iota of the stack to me.",
"hexcasting.page.basics_pattern.raycast.1": "Combines two vectors (a position and a direction) into the answer to the question: If I stood at the position and looked in the direction, what block would I be looking at? Costs a negligible amount of _media.",
"hexcasting.page.basics_pattern.raycast.2": "If it doesn't hit anything, the vectors will combine into $(l:casting/influences)$(thing)Null/$.$(br2)A common sequence of patterns, the so-called \"raycast mantra,\" is $(action)Mind's Reflection/$, $(action)Compass Purification/$, $(action)Mind's Reflection/$, $(action)Alidade Purification/$, $(action)Archer's Distillation/$. Together, they return the vector position of the block I am looking at.",
"hexcasting.page.basics_pattern.raycast.2": "If it doesn't hit anything, the vectors will combine into $(l:casting/influences)$(thing)Null/$.$(br2)A common sequence of patterns, the so-called \"raycast mantra,\" is $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$, $(l:patterns/basics#hexcasting:entity_pos/eye)$(action)Compass Purification/$, $(l:patterns/basics#hexcasting:get_caster)$(action)Mind's Reflection/$, $(l:patterns/basics#hexcasting:get_entity_look)$(action)Alidade Purification/$, $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$. Together, they return the vector position of the block I am looking at.",
"hexcasting.page.basics_pattern.raycast/axis.1": "Like $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$, but instead returns a vector representing the answer to the question: Which $(italic)side/$ of the block am I looking at? Costs a negligible amount of _media.",
"hexcasting.page.basics_pattern.raycast/axis.2": "More specifically, it returns the $(italic)normal vector/$ of the face hit, or a unit vector pointing perpendicular to the face.$(li)If I am looking at a floor, it will return (0, 1, 0).$(li)If I am looking at the south face of a block, it will return (0, 0, 1).",
"hexcasting.page.basics_pattern.raycast/entity": "Like $(l:patterns/basics#hexcasting:raycast)$(action)Archer's Distillation/$, but instead returns the $(italic)entity/$ I am looking at. Costs a negligible amount of _media.",
Expand Down Expand Up @@ -951,15 +951,15 @@
"hexcasting.page.stackmanip.stack_len": "Pushes the size of the stack as a number to the top of the stack. (For example, a stack of [0, 1] will become [0, 1, 2].)",
"hexcasting.page.stackmanip.duplicate_n": "Removes the number at the top of the stack, then copies the top iota of the stack that number of times. (A count of 2 results in two of the iota on the stack, not three.)",
"hexcasting.page.stackmanip.fisherman": "Grabs the element in the stack indexed by the number and brings it to the top.",
"hexcasting.page.stackmanip.fisherman/copy": "Like $(action)Fisherman's Gambit/$, but instead of moving the iota, copies it.",
"hexcasting.page.stackmanip.fisherman/copy": "Like $(l:patterns/stackmanip#hexcasting:fisherman)$(action)Fisherman's Gambit/$, but instead of moving the iota, copies it.",
"hexcasting.page.stackmanip.mask.1": "An infinite family of actions that keep or remove elements at the top of the stack based on the sequence of dips and lines.",
"hexcasting.page.stackmanip.mask.2": "Assuming that I draw a Bookkeeper's Gambit pattern left-to-right, the number of iotas the action will require is determined by the horizontal distance covered by the pattern. From deepest in the stack to shallowest, a flat line will keep the iota, whereas a triangle dipping down will remove it.$(br2)If my stack contains $(italic)0, 1, 2/$ from deepest to shallowest, drawing the first pattern opposite will give me $(italic)1/$, the second will give me $(italic)0/$, and the third will give me $(italic)0, 2/$ (the 0 at the bottom is left untouched).",
"hexcasting.page.stackmanip.swizzle.1": "Rearranges the top elements of the stack based on the given numerical code, which is the index of the permutation wanted.",
"hexcasting.page.stackmanip.swizzle.2": "Although I can't pretend to know the mathematics behind calculating this permutation code, I have managed to dig up an extensive chart of them, enumerating all permutations of up to six elements.$(br2)If I wish to do further study, the key word is \"Lehmer Code.\"",
"hexcasting.page.stackmanip.swizzle.link": "Table of Codes",

"hexcasting.entry.logic": "Logical Operators",
"hexcasting.page.logic.bool_coerce": "Convert an argument to a boolean. The number $(thing)0/$, $(l:influences#null)$(thing)Null/$, and the empty list become False; everything else becomes True.",
"hexcasting.page.logic.bool_coerce": "Convert an argument to a boolean. The number $(thing)0/$, $(l:casting/influences)$(thing)Null/$, and the empty list become False; everything else becomes True.",
"hexcasting.page.logic.not": "If the argument is True, return False; if it is False, return True.",
"hexcasting.page.logic.or": "Returns True if at least one of the arguments are True; otherwise returns False.",
"hexcasting.page.logic.and": "Returns True if both arguments are true; otherwise returns False.",
Expand Down
Loading

0 comments on commit 4f1cfef

Please sign in to comment.