~rbdr/page

a411ac34c5895e8ea4ddeed6b72f4787886a1ab0 — Ruben Beltran del Rio 2 months ago 8a12b5c
Add the packaging steps + manual
4 files changed, 134 insertions(+), 3 deletions(-)

M .build.yml
M Cargo.toml
M Makefile
A man/page.1
M .build.yml => .build.yml +4 -0
@@ 2,6 2,7 @@ image: archlinux
packages:
  - make
  - rsync
  - coreutils
  - clang
  - lld
  - rustup


@@ 17,6 18,9 @@ tasks:
  - set_rust: |
      cd page
      make set_rust
  - install_builders: |
      cargo install cargo-generate-rpm
      cargo install cargo-deb
  - package: |
      cd page
      make ci

M Cargo.toml => Cargo.toml +16 -0
@@ 2,6 2,10 @@
name = "page"
version = "1.3.1"
edition = "2021"
license = "AGPL-3.0-or-later"
description = "Command line tool to generate a static website and gemini capsule from a directory with gemtext."
homepage = "https://r.bdr.sh/page.html"
authors = ["Rubén Beltrán del Río <page@r.bdr.sh>"]

[dependencies]



@@ 9,3 13,15 @@ edition = "2021"
strip = true
lto = true
panic = "abort"

[package.metadata.generate-rpm]
assets = [
    { source = "target/release/page", dest = "/usr/bin/page", mode = "755" },
    { source = "man/page.1", dest = "/usr/share/man/man1/page.1", mode = "644" },
]

[package.metadata.deb]
assets = [
    ["target/release/page", "/usr/bin/page", "755" ],
    ["man/page.1", "/usr/share/man/man1/page.1", "644" ],
]

M Makefile => Makefile +21 -3
@@ 14,8 14,8 @@ prepare:
build: prepare
	cargo build --profile $(profile) --target $(target)

release: rpm tar
	rsync -avz $(app_name)-$(target)-$(channel).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
release: rpm tar deb
	@$(eval filename := $(app_name)-$(target)-$(channel))

$(architectures):
ifneq ($(channel),)


@@ 24,10 24,28 @@ else
	$(MAKE) -e target=$@ build
endif

deb: build
	@$(eval filename := $(app_name)-$(target)-$(channel))
	cargo deb --profile $(profile) --target $(target)
	mv target/$(target)/debian/*.deb $(filename).deb
	sha256sum $(filename).deb > $(filename).deb.sha256
	rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
	rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)

rpm: build
	@$(eval filename := $(app_name)-$(target)-$(channel))
	cargo generate-rpm --profile $(profile) --target $(target)
	mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
	sha256sum $(filename).rpm > $(filename).rpm.sha256
	rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
	rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)

tar: build
	tar -czvf $(app_name)-$(target)-$(channel).tar.gz -C target/$(target)/$(profile)/ $(app_name)
	@$(eval filename := $(app_name)-$(target)-$(channel))
	tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
	sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
	rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
	rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)

package: $(architectures)


A man/page.1 => man/page.1 +93 -0
@@ 0,0 1,93 @@
.TH PAGE 1 "2024-03-13" "1.3.1" "Page Manual"
.SH NAME
page \- gemtext based static website generation tool for gemini and http.
.SH SYNOPSIS
.B page
.SH DESCRIPTION
.PP
page is a tool that lets you create a static website from a directory of
gemtext files.
.PP
To use, go to the directory containing the site, and run \fBpage\fR. It will
create two directories in the parent directory using the same name but
appending \fB_html\fR and \fB_gemini\fR.
.SH FOLDER STRUCTURE
The website directory has some requirements for page to work correctly. It
must contain \fIgemtext\fR and a \fIlayout\fR, and optionally may contain
static files.
.SH GEMTEXT
.P
Any file with ending \fI.gmi\fR is interpreted as gemtext and will be parsed
as html with the following rules:
.TP
\- The first two lines are checked for front matter
.TP
\- If the first or second line starts with \fB--- title:\fR, the text following will be treated as the title of the page and the line will be removed from the output.
.TP
\- If the first or second line starts with \fB--- description:\fR, the text following will be treated as the description of the page and the line will be removed from the output.
.TP
\- URLs that end with the extension \fI.gmi\fR will be replaced with \fI.html\fR unless the url begins with \fIgemini:\fR
.P
Example, this could be index.gmi. The first link will be converted to html but the second won't:
.nf
\f(CW
--- title: Home
--- description: Clemland is dedicated to all things sound

# Welcome to Clemland

My projects are located here:

=> /projects.gmi Projects

This is a good gemini page:

=> gemini://r.bdr.sh/page.gmi
\fR
.fi
.SH LAYOUT
A file called _layout.html at the root of the element. It must be present. It
should include the three following keywords, \fBexactly as shown\fR.
.TP
.B {{ title }}
will get replaced with the front matter title of the gemtext file.
.TP
.B {{ description }}
will get replaced with the front matter description of the gemtext file.
.TP
.B {{ content }}
will get replaced with the body of the gemtext file.
.P
For example:
.nf
\f(CW
<!DOCTYPE HTML>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Clem Fandango">
    <meta name="description" content="{{ description }}">

    <title>Clemland {{ title }}</title>

    <link rel="stylesheet" type="text/css" href="/style.css">
  </head>
  <body>
    <main>
      {{ content }}
    </main>
  </body>
</html>
\fR
.fi
.SH STATIC FILES
Any file that isn't gemtext or the layout will be copied as-is. This includes
hidden files! The only ones that are excluded are .git and .gitignore.
.SH VERSION
.BR 1.3.1
.SH HOMEPAGE
.I https://r.bdr.sh/page.html
.SH AUTHORS
\ Rubén Beltrán del Río <\fIpage@r.bdr.sh\fP>