Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ jobs:
test -f _site/index.html
test -f _site/webworker.js
test -f _site/wenxian-web-packages.tar.gz
bundle_bytes=$(stat -c%s _site/wenxian-web-packages.tar.gz)
echo "Web bundle: $bundle_bytes bytes"
test "$bundle_bytes" -lt 1000000
mkdir bundle-check
tar -xzf _site/wenxian-web-packages.tar.gz -C bundle-check
PYTHONPATH=bundle-check python - <<'PY'
import json
from importlib.metadata import version
from pathlib import Path

import pyiso4
import pylatexenc
import requests
import unidecode
import wenxian

Expand All @@ -71,7 +74,12 @@ jobs:
assert manifest["format"] == 1
assert manifest["packages"]["wenxian"] == version("wenxian")
assert manifest["requirements_lock"] == "web-requirements.lock"
assert "requests==2.34.2" in manifest["requirements"]
assert "requests" not in {name.lower() for name in manifest["packages"]}
assert manifest["requirements"] == [
"pyiso4==0.1.6",
"pylatexenc==3.0a21",
"unidecode==1.4.0",
]
print(json.dumps(manifest, indent=2, sort_keys=True))
PY
- name: Upload website artifact
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ jobs:
uv build --wheel
wheel=$(echo dist/wenxian-*.whl)
python scripts/build_web_bundle.py "$wheel" test-web-bundle.tar.gz
bundle_bytes=$(stat -c%s test-web-bundle.tar.gz)
echo "Web bundle: $bundle_bytes bytes"
test "$bundle_bytes" -lt 1000000
- name: Install Chromium
run: npx playwright install --with-deps chromium
- name: Run browser end-to-end smoke test
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@

## Usage

### Use wenxian in the browser (Deprecated)
### Use wenxian in the browser

> [!CAUTION]
> Deprecated, as several websites that serve the API have disabled CORS.

