Socket
Book a DemoInstallSign in
Socket

Compyter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Compyter

A component parser for html

0.0.4
pipPyPI
Maintainers
1

#+title: Readme

Compyte is a component library for python which lets you have components in html. It takes in a html with the Compyte syntax and returns the html with component results. It has a integrated python run envirionment with the syntax.

load stuff (using python exec to load python to the python envirionment) #+begin_src django {$ import os $} {$ name='Compyte'+' toilet' $} #+end_src

executing (using eval and replaces with result) #+begin_src django {% name %} {% 10 +10 %} #+end_src

** Components Components are added with as html with the compontent='[path-to-component-file]'. The attributes in the html tag will get added to a props dict and passed to the component file. where it can be accesed

#+begin_src django {% props['propname'] %} #+end_src

Check out the example down bellow

*** Example

This is a example of the Compyte html

  • index.html #+begin_src html
Untitled
	<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.12/dist/full.min.css" rel="stylesheet" type="text/css" />
	<script src="https://cdn.tailwindcss.com"></script>

	<link rel="apple-touch-icon" href="/apple-touch-icon.png">
	<!-- Place favicon.ico in the root directory -->
</head>
<body>
	{$ import os $}
	<h1>{% os.getcwd() %}</h1>
	<card component="./tests/card.html" >
		{$ string = 'what is ' + str(10-2) $}
		<h1 class="text-4xl font-bold" >test</h1>
		<btn title="click" onclick="alert('{% string %}')" component="./tests/button.html"></btn>
	</card>
</body>

#+end_src

-card.html #+begin_src html

{% props['children'] %}
#+end_src

-button.html #+begin_src html {% props['title'] %} #+end_src

-main.py #+begin_src python from compyte import *

output = open('tests/output.html','w') output.write(parse(open("tests/index.html","r").read()))

#+end_src

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.