This repository has been archived on 2026-03-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PyWPR/www/docs/basics.pyp
2025-08-24 22:09:37 +03:00

60 lines
2.5 KiB
Python

<py!>
import components.code as code
import components.docs as docs
</py!>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pyp | queries</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="font-sans min-h-[90vh] flex flex-col items-center">
<div class="w-full max-w-[80vw] flex gap-5 h-10 bg-slate-900/50 py-5 fixed my-5 p-6 rounded-full backdrop-blur-md lg:max-w-3xl items-center justift-around text-white">
<a class="font-bold" href="./">PyWPR docs</a>
</div>
<div class="inline-flex flex-col gap-5 items-center max-w-[85vw] mt-20">
<h1 class="text-4xl">
basics
</h1>
<div class="block h-0.5 bg-zinc-400 w-full">
</div>
<h3 class="text-2xl">&lt;py>! tag</h3>
<p class="text-center">in pywrp we have <span class="bg-black p-2 rounded-xl text-white font-mono">&lt;py!&gt;</span> and <span class="bg-black p-2 rounded-xl text-white font-mono">&lt;/py!&gt;</span> HTML tags for embedding python <b>server</b> code,
<br><i>(almost like in php)</i><br>
for example:</p>
<p?>
code.code_comp(f"""<p>this is html element</p>
{'<'}py!> # This is Python code</py!>""",'html')
</p?>
<div class="block h-0.5 bg-zinc-400 w-full"></div>
<h3 class="text-2xl">echo function</h3>
<p class="text-center">
<span class="bg-black p-2 rounded-xl text-white font-mono">e()</span> is a function that prints text to the page
<br><i>(just like <span class="font-mono">echo</span> in php)</i>
</p>
<p?>code.code_comp(f"""{'<'}py!>
e("hello word")
# also you can use just regular python print
print(object)
# e() supports only str|int|float, but you can ignoreType=True
e({'{'}'test':123{'}'},ignoreType=True)
</py!>""")</p?>
<div class="block h-0.5 bg-zinc-400 w-full"></div>
<h3 class="text-2xl">&lt;p?> tag</h3>
<p class="text-center">also there is <span class="bg-black p-2 rounded-xl text-white font-mono">&lt;p?>&lt;/p?></span> tags, they are shortcuts to <b>echo</b>
<br><i>(like in php too)</i><br>
for example:</p>
<p?>
code.code_comp(f"""{'<'}p?>"hello world"{'<'}/p?>
<!--it same as-->
{'<'}py!>e("hello world"){'</'}py!>
<!--- also supports functions-->
{'<'}p?>foo(){'</'}p?>""",'html')
</p?>
</div></div>
</body>
</html>