A small lightweight language that combines Python and HTML.
Project description
A small lightweight language that combines Python and HTML. Recommended file extension: .γ/.gmaj
Example syntax:
export <void> <!DOCTYPE html> </void> # recommended to use at the top of your file
# comment
x: int = 123; # variable
# semicolon is optional
def xyz() -> None { # opening brace
... # ellipsis (ignores the line)
} # closing brace
def main() -> None {
# to insert html, use the 'export html' statement along with a 'end html' as shown below
export <void>
<!-- html code here -->
<h1>
Hello, world!
</h1> <!-- this will open your browser to a random unused port with a 'Hello, world' heading -->
</void>
# after the closing 'html' tag, you can continue with python code
# to export for ex. a python variable, which is not possible with 'export gamma',
# you can use plain 'export' instead:
name: str = "Bob"
export print("Unformatted", "text") # creates plain text
export paragraph("Hello,", name) # creates a paragraph with text: 'Hello, Bob'
export heading1("Heading 1") # \
export heading2("Heading 2") # |
export heading3("Heading 3") # > headings
export heading4("Heading 4") # |
export heading1("Heading 1") # /
export weblink("https://google.com", "Google") # creates a hyperlink. param 1 is href
export image("cat.png", "A picture of a munchkin cat") # creates an image. param 1 is src, param 2 is alt
export list("item 1", "item 2", "item3") # creates an unordered list. cannot be created with brackets [] (e.g. export ["1", "2"]) like non-exported lists
export table("item 1", "item 2", "item") # creates a table
if __name__ == '__main__' { # runs only when the file is executed directly
main() # executes the main function
}
DISCLAIMER: The
DISCLAIMER: You cannot import GammaJ files in Python files or from other GammaJ files. You can import Python from GammaJ files though.
Running a GammaJ file
Method 1: Use cmdlet (recommended)
gammaj <filename>
Method 2: Run using python module
python -m gammaj <filename>
How to get Syntax Highlighting (new in v4)
- Disclaimer: Right now, syntax highlighting is only available for PyCharm (all editions including the free community edition)
- Download GammaJ.xml here
- Click 'Download raw file'
- Move the downloaded file (usually in C:/Users//Downloads) to your PyCharm 'filetypes' directory (usually C:/Users//AppData/Roaming/JetBrains/PyCharm/filetypes)
- Restart PyCharm (if needed)
- Voilà! You now have colour in your GammaJ file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gammaj-6.tar.gz
(17.7 kB
view details)
Built Distribution
GammaJ-6-py3-none-any.whl
(17.1 kB
view details)
File details
Details for the file gammaj-6.tar.gz
.
File metadata
- Download URL: gammaj-6.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77c8e42d1913e92d298e71d64ed340791208466c36d35eedc4a93d88213a3405 |
|
MD5 | c0ab9f4b807d88dab982b0f735af8711 |
|
BLAKE2b-256 | b846944eaddb8157aa25d1c91c927c43b1f26b72482dbcca488fc37b9b024779 |
File details
Details for the file GammaJ-6-py3-none-any.whl
.
File metadata
- Download URL: GammaJ-6-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8440ed84bcadc204055364bcea3fb8432d0bf131567b37dd2706bf24548bcebd |
|
MD5 | 37db37af0421d52ae74afc3366c57bae |
|
BLAKE2b-256 | 1234902edfcb40499b572a54558a08443735ae195c534d3866ea52456a6d6b4b |