Visit [wenxian.njzjz.win](https://wenxian.njzjz.win) to use wenxian in the browser.
Visit [wenxian.njzjz.win](https://wenxian.njzjz.win) to use wenxian directly in the browser.

### Command line interface

Expand Down
194 changes: 109 additions & 85 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,103 +6,127 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta
name="description"
content="Generate BibTeX from DOI/PMID/arXiv identifier"
content="Generate BibTeX from a DOI, PMID, arXiv identifier, or paper title"
/>
<meta
name="keywords"
content="BibTeX, DOI, PMID, arXiv, citation, reference"
/>
<meta name="author" content="Jinzhe Zeng" />
<meta name="theme-color" content="#03A89E" />
<link rel="icon" type="image/svg" href="logo.svg" />
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
<link rel="preconnect" href="https://pypi.org" />
<link rel="preconnect" href="https://files.pythonhosted.org" />
<meta name="theme-color" content="#0f766e" />
<link rel="icon" type="image/svg+xml" href="logo.svg" />
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
<link
href="
https://cdn.jsdelivr.net/npm/github-fork-ribbon-css@0.2.3/gh-fork-ribbon.min.css
"
rel="stylesheet"
rel="preload"
href="./wenxian-web-packages.tar.gz"
as="fetch"
type="application/gzip"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism-solarizedlight.min.css"
/>
<title>wenxian</title>
<title>wenxian · BibTeX from identifiers</title>
</head>

<body class="flex">
<a
class="github-fork-ribbon"
href="https://github.com/njzjz/wenxian"
data-ribbon="Fork me on GitHub"
title="Fork me on GitHub"
>Fork me on GitHub</a
>
<h1 style="margin-bottom: 50px; color: #03a89e">
<img
src="logo.svg"
height="100px"
width="100px"
style="margin-bottom: -1em"
title="Logo"
/>
wenxian
</h1>
<form style="padding-bottom: 20px" target="_blank" class="flex">
<label class="block" style="width: fit-content">
<input
class="block identifier"
id="identifier"
type="text"
placeholder="DOI/PMID/arXiv identifier"
required
/>
<div class="bar"></div>
</label>
<input
type="submit"
id="submit"
class="block btn"
value="Generate BibTeX"
/>
</form>
<div id="progress-container" class="progress-container" hidden>
<progress id="progress-bar" max="100" value="0"></progress>
<div id="progress-text" class="progress-text" aria-live="polite"></div>
</div>
<div class="examples" id="message">
<p><b>Examples:</b></p>
<ul>
<li>
<a href="javascript:run_example('10.1063/5.0155600')"
>10.1063/5.0155600</a
>
</li>
<li><a href="javascript:run_example('37526163')">37526163</a></li>
<li><a href="javascript:run_example('2304.09409')">2304.09409</a></li>
</ul>
</div>
<div id="output" class="output" style="display: none">
<button id="copy_button" onclick="copy_bibtex()" class="copy-button">
Copy BibTeX
</button>
<pre><code class="language-bib" id="bibtex"></code></pre>
<body>
<div class="page-shell">
<header class="site-header">
<a class="brand" href="./" aria-label="wenxian home">
<img src="logo.svg" width="44" height="44" alt="" />
<span>wenxian</span>
</a>
<a
class="github-link"
href="https://github.com/njzjz/wenxian"
target="_blank"
rel="noreferrer"
>
GitHub
<span aria-hidden="true">↗</span>
</a>
</header>

<main>
<section class="hero" aria-labelledby="hero-title">
<div class="eyebrow">
<span class="status-dot" aria-hidden="true"></span>
Runs entirely in your browser
</div>
<h1 id="hero-title">Turn a paper identifier into clean BibTeX.</h1>
<p class="hero-copy">
Paste a DOI, PMID, arXiv ID, or paper title. wenxian checks multiple
scholarly sources and formats the result for you.
</p>
</section>

<section class="lookup-card" aria-label="Generate a reference">
<form id="lookup-form">
<label class="input-label" for="identifier">Paper identifier</label>
<div class="input-row">
<input
class="identifier"
id="identifier"
name="identifier"
type="text"
placeholder="e.g. 10.1063/5.0155600"
autocomplete="off"
autocapitalize="off"
spellcheck="false"
required
/>
<button type="submit" id="submit" class="btn">
<span>Generate BibTeX</span>
<span class="button-arrow" aria-hidden="true">→</span>
</button>
</div>
</form>

<div class="examples">
<span class="examples-label">Try an example</span>
<button type="button" onclick="run_example('10.1063/5.0155600')">
DOI
</button>
<button type="button" onclick="run_example('37526163')">
PMID
</button>
<button type="button" onclick="run_example('2304.09409')">
arXiv
</button>
</div>
<div id="message" class="message" aria-live="polite"></div>

<div id="progress-container" class="progress-container" hidden>
<div class="progress-meta">
<span id="progress-text" aria-live="polite">Preparing…</span>
<span id="progress-percent">0%</span>
</div>
<progress id="progress-bar" max="100" value="0"></progress>
</div>
</section>

<section id="output" class="output" style="display: none">
<div class="output-header">
<div>
<span class="result-label">Result</span>
<h2>BibTeX</h2>
</div>
<button
id="copy_button"
onclick="copy_bibtex()"
class="copy-button"
>
Copy BibTeX
</button>
</div>
<pre><code id="bibtex"></code></pre>
</section>
</main>

<footer>
<span>Open source · powered by</span>
<a href="https://github.com/njzjz/wenxian">njzjz/wenxian</a>
</footer>
</div>
<p style="position: sticky; top: calc(100% - 2.5em)">
Powered by
<a style="color: #3294ea" href="https://github.com/njzjz/wenxian"
>njzjz/wenxian</a
>
</p>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/prismjs-bibtex@2.1.0/prism-bibtex.js"
integrity="sha256-A5GMUmGHpY8mVpfcaRLQFeHtmdjZLumKBOMpf81FXX0="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>

<script src="wenxian.js" type="module"></script>
</body>
</html>
Loading