Skip to main content

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:

<!DOCTYPE html>

# comment
x: int = 123 # variable
def xyz() -> None:
    ... # ellipsis (ignores the line)
    
def main() -> None:
    # to insert html, use the 'export gamma' statement along with 'html' opening and closing tags as shown below
    export gamma <html>
        <!-- html code here -->
        <h1>
            Hello, world!
        </h1> <!-- this will open your browser to a random unused port with a 'Hello, world' heading -->
    </html>
    
    # 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 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 print("Unformatted", "text") # creates plain text
    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-5.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

GammaJ-5-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file gammaj-5.tar.gz.

File metadata

  • Download URL: gammaj-5.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for gammaj-5.tar.gz
Algorithm Hash digest
SHA256 dc951e2d3000577fbdaede3d15c3898e0cbb515fbe46d88f6cca39bf4f652876
MD5 56ca3ad8d1bc50f90dc33833362fc27d
BLAKE2b-256 4e7a8e59fcaeb79f436749523b0a083597ffcc734518e6be064ea652394cf333

See more details on using hashes here.

File details

Details for the file GammaJ-5-py3-none-any.whl.

File metadata

  • Download URL: GammaJ-5-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for GammaJ-5-py3-none-any.whl
Algorithm Hash digest
SHA256 0fea30c7fe7061d545511137d1547f0f988c1caca3d1f86bd37f597e75de0a6e
MD5 1d24d827d8966f4316fbbad5fbffc385
BLAKE2b-256 8fd1daea1af908eb638a542420673e789fac161cb578464bebd379d5466f3e6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page