Metadata-Version: 2.4
Name: entrylib-pages
Version: 0.2.0
Summary: EntryLib's pages for a claimset: the paper view and the record, as entrylib.org shows them
Author: EntryLib
License-Expression: Apache-2.0
Project-URL: Homepage, https://entrylib.org
Project-URL: Source, https://github.com/entrylib/pages
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# EntryLib pages

[![PyPI version](https://img.shields.io/pypi/v/entrylib-pages)](https://pypi.org/project/entrylib-pages/)
[![Tests](https://github.com/entrylib/pages/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/entrylib/pages/actions/workflows/tests.yml)
[![Downloads](https://img.shields.io/pypi/dm/entrylib-pages)](https://pypistats.org/packages/entrylib-pages)
[![License](https://img.shields.io/github/license/entrylib/pages)](https://github.com/entrylib/pages/blob/main/LICENSE)
[![Python versions](https://img.shields.io/pypi/pyversions/entrylib-pages)](https://pypi.org/project/entrylib-pages/)

How [EntryLib](https://entrylib.org) shows the [claimsets](https://github.com/entrylib/claimset) it publishes: the
page of a paper, as entrylib.org draws it. The portal (https://github.com/entrylib/portal) draws its pages with this
package, and `claimset preview` draws the same page on the author's machine before a claimset is submitted, so that
what the author sees is what will be published.

## What it draws

- **The paper view**: the claims in reading order under the paper's sections, each with its evidence, proof or
  figures, the terms it uses and the assumptions it rests on.
- **The record**: every object of the claimset by kind (claims, evidence, definitions, assumptions, limitations,
  artefacts, references), to check what the paper rests on.
- **The panel and the contents**: the Support score and its parts when they are given (the scores are computed by
  [EntryLib's rubric](https://github.com/entrylib/rubric), not here), the claims by kind, conflicts of interest, and
  the sections of the page.

The format, its validation and the plain-text reading view for models belong to the `claimset` package, which
depends on this one; this package is EntryLib's presentation of it, with the site's stylesheet and script, and imports
no claimset code. What a page needs of the format (how values are written, the verifiability the platform computes,
subfield names) is given by the caller as one object, `claimset.pages.FORMAT`
([format.py](https://github.com/entrylib/pages/blob/main/src/entrylib_pages/format.py) describes it).

## Install

```bash
pip install entrylib-pages
```

It needs Python 3.10 or later and nothing else; `pip install claimset` installs it too. In Python, import it as
`entrylib_pages`.

## Use

Before submitting a claimset, see it as EntryLib will show it, with the
[claimset](https://pypi.org/project/claimset/) command-line tool:

```bash
claimset preview paper.claimset.json      # the paper view and the record, written beside the file, and opened
claimset preview paper.zip --no-open      # a submission package: unpacked beside it, so its figures show
```

From Python:

```python
import json
import entrylib_pages
from claimset.pages import FORMAT                          # what a page needs of the claimset format

doc = json.load(open("paper.claimset.json"))
html = entrylib_pages.preview_html(doc, fmt=FORMAT)                  # the paper view, as one self-contained page
html = entrylib_pages.preview_html(doc, fmt=FORMAT, view="record")   # the record
```

- `entrylib_pages.preview_html(doc, fmt=None, scores=None, view="paper", note="", paper_href=…, record_href=…)`: the page,
  with the site's stylesheets and script inlined. Figures the claimset names by relative path (`files/figures/a.png`)
  are shown from beside the page, so write it in the folder that holds the claimset and its files; figures already
  published on EntryLib are shown from there. `scores`: the rubric's, if the caller has them.
- `entrylib_pages.use(fmt)`: the format every page of the process is drawn with (the portal calls it once); `fmt`
  given to `preview_html` overrides it.
- `entrylib_pages.stylesheet()`: the page view's stylesheet (`claimset.css`).
- `entrylib_pages.__version__`: the version of the pages.

## Changing the pages

A change here changes entrylib.org's pages: it is designed in the portal's design document first
(https://github.com/entrylib/portal/blob/main/docs/design-v1.md, §7) and checked with the portal's tests
([AGENTS.md](https://github.com/entrylib/pages/blob/main/AGENTS.md)). A release raises `version` in `pyproject.toml`
and `__version__` in `src/entrylib_pages/__init__.py`; the `build` workflow drafts it on GitHub, and publishing the
draft uploads it to PyPI (`release`).

## Licence

Apache 2.0.
