style: update formatting

This commit is contained in:
Kristofers Solo 2024-07-25 15:25:43 +03:00
parent c96e67130c
commit 9b73187481
6 changed files with 1352 additions and 856 deletions

29
.github/workflows/typst.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Build Typst document
on: [push, workflow_dispatch]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Typst
uses: lvignoli/typst-action@main
with:
source_file: |
main.typ
- name: Upload PDF file
uses: actions/upload-artifact@v3
with:
name: PDF
path: "*.pdf"
- name: Get current date
id: date
run: echo "DATE=$(date +%Y-%m-%d-%H:%M)" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
name: "${{ github.ref_name }} — ${{ env.DATE }}"
files: main.pdf

View File

@ -4,10 +4,9 @@
level: 1, level: 1,
outlined: false, outlined: false,
numbering: none, numbering: none,
"Anotācija" "Anotācija",
) )
#indent-par([ #indent-par([
Sociālā lomu spēle "Mafija" ir plaši pazīstama. Tā ir pieejama vairākos Sociālā lomu spēle "Mafija" ir plaši pazīstama. Tā ir pieejama vairākos
paveidos un formātos, kā arī piedāvā neierobežotu konfigurāciju un lomu skaitu. paveidos un formātos, kā arī piedāvā neierobežotu konfigurāciju un lomu skaitu.
@ -21,7 +20,10 @@ konfigurāciju izveidi, kā arī priviliģētu lietotāju (maksas lietotāju) iz
pielietojot abonementa paveida maksājumu sistēmu. pielietojot abonementa paveida maksājumu sistēmu.
]) ])
#par(first-line-indent: 0cm, [*Atslēgvārdi:*]) #par(
first-line-indent: 0cm,
[*Atslēgvārdi:*],
)
Mafijas spēle, sistēmas prasības, specifikācijas dokuments, programmatūras Mafijas spēle, sistēmas prasības, specifikācijas dokuments, programmatūras
uzlabošana, lomu spēle, vienkāršota spēlēšana, organizatoriski risinājumi, uzlabošana, lomu spēle, vienkāršota spēlēšana, organizatoriski risinājumi,
@ -32,32 +34,33 @@ maksas lietotājs, maksājumu apstrādātāja lietojumprogrammas saskarni (API).
hyphenate: auto, hyphenate: auto,
lang: "en", lang: "en",
[ [
#pagebreak() #pagebreak()
#heading( #heading(
level: 1, level: 1,
outlined: false, outlined: false,
numbering: none, numbering: none,
"Abstract" "Abstract",
) )
#indent-par([ #indent-par([
The social role-playing game "Mafia" is widely known. It is available in The social role-playing game "Mafia" is widely known. It is available in
various versions and formats, offering an unlimited number of configurations various versions and formats, offering an unlimited number of configurations
and roles. For the convenience of players, the game is made as a web and roles. For the convenience of players, the game is made as a web
application that includes instructions, informing the user about available application that includes instructions, informing the user about available
ptions, and explanations describing the game's elements and interface, to improve user experience. Market research confirms that several mediocre solutions are options, and explanations describing the game's elements and interface, to
improve user experience.
Market research confirms that several mediocre solutions are
available. The software requirements specification describes the system's basic available. The software requirements specification describes the system's basic
requirements with additional functionality, including expanding the range of requirements with additional functionality, including expanding the range of
roles, creating game configurations, and a privileged user (premium user) using roles, creating game configurations, and a privileged user (premium user) using
a subscription-based payment system. a subscription-based payment system.
]) ])
#par(
first-line-indent: 0cm,
#par(first-line-indent: 0cm, [*Keywords:*]) [*Keywords:*],
)
Mafia game, system requirements, specification document, software improvement, Mafia game, system requirements, specification document, software improvement,
role-playing, simplified gameplay, organizational solutions, software role-playing, simplified gameplay, organizational solutions, software
requirements specification, user-generated content, subscription, premium user, requirements specification, user-generated content, subscription, premium user,
payment processor application program interface (API). payment processor application program interface (API).
]) ],
)

View File

