mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-10-26 08:18:26 +03:00
Work on img docs.
This commit is contained in:
parent
1f7f897451
commit
935a4cf170
31
README.md
31
README.md
@ -1,11 +1,9 @@
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-light.svg?sanitize=true" >
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-dark.svg?sanitize=true" >
|
||||
<img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-light.svg?sanitize=true" alt="Hurl Logo" width="264px">
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/logo-light.svg?sanitize=true" >
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/logo-dark.svg?sanitize=true" >
|
||||
<img src="/docs/assets/img/logo-light.svg?sanitize=true" width="264px" alt="Hurl Logo">
|
||||
</picture>
|
||||
|
||||
<br/>
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
[![Crates.io](https://img.shields.io/crates/v/hurl.svg)](https://crates.io/crates/hurl)
|
||||
@ -50,7 +48,8 @@ Hurl can run HTTP requests but can also be used to <b>test HTTP responses</b>.
|
||||
Different types of queries and predicates are supported, from [XPath] and [JSONPath] on body response,
|
||||
to assert on status code and response headers.
|
||||
|
||||
<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/docs/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="/docs/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
|
||||
|
||||
It is well adapted for <b>REST / JSON APIs</b>
|
||||
|
||||
@ -132,19 +131,13 @@ HTTP 200
|
||||
sha256 == hex,039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81;
|
||||
```
|
||||
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML reports
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit, TAP and HTML reports
|
||||
|
||||
<div class="picture">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/home-waterfall-light.avif" type="image/avif">
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/home-waterfall-light.webp" type="image/webp">
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/home-waterfall-light.png" type="image/png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/home-waterfall-dark.avif" type="image/avif">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/home-waterfall-dark.webp" type="image/webp">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/home-waterfall-dark.png" type="image/png">
|
||||
<img class="light-img u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
</div>
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/home-waterfall-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/home-waterfall-dark.png">
|
||||
<img src="/docs/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
|
||||
# Why Hurl?
|
||||
|
||||
@ -159,7 +152,7 @@ Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML re
|
||||
Hurl is a lightweight binary written in [Rust]. Under the hood, Hurl HTTP engine is
|
||||
powered by [libcurl], one of the most powerful and reliable file transfer libraries.
|
||||
With its text file format, Hurl adds syntactic sugar to run and test HTTP requests,
|
||||
but it's still the [curl] that we love.
|
||||
but it's still the [curl] that we love: __fast__, __efficient__ and __HTTP/3 ready__.
|
||||
|
||||
# Feedbacks
|
||||
|
||||
|
@ -2,6 +2,12 @@
|
||||
"""Build README for GitHub and crates.io.
|
||||
|
||||
This script uses Hurl doc to generate README suitable for GitHub and crates.io
|
||||
The README are displayed on GitHub and crates.io. It's generated by concatenating
|
||||
|
||||
- home.md
|
||||
- samples.md
|
||||
- manual.md
|
||||
- installation.md
|
||||
|
||||
Examples:
|
||||
$ python3 bin/docs/build_readme.py github > README.md
|
||||
@ -12,96 +18,154 @@ import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from textwrap import dedent
|
||||
|
||||
from markdown import parse_markdown, MarkdownDoc
|
||||
|
||||
|
||||
def main(dest: str) -> int:
|
||||
|
||||
header: str
|
||||
|
||||
if dest == "github":
|
||||
header = dedent(
|
||||
"""\
|
||||
<img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-dark.svg?sanitize=true#gh-dark-mode-only" alt="Hurl Logo" width="264px"><img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-light.svg?sanitize=true#gh-light-mode-only" alt="Hurl Logo" width="264px">
|
||||
|
||||
<br/>
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
[![Crates.io](https://img.shields.io/crates/v/hurl.svg)](https://crates.io/crates/hurl)
|
||||
[![documentation](https://img.shields.io/badge/-documentation-ff0288)](https://hurl.dev)
|
||||
|
||||
"""
|
||||
)
|
||||
elif dest == "crates":
|
||||
header = dedent(
|
||||
"""\
|
||||
<img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-light.svg" alt="Hurl Logo" width="264px">
|
||||
|
||||
<br/>
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
[![Crates.io](https://img.shields.io/crates/v/hurl.svg)](https://crates.io/crates/hurl)
|
||||
[![documentation](https://img.shields.io/badge/-documentation-ff0288)](https://hurl.dev)
|
||||
|
||||
"""
|
||||
)
|
||||
else:
|
||||
sys.stderr.write("build_readme.py [github, crates]\n")
|
||||
return os.EX_USAGE
|
||||
|
||||
header_md = parse_markdown(text=header)
|
||||
|
||||
home = Path("docs/home.md").read_text()
|
||||
def build_home_md(text: str) -> MarkdownDoc:
|
||||
"""Returns the MarkDown representation of the Home"""
|
||||
# We adapt the "Why Hurl" part to transform h2 tag back to markdown
|
||||
|
||||
def showcase_rep(m):
|
||||
return f"<li><b>{m.group(1)}:</b> {m.group(2).lower()}</li>"
|
||||
|
||||
home = re.sub(
|
||||
r"""<li class="showcase-item"><h2 class="showcase-item-title">(.+)</h2>(.+)</li>""",
|
||||
showcase_rep,
|
||||
home,
|
||||
text,
|
||||
)
|
||||
home_md = parse_markdown(text=home)
|
||||
# Remove canonical logo, will be replaced with GitHub flavored logo
|
||||
logo_nodes = [
|
||||
home_md.children[0],
|
||||
home_md.children[1],
|
||||
return parse_markdown(text=home)
|
||||
|
||||
|
||||
def build_sample_md(text: str) -> MarkdownDoc:
|
||||
"""Returns the MarkDown representation of the sample"""
|
||||
return parse_markdown(text=text)
|
||||
|
||||
|
||||
def build_manual_md(text: str) -> MarkdownDoc:
|
||||
return parse_markdown(text=text)
|
||||
|
||||
|
||||
def build_installation_md(text: str) -> MarkdownDoc:
|
||||
return parse_markdown(text=text)
|
||||
|
||||
|
||||
def replace(text: str, dest: str) -> str:
|
||||
# Do some replacements
|
||||
|
||||
# Replace canonical links to hurl.dev links
|
||||
text = re.sub(
|
||||
r"/docs/(.*)\.md",
|
||||
r"https://hurl.dev/docs/\1.html",
|
||||
text,
|
||||
)
|
||||
|
||||
snippets = [
|
||||
("blog.md", "https://hurl.dev/blog/", "https://hurl.dev/blog/"),
|
||||
(
|
||||
"""\
|
||||
<div class="home-logo">
|
||||
<img class="u-theme-light" src="/docs/assets/img/logo-light.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
<img class="u-theme-dark" src="/docs/assets/img/logo-dark.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
</div>
|
||||
""",
|
||||
"""\
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/logo-light.svg?sanitize=true" >
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/logo-dark.svg?sanitize=true" >
|
||||
<img src="/docs/assets/img/logo-light.svg?sanitize=true" width="264px" alt="Hurl Logo">
|
||||
</picture>
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
[![Crates.io](https://img.shields.io/crates/v/hurl.svg)](https://crates.io/crates/hurl)
|
||||
[![documentation](https://img.shields.io/badge/-documentation-ff0288)](https://hurl.dev)
|
||||
""",
|
||||
"""\
|
||||
<img src="https://hurl.dev/assets/img/logo-light.svg" width="264px" alt="Hurl Logo">
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
[![Crates.io](https://img.shields.io/crates/v/hurl.svg)](https://crates.io/crates/hurl)
|
||||
[![documentation](https://img.shields.io/badge/-documentation-ff0288)](https://hurl.dev)
|
||||
""",
|
||||
),
|
||||
(
|
||||
"""<div id="home-demo"></div>""",
|
||||
"""<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="/docs/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
""",
|
||||
"""<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="https://hurl.dev/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
""",
|
||||
),
|
||||
(
|
||||
"""\
|
||||
<div class="picture">
|
||||
<picture>
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.avif" type="image/avif">
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.webp" type="image/webp">
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.png" type="image/png">
|
||||
<img class="light-img u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
<picture>
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.avif" type="image/avif">
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.webp" type="image/webp">
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.png" type="image/png">
|
||||
<img class="dark-img u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/home-waterfall-dark.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
</div>
|
||||
""",
|
||||
"""\
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: light)" srcset="/docs/assets/img/home-waterfall-light.png">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="/docs/assets/img/home-waterfall-dark.png">
|
||||
<img src="/docs/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
""",
|
||||
"""\
|
||||
<img src="https://hurl.dev/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
""",
|
||||
),
|
||||
]
|
||||
home_md.remove_nodes(logo_nodes)
|
||||
for (old, new_for_github, new_for_crates) in snippets:
|
||||
if dest == "github":
|
||||
new = new_for_github
|
||||
else:
|
||||
new = new_for_crates
|
||||
text = text.replace(old, new)
|
||||
return text
|
||||
|
||||
samples_md = parse_markdown(text=Path("docs/samples.md").read_text())
|
||||
usage_md = parse_markdown(text=Path("docs/manual.md").read_text())
|
||||
|
||||
installation_md = parse_markdown(text=Path("docs/installation.md").read_text())
|
||||
def main(dest: str) -> int:
|
||||
if dest not in ["github", "crates"]:
|
||||
sys.stderr.write("build_readme.py [github, crates]\n")
|
||||
return os.EX_USAGE
|
||||
|
||||
home = Path("docs/home.md").read_text()
|
||||
home_md = build_home_md(text=home)
|
||||
|
||||
sample = Path("docs/samples.md").read_text()
|
||||
samples_md = build_sample_md(text=sample)
|
||||
|
||||
manual = Path("docs/manual.md").read_text()
|
||||
manual_md = build_manual_md(text=manual)
|
||||
|
||||
installation = Path("docs/installation.md").read_text()
|
||||
installation_md = parse_markdown(text=installation)
|
||||
|
||||
# TOC construction
|
||||
body_md = MarkdownDoc()
|
||||
body_md.extend(samples_md)
|
||||
body_md.extend(usage_md)
|
||||
body_md.extend(manual_md)
|
||||
body_md.extend(installation_md)
|
||||
toc = body_md.toc()
|
||||
toc_md = parse_markdown(text=toc)
|
||||
|
||||
# README construction
|
||||
readme_md = MarkdownDoc()
|
||||
readme_md.extend(header_md)
|
||||
|
||||
readme_md.extend(home_md)
|
||||
readme_md.extend(toc_md)
|
||||
readme_md.extend(body_md)
|
||||
|
||||
readme = readme_md.to_text()
|
||||
|
||||
# Replace canonical links to hurl.dev links
|
||||
readme = re.sub(
|
||||
r"/docs/(.*)\.md",
|
||||
r"https://hurl.dev/docs/\1.html",
|
||||
readme,
|
||||
)
|
||||
readme = readme.replace("blog.md", "https://hurl.dev/blog/")
|
||||
readme = replace(text=readme, dest=dest)
|
||||
|
||||
print(readme)
|
||||
return os.EX_OK
|
||||
|
12
docs/home.md
12
docs/home.md
@ -1,10 +1,8 @@
|
||||
<div class="home-logo">
|
||||
<img class="light-img" src="/docs/assets/img/logo-light.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
<img class="dark-img" src="/docs/assets/img/logo-dark.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
<img class="u-theme-light" src="/docs/assets/img/logo-light.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
<img class="u-theme-dark" src="/docs/assets/img/logo-dark.svg" width="277px" height="72px" alt="Hurl logo"/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
# What's Hurl?
|
||||
|
||||
Hurl is a command line tool that runs <b>HTTP requests</b> defined in a simple <b>plain text format</b>.
|
||||
@ -44,7 +42,7 @@ Hurl can run HTTP requests but can also be used to <b>test HTTP responses</b>.
|
||||
Different types of queries and predicates are supported, from [XPath] and [JSONPath] on body response,
|
||||
to assert on status code and response headers.
|
||||
|
||||
<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/docs/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
<div id="home-demo"></div>
|
||||
|
||||
It is well adapted for <b>REST / JSON APIs</b>
|
||||
|
||||
@ -126,7 +124,7 @@ HTTP 200
|
||||
sha256 == hex,039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81;
|
||||
```
|
||||
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML reports
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit, TAP and HTML reports
|
||||
|
||||
<div class="picture">
|
||||
<picture>
|
||||
@ -156,7 +154,7 @@ Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML re
|
||||
Hurl is a lightweight binary written in [Rust]. Under the hood, Hurl HTTP engine is
|
||||
powered by [libcurl], one of the most powerful and reliable file transfer libraries.
|
||||
With its text file format, Hurl adds syntactic sugar to run and test HTTP requests,
|
||||
but it's still the [curl] that we love.
|
||||
but it's still the [curl] that we love: __fast__, __efficient__ and __HTTP/3 ready__.
|
||||
|
||||
# Feedbacks
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/art/logo-full-light.svg" alt="Hurl Logo" width="264px">
|
||||
|
||||
<br/>
|
||||
<img src="https://hurl.dev/assets/img/logo-light.svg" width="264px" alt="Hurl Logo">
|
||||
|
||||
[![deploy status](https://github.com/Orange-OpenSource/hurl/workflows/test/badge.svg)](https://github.com/Orange-OpenSource/hurl/actions)
|
||||
[![coverage](https://Orange-OpenSource.github.io/hurl/coverage/badges/flat.svg)](https://Orange-OpenSource.github.io/hurl/coverage)
|
||||
@ -46,7 +44,8 @@ Hurl can run HTTP requests but can also be used to <b>test HTTP responses</b>.
|
||||
Different types of queries and predicates are supported, from [XPath] and [JSONPath] on body response,
|
||||
to assert on status code and response headers.
|
||||
|
||||
<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="https://raw.githubusercontent.com/Orange-OpenSource/hurl/master/docs/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
<a href="https://hurl.dev/player.html?id=hurl&speed=3"><img src="https://hurl.dev/assets/img/poster-hurl.png" width="100%" alt="Hurl Demo"/></a>
|
||||
|
||||
|
||||
It is well adapted for <b>REST / JSON APIs</b>
|
||||
|
||||
@ -128,22 +127,9 @@ HTTP 200
|
||||
sha256 == hex,039058c6f2c0cb492c533b0a4d14ef77cc0f78abccced5287d84a1a2011cfb81;
|
||||
```
|
||||
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML reports
|
||||
Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit, TAP and HTML reports
|
||||
|
||||
<div class="picture">
|
||||
<picture>
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.avif" type="image/avif">
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.webp" type="image/webp">
|
||||
<source srcset="/docs/assets/img/home-waterfall-light.png" type="image/png">
|
||||
<img class="light-img u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
<picture>
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.avif" type="image/avif">
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.webp" type="image/webp">
|
||||
<source srcset="/docs/assets/img/home-waterfall-dark.png" type="image/png">
|
||||
<img class="dark-img u-drop-shadow u-border u-max-width-100" src="/docs/assets/img/home-waterfall-dark.png" width="480" alt="HTML report"/>
|
||||
</picture>
|
||||
</div>
|
||||
<img src="https://hurl.dev/assets/img/home-waterfall-light.png" width="480" alt="HTML report"/>
|
||||
|
||||
# Why Hurl?
|
||||
|
||||
@ -158,7 +144,7 @@ Finally, Hurl is easy to <b>integrate in CI/CD</b>, with text, JUnit and HTML re
|
||||
Hurl is a lightweight binary written in [Rust]. Under the hood, Hurl HTTP engine is
|
||||
powered by [libcurl], one of the most powerful and reliable file transfer libraries.
|
||||
With its text file format, Hurl adds syntactic sugar to run and test HTTP requests,
|
||||
but it's still the [curl] that we love.
|
||||
but it's still the [curl] that we love: __fast__, __efficient__ and __HTTP/3 ready__.
|
||||
|
||||
# Feedbacks
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user