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,24 +4,26 @@
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.
Spēlētāju ērtībai tiek nodrošināts tīmekļa vietnes formāts, kas ietver Spēlētāju ērtībai tiek nodrošināts tīmekļa vietnes formāts, kas ietver
norādījumus, informējot lietotāju par pieejamajām iespējām, un skaidrojumus, norādījumus, informējot lietotāju par pieejamajām iespējām, un skaidrojumus,
aprakstot spēles elementus un saskarni, ar mērķi atvieglot tās lietošanu. aprakstot spēles elementus un saskarni, ar mērķi atvieglot tās lietošanu.
Tirgus izpēte apliecina, ka ir pieejami vairāki, nepilnvērtīgi risinājumi. Tirgus izpēte apliecina, ka ir pieejami vairāki, nepilnvērtīgi risinājumi.
Programmatūras prasību specifikācija apraksta sistēmas pamatprasības un Programmatūras prasību specifikācija apraksta sistēmas pamatprasības un
papildus funkcionalitāti, tostarp lomu klāsta papildināšanu, spēles papildus funkcionalitāti, tostarp lomu klāsta papildināšanu, spēles
konfigurāciju izveidi, kā arī priviliģētu lietotāju (maksas lietotāju) izveidošanu, konfigurāciju izveidi, kā arī priviliģētu lietotāju (maksas lietotāju) izveidošanu,
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,
@ -29,35 +31,36 @@ programmatūras prasību specifikācija, lietotāju veidots saturs, abonements,
maksas lietotājs, maksājumu apstrādātāja lietojumprogrammas saskarni (API). maksas lietotājs, maksājumu apstrādātāja lietojumprogrammas saskarni (API).
#text( #text(
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([
The social role-playing game "Mafia" is widely known. It is available in
#indent-par([ various versions and formats, offering an unlimited number of configurations
The social role-playing game "Mafia" is widely known. It is available in and roles. For the convenience of players, the game is made as a web
various versions and formats, offering an unlimited number of configurations application that includes instructions, informing the user about available
and roles. For the convenience of players, the game is made as a web options, and explanations describing the game's elements and interface, to
application that includes instructions, informing the user about available improve user experience.
ptions, and explanations describing the game's elements and interface, to improve user experience. Market research confirms that several mediocre solutions are 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,10 +2,11 @@
#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: "",
faculty: "", faculty: "",
@ -13,27 +14,27 @@
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(
@ -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,78 +72,111 @@
[ [
#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(
} else { weight: "bold",
text(weight: "bold", "Darba autors:") "Darba autori:",
}\ )
} else {
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.")
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
} }
} }
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"
/* ToC config start */ /* ToC config start */
// Uppercase 1st level headings in ToC // Uppercase 1st level headings in ToC
show outline.entry.where(level: 1): it => { show outline.entry.where(level: 1): it => {
@ -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.

1769
main.typ

File diff suppressed because it is too large Load Diff

171
utils.typ
View File

@ -1,15 +1,17 @@
#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,
stroke: black, stroke: black,
width: 100%, width: 100%,
spacing: 0pt, spacing: 0pt,
breakable: true, breakable: true,
item item,
) )
} }
@ -17,84 +19,149 @@
title: "", title: "",
titles: (), titles: (),
caption: "", caption: "",
..items ..items,
) = { ) = {
set par(first-line-indent: 0pt) set par(first-line-indent: 0pt)
figure( figure(
gap: 1.5em, gap: 1.5em,
kind: table, kind: table,
caption: if caption != ""{ caption: if caption != "" {
caption caption
} else {
if titles.len() == 0 {
title
} else { } else {
if titles.len() == 0 { titles.first()
title }
} else { },
titles.first()
}
},
[ [
#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) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: ("Procedūras nosaukums", "Procedūras identifikators", "Procedūras apraksts", "Ievade", "Apstrāde", "Izvade"),
caption: caption,
..items
) )
} }
#let function-table(caption: "", ..items) = { #let procedure-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: (
"Procedūras nosaukums",
"Procedūras identifikators",
"Procedūras apraksts",
"Ievade",
"Apstrāde",
"Izvade",
),
caption: caption, caption: caption,
..items ..items,
)
}
#let function-table(
caption: "",
..items,
) = {
if caption == "" {
caption = items.pos().first()
}
longtable(
titles: (
"Funkcijas nosaukums",
"Funkcijas identifikators",
"Ievads",
"Ievade",
"Apstrāde",
"Izvade",
"Paziņojumi",
),
caption: caption,
..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(
caption: caption, caption: caption,
kind: table, kind: table,
@ -102,22 +169,34 @@
columns: (4cm, 3cm, auto, auto), columns: (4cm, 3cm, auto, auto),
repeat-header: true, repeat-header: true,
/* Header */ /* Header */
[*Lauks*], [*Datu tips*], [*Lauka atribūti*], [*Apraksts*], [*Lauks*], [*Datu tips*], [*Lauka atribūti*], [*Apraksts*],
..entity-table-row(..id), // id row ..entity-table-row(..id), // id row
..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 {