mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-23 04:03:00 -05:00
Minor improvements (#556)
* checkpoint: added some text * checkpoint: added setting up the environment, tips for writing good issues * continuing to fill it out * added more detailed description of the process of creating a change and some other cleanup. * added a getting started section and cleaned up the grammar. This ready for the PR now * forgot to add the new section to the TOC * Minor fixes Co-authored-by: Kevin Goldsmith <kgoldsmith@anaconda.com> Co-authored-by: Matt Kramer <mkramer@anaconda.com>
This commit is contained in:
@@ -11,7 +11,7 @@ take a look at the general contributing guidelines for the PyScript project. You
|
|||||||
|
|
||||||
## Documentation Principles
|
## Documentation Principles
|
||||||
|
|
||||||
The PyScript documentation is based on a documentation framework called [Diátaxis](https://diataxis.fr/). This framework helps to solve the problem of structure in technical documentation and identifies four modes of documentation - **tutorials, how-to guides, technical reference and explanation**. Each one of these modes answers to a different user need, fulfils a different purpose and requires a different approach to its creation.
|
The PyScript documentation is based on a documentation framework called [Diátaxis](https://diataxis.fr/). This framework helps to solve the problem of structure in technical documentation and identifies four modes of documentation - **tutorials, how-to guides, technical reference and explanation**. Each one of these modes answers to a different user need, fulfills a different purpose and requires a different approach to its creation.
|
||||||
|
|
||||||
The picture below gives a good visual representation of that separation of concerns:
|
The picture below gives a good visual representation of that separation of concerns:
|
||||||
|
|
||||||
@@ -24,4 +24,4 @@ So, please keep that in mind when contributing to the project documentation. For
|
|||||||
The `docs` directory in the pyscript repository contains a
|
The `docs` directory in the pyscript repository contains a
|
||||||
[Sphinx](https://www.sphinx-doc.org/) documentation project. Sphinx is a system
|
[Sphinx](https://www.sphinx-doc.org/) documentation project. Sphinx is a system
|
||||||
that takes plaintext files containing documentation written in Markdown, along with
|
that takes plaintext files containing documentation written in Markdown, along with
|
||||||
and static files like templates and themes, to build the static end result.
|
static files like templates and themes, to build the static end result.
|
||||||
|
|||||||
@@ -152,11 +152,8 @@ export class BaseEvalElement extends HTMLElement {
|
|||||||
this.outputElement.style.display = 'block';
|
this.outputElement.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_async) {
|
is_async ? await pyodide.runPythonAsync(`output_manager.revert()`)
|
||||||
await pyodide.runPythonAsync(`output_manager.revert()`);
|
: await pyodide.runPython(`output_manager.revert()`);
|
||||||
} else {
|
|
||||||
await pyodide.runPython(`output_manager.revert()`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if this REPL contains errors, delete them and remove error classes
|
// check if this REPL contains errors, delete them and remove error classes
|
||||||
const errorElements = document.querySelectorAll(`div[id^='${this.errorElement.id}'][error]`);
|
const errorElements = document.querySelectorAll(`div[id^='${this.errorElement.id}'][error]`);
|
||||||
@@ -189,11 +186,10 @@ export class BaseEvalElement extends HTMLElement {
|
|||||||
} // end evaluate
|
} // end evaluate
|
||||||
|
|
||||||
async eval(source: string): Promise<void> {
|
async eval(source: string): Promise<void> {
|
||||||
let output;
|
|
||||||
const pyodide = runtime;
|
const pyodide = runtime;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
output = await pyodide.runPythonAsync(source);
|
const output = await pyodide.runPythonAsync(source);
|
||||||
if (output !== undefined) {
|
if (output !== undefined) {
|
||||||
console.log(output);
|
console.log(output);
|
||||||
}
|
}
|
||||||
@@ -268,10 +264,9 @@ function createWidget(name: string, code: string, klass: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async eval(source: string): Promise<void> {
|
async eval(source: string): Promise<void> {
|
||||||
let output;
|
|
||||||
const pyodide = runtime;
|
const pyodide = runtime;
|
||||||
try {
|
try {
|
||||||
output = await pyodide.runPythonAsync(source);
|
const output = await pyodide.runPythonAsync(source);
|
||||||
this.proxyClass = pyodide.globals.get(this.klass);
|
this.proxyClass = pyodide.globals.get(this.klass);
|
||||||
if (output !== undefined) {
|
if (output !== undefined) {
|
||||||
console.log(output);
|
console.log(output);
|
||||||
@@ -281,7 +276,6 @@ function createWidget(name: string, code: string, klass: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const xPyWidget = customElements.define(name, CustomWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PyWidget extends HTMLElement {
|
export class PyWidget extends HTMLElement {
|
||||||
@@ -361,16 +355,14 @@ export class PyWidget extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSourceFromFile(s: string): Promise<string> {
|
async getSourceFromFile(s: string): Promise<string> {
|
||||||
const pyodide = runtime;
|
|
||||||
const response = await fetch(s);
|
const response = await fetch(s);
|
||||||
return await response.text();
|
return await response.text();
|
||||||
}
|
}
|
||||||
|
|
||||||
async eval(source: string): Promise<void> {
|
async eval(source: string): Promise<void> {
|
||||||
let output;
|
|
||||||
const pyodide = runtime;
|
const pyodide = runtime;
|
||||||
try {
|
try {
|
||||||
output = await pyodide.runPythonAsync(source);
|
const output = await pyodide.runPythonAsync(source);
|
||||||
if (output !== undefined) {
|
if (output !== undefined) {
|
||||||
console.log(output);
|
console.log(output);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user