@ -2,9 +2,10 @@
#import "@preview/big-todo:0.2.0": * #import "@preview/big-todo:0.2.0": *
#import "@preview/tablex:0.0.6": tablex #import "@preview/tablex:0.0.6": tablex
#let indent = 1cm #let indent = 1cm
#let indent-par(body) = par(h(indent) + body) #let indent-par(
body,
) = par(h(indent) + body)
#let project( #let project(
university: "", university: "",
@ -13,28 +14,28 @@
authors: (), authors: (),
advisor: "", advisor: "",
date: "", date: "",
body body,
) = { ) = {
set document(author: authors) set document(author: authors)
set page( set page(
margin: (left: 30mm, right: 20mm, top: 20mm, bottom: 20mm), margin: (
left: 30mm,
right: 20mm,
top: 20mm,
bottom: 20mm,
),
number-align: center, number-align: center,
paper: "a4" paper: "a4",
) )
set text( set text(
//font: "New Computer Modern", //font: "New Computer Modern",
font: "CMU", font: "CMU", size: 12pt, hyphenate: auto, lang: "lv", region: "LV",
size: 12pt,
hyphenate: auto,
lang: "lv",
region: "LV"
) )
show raw: set text(font: "New Computer Modern Mono") show raw: set text(font: "New Computer Modern Mono")
show math.equation: set text(weight: 400) show math.equation: set text(weight: 400)
// Formatting for regular text // Formatting for regular text
set par( set par(
justify: true, justify: true,
@ -45,19 +46,23 @@
show heading: set block(spacing: 1.5em) show heading: set block(spacing: 1.5em)
set terms(separator: [ -- ]) set terms(separator: [ -- ])
// Headings // Headings
set heading(numbering: "1.1.") set heading(numbering: "1.1.")
show heading: it => { show heading: it => {
if it.level == 1 { if it.level == 1 {
// pagebreak(weak: true) // pagebreak(weak: true)
text(14pt, align(center, upper(it))) text(
14pt,
align(
center,
upper(it),
),
)
} else { } else {
it it
} }
} }
/* Title page config start */ /* Title page config start */
align( align(
center, center,
@ -67,48 +72,66 @@
[ [
#university\ #university\
#faculty #faculty
] ],
),
),
) )
))
v(1fr) v(1fr)
align( align(
center, center,
text(20pt, weight: "bold", title) text(
20pt,
weight: "bold",
title,
),
) )
v(1fr) v(1fr)
// Author information // Author information
align(right, [ align(
right,
[
#if authors.len() > 1 { #if authors.len() > 1 {
text(weight: "bold", "Darba autori:") text(
weight: "bold",
"Darba autori:",
)
} else { } else {
text(weight: "bold", "Darba autors:") text(
weight: "bold",
"Darba autors:",
)
}\ }\
#authors.join("\n") #authors.join("\n")
#v(2em) #v(2em)
#if advisor != "" { #if advisor != "" {
text(weight: "bold", "Darba vadītājs:\n") text(
weight: "bold",
"Darba vadītājs:\n",
)
advisor advisor
} }
]) ],
)
v(0.5fr) v(0.5fr)
align(center, align(
upper(text(date)) center,
upper(
text(date),
),
) )
/* Title page config end */ /* Title page config end */
// WARNING: removove before sending // WARNING: removove before sending
// todo_outline // todo_outline
/* --- Figure/Table conf start --- */ /* --- Figure/Table conf start --- */
show heading: i-figured.reset-counters show heading: i-figured.reset-counters
show figure: i-figured.show-figure.with(numbering: "1.1.") show figure: i-figured.show-figure.with(numbering: "1.1.")
@ -116,14 +139,25 @@
show figure.where(kind: "i-figured-table"): set block(breakable: true) show figure.where(kind: "i-figured-table"): set block(breakable: true)
show figure.where(kind: "i-figured-table"): set figure.caption(position: top) show figure.where(kind: "i-figured-table"): set figure.caption(position: top)
show figure: set par(justify: false) // disable justify for figures (tables) show figure: set par(justify: false) // disable justify for figures (tables)
show figure.caption: it => { show figure.caption: it => {
if it.kind == "i-figured-table" { if it.kind == "i-figured-table" {
align(end, emph(it.counter.display(it.numbering) + " tabula ") + text(weight: "bold", it.body)) align(
end,
emph(it.counter.display(it.numbering) + " tabula ") + text(
weight: "bold",
it.body,
),
)
} else if it.kind == "i-figured-image" { } else if it.kind == "i-figured-image" {
align(start, emph(it.counter.display(it.numbering) + " att. ") + text(weight: "bold", it.body)) align(
start,
emph(it.counter.display(it.numbering) + " att. ") + text(
weight: "bold",
it.body,
),
)
} else { } else {
it it
} }
@ -132,10 +166,14 @@
set ref(supplement: it => { }) // disable default reference suppliments set ref(supplement: it => { }) // disable default reference suppliments
/* --- Figure/Table conf end --- */ /* --- Figure/Table conf end --- */
set list(marker: ([•], [--], [\*], [·])) set list(marker: (
[•],
[--],
[\*],
[·],
))
set enum(numbering: "1aiA)") // TODO: make the same style as LaTeX: 1. | (a) | i. | A. set enum(numbering: "1aiA)") // TODO: make the same style as LaTeX: 1. | (a) | i. | A.
// Abstract // Abstract
include "abstract.typ" include "abstract.typ"
@ -146,11 +184,21 @@
} }
pagebreak() pagebreak()
outline(depth: 3, indent: 1cm, title: text(size: 14pt, "SATURS")) outline(
depth: 3,
indent: 1cm,
title: text(
size: 14pt,
"SATURS",
),
)
/* ToC config end */ /* ToC config end */
// Start page numering // Start page numering
set page(numbering: "1", number-align: center) set page(
numbering: "1",
number-align: center,
)
// Main bdy. // Main bdy.
body body

BIN
main.pdf

Binary file not shown.

635
main.typ

