Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish man pages to /man/ #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 21 additions & 1 deletion .build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
image: archlinux
image: alpine/edge
WhyNotHugo marked this conversation as resolved.
Show resolved Hide resolved
oauth: pages.sr.ht/PAGES:RW
sources:
- https://github.com/swaywm/swaywm.org
packages:
- hut
- mandoc
- sway-doc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should clone the sway repo instead and run scdoc, to grab the latest version even if the package is lagging or something?

Downsides: would need to checkout the latest tag to avoid publishing docs for unreleased versions, and would need to hardcode man pages paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's more effort that it's worth. The sway-docs package on alpine/edge should not take more than a day or two to update, and this saves us having to build all of sway.

Maybe if sway had some mechanism to instruct meson to only build docs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's more effort that it's worth. The sway-docs package on alpine/edge should not take more than a day or two to update, and this saves us having to build all of sway.

Not a fan on relying on a distro to just build a man page, but I can live with that…

Maybe if sway had some mechanism to instruct meson to only build docs?

One way would be to invoke scdoc directly. Another would be to pass the list of man pages to ninja (ninja -C build/ sway.1 …), but we'd still need to pull all sway build deps.

Copy link
Contributor Author

@WhyNotHugo WhyNotHugo Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I can also just fetch the sway repo, find pages with find . -name '*.scd' and then run scdoc on them individually. Should be quite doable in a single sh script.

tasks:
- build: |
cd swaywm.org/
curl --fail -o site/intro.webm https://l.sr.ht/lJ9C.webm
- man: |
man2html() {
# $1: section
# $2: name
gunzip -c /usr/share/man/man$1/$2.$1.gz | mandoc -T html -O style=man-style.css |
sed -E 's,<b>(sway[a-z-]*)</b>\(([0-9])\),<a href="\1.\2.html"><b>\1</b>(\2)</a>,g' > $2.$1.html
}
cd swaywm.org/site/man/
man2html 1 sway
man2html 1 swaymsg
man2html 1 swaynag
man2html 5 sway-bar
man2html 5 sway-input
man2html 5 sway-output
man2html 5 sway
man2html 5 swaynag
man2html 7 sway-ipc
man2html 7 swaybar-protocol
- deploy: |
cd swaywm.org/
[ "$(git rev-parse origin/master)" = "$(git rev-parse HEAD)" ] || complete-build
Expand Down
66 changes: 66 additions & 0 deletions site/man/man-style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* From: https://git.sr.ht/~emersion/soju/tree/website */

body {
max-width: 88ex;
padding: 2ex 4ex;

font-family: monospace;
font-size: 14px;
}

.head,
.foot {
width: 100%;
color: #999;
}

.foot {
margin-top: 3ex;
}

.head-vol {
text-align: center;
}

.head-rtitle {
text-align: right;
}

h1 {
font-size: 16px;
}

h2 {
font-size: 14px;
}

p {
text-align: justify;
}
.Bd-indent {
padding-left: 4ex;
}

pre {
color: #434241;
}

@media (prefers-color-scheme: dark) {
body {
background-color: #18191a;
color: #ffffff;
}

.head,
.foot {
color: #cac0b3;
}

a {
color: #3daeff;
}

pre {
color: #e4ded3;
}
}