File diff suppressed because it is too large Load Diff

133
utils.typ
View File

@ -1,7 +1,9 @@
#import "@preview/tablex:0.0.6": tablex #import "@preview/tablex:0.0.6": tablex
#import "@preview/big-todo:0.2.0": todo as TODO #import "@preview/big-todo:0.2.0": todo as TODO
#let custom-block(item) = { #let custom-block(
item,
) = {
set align(start) set align(start)
block( block(
inset: 8pt, inset: 8pt,
@ -9,7 +11,7 @@
width: 100%, width: 100%,
spacing: 0pt, spacing: 0pt,
breakable: true, breakable: true,
item item,
) )
} }
@ -17,7 +19,7 @@
title: "", title: "",
titles: (), titles: (),
caption: "", caption: "",
..items ..items,
) = { ) = {
set par(first-line-indent: 0pt) set par(first-line-indent: 0pt)
figure( figure(
@ -34,65 +36,130 @@
}, },
[ [
#if titles.len() == 0 { #if titles.len() == 0 {
custom-block(text(weight: "bold", title)) custom-block(
text(
weight: "bold",
title,
),
)
} }
#for i in range(items.pos().len()) { #for i in range(
items.pos().len(),
) {
if titles.len() > 0 { if titles.len() > 0 {
custom-block(text(weight: "bold", titles.at(i))) custom-block(
text(
weight: "bold",
titles.at(i),
),
)
} }
custom-block(items.pos().at(i)) custom-block(
items.pos().at(i),
)
} }
] ],
) )
linebreak() linebreak()
} }
#let parameter-table(caption: "", ..items) = { #let parameter-table(
caption: "",
..items,
) = {
if caption == "" { if caption == "" {
caption = items.pos().first() caption = items.pos().first()
} }
longtable( longtable(
titles: ("Parametra nosaukums", "Parametra identifikators", "Parametra apraksts", "Parametra prasības", "Parametra piemērs (/-i)"), titles: (
"Parametra nosaukums",
"Parametra identifikators",
"Parametra apraksts",
"Parametra prasības",
"Parametra piemērs (/-i)",
),
caption: caption, caption: caption,
..items ..items,
) )
} }
#let procedure-table(caption: "", ..items) = { #let procedure-table(
caption: "",
..items,
) = {
if caption == "" { if caption == "" {
caption = items.pos().first() caption = items.pos().first()
} }
longtable( longtable(
titles: ("Procedūras nosaukums", "Procedūras identifikators", "Procedūras apraksts", "Ievade", "Apstrāde", "Izvade"), titles: (
"Procedūras nosaukums",
"Procedūras identifikators",
"Procedūras apraksts",
"Ievade",
"Apstrāde",
"Izvade",
),
caption: caption, caption: caption,
..items ..items,
) )
} }
#let function-table(caption: "", ..items) = { #let function-table(
caption: "",
..items,
) = {
if caption == "" { if caption == "" {
caption = items.pos().first() caption = items.pos().first()
} }
longtable( longtable(
titles: ("Funkcijas nosaukums", "Funkcijas identifikators", "Ievads", "Ievade", "Apstrāde", "Izvade", "Paziņojumi",), titles: (
"Funkcijas nosaukums",
"Funkcijas identifikators",
"Ievads",
"Ievade",
"Apstrāde",
"Izvade",
"Paziņojumi",
),
caption: caption, caption: caption,
..items ..items,
) )
} }
#let entity-table-row(..items) = { #let entity-table-row(
..items,
) = {
( (
items.pos().at(0), items.pos().at(0),
upper(raw(items.pos().at(1), block: false)), upper(
upper(raw(items.pos().at(2), block: false)), raw(
items.pos().at(3) items.pos().at(1),
block: false,
),
),
upper(
raw(
items.pos().at(2),
block: false,
),
),
items.pos().at(3),
) )
} }
#let entity-table(caption: "", id: (), ..items) = { #let entity-table(
caption: "",
id: (),
..items,
) = {
if id == () { if id == () {
id = ("id", "serial8", "primary key, not null", "Unikālais identifikators") id = (
"id",
"serial8",
"primary key, not null",
"Unikālais identifikators",
)
} }
figure( figure(
@ -109,15 +176,27 @@
..for i in range(items.pos().len(), step:4){ ..for i in range(items.pos().len(), step:4){
entity-table-row(..items.pos().slice(i, i+4)) entity-table-row(..items.pos().slice(i, i+4))
}, },
) ),
) )
} }
#let todo(..body) = { #let todo(
TODO(..body, inline: true, big_text: 14pt, small_text: 12pt) ..body,
) = {
TODO(
..body,
inline: true,
big_text: 14pt,
small_text: 12pt,
)
} }
#let hyperlink-source(author, title, link_str, date) = { #let hyperlink-source(
author,
title,
link_str,
date,
) = {
if link_str == "" { if link_str == "" {
[#author #title Aplūkots #date.display("[day].[month].[year]")] [#author #title Aplūkots #date.display("[day].[month].[year]")]
} else { } else {