Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-presentation.awk
diff options
context:
space:
mode:
Commit0187e255a811bebb0dad3624f2c6d78b829d15c5 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Files68efd3520e72c8c8c553fdda7b9391d9ec4e9feb /generate-hooks/create-presentation.awk
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar.gz
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.zip
Parentda000c477625bb533688df84bd95ba3a3aff3246 (diff)
[awk] Reworked generation to happen via a combined script, updated scripts and added info in scripts readme
1 files changed, 0 insertions, 145 deletions
-rw-r--r--generate-hooks/create-presentation.awk145
diff --git a/generate-hooks/create-presentation.awk b/generate-hooks/create-presentation.awk
deleted file mode 100644
index 3912b34..0000000
--- a/generate-hooks/create-presentation.awk
+++ /dev/null
@@ -1,145 +0,0 @@
-#
-# == About ==
-#
-# This is my way of making slide-based presentations. In short, it just groups
-# Markdown formatting into rectangles and adds options for layout formatting.
-# Each slide is the size of a landscape-oriented A4 sheet of paper. Light/dark
-# mode settings are respected (of course).
-# Currently, this appliest only to pages under the "talks" folder.
-
-#
-# == ftags ==
-#
-# &&presentation Must appear before any other presentation ftags.
-# It "loads" everything necessary for a presentation, that being
-# the navigation bar and logic script (which also inserts the
-# custom stylesheet).
-# Can be only one per page. Also refer to -- Surroundings --
-#
-# &&slide Everything below this tag is part of a slide. Each slide is
-# presented in the order it appears in.
-# &&/slide Ends (the last started) slide.
-#
-# &&frow A row of paragraphs, where each item is evenly sized and is
-# spaced out horizontally. In the HTML, it is a simple flexbox.
-# This is one of the two main ways to configure how content is
-# laid out on a slide.
-# &&/frow Every HTML element/paragraph between &&frow and &&/frow is an
-# item that will be laid out.
-#
-# &&fcol A column of paragraphs, where each item is evenly sized and is
-# spaced out vertically. In the HTML, it is a simple flexbox.
-# This is one of the two main ways to configure how content is
-# laid out on a slide.
-# &&/fcol Every HTML element/paragraph between &&fcol and &&/fcol is an
-# item that will be laid out.
-#
-# &&flexer An empty container, which can be used as a blank space item
-# inside &&frow or &&fcol. In the styling, it just has `flex: 1`.
-#
-# &&centered Aligns text to the center, literally.
-# &&/centered Text between &&centered and &&/centered is aligned.
-#
-# &&fright Aligns element and the text inside to the right. In the styling,
-# it just has text-align and float set to right.
-# &&/fright Text between &&fright and &&/fright is aligned to the right
-#
-# &&fontSIZE Changes to font size to SIZE, in pixels. Default size is 24px.
-# Available values for SIZE: 18, 20, 27, 30, 37
-# &&/font Text between &&fontSIZE and &&/font is sized accordingly
-#
-# -- Surroundings --
-#
-# As stated, there can only be one presentation per page.
-# Everything that is around a presentation and it's slides is normally hidden
-# during presenting mode, but will show up if you try to print the presentation.
-# Exceptions to this rule are headings and paragraphs, which won't show up in
-# presenting mode or during print.
-#
-# -- Placement/Flow --
-#
-# All ftags can be placed on their own line, or in a line with other ftags.
-# The only requirement is that such a line must start with an ftag, ftags in the
-# middle of text aren't recognized.
-#
-# -- Example Usage --
-#
-# Refer to src/talks/demo.md
-
-BEGIN {
- if (substr(ARGV[1], "talks") == 0) exit # FILENAME isn't available yet
-
- # Exceptions to the normal format
- names[ 1] = "presentation"
- ended[ 1] = 0
- names[ 2] = "&#47;font" # all font ftags can be closed with a &&/font
- ended[ 2] = 0
-
- names[ 3] = "slide"
- ended[ 3] = 1
- names[ 4] = "centered"
- ended[ 4] = 1
- names[ 5] = "flexer"
- ended[ 5] = 2
- names[ 6] = "frow"
- ended[ 6] = 1
- names[ 7] = "fcol"
- ended[ 7] = 1
- names[ 8] = "font18"
- ended[ 8] = 0
- names[ 9] = "font20"
- ended[ 9] = 0
- names[10] = "font27"
- ended[10] = 0
- names[11] = "font30"
- ended[11] = 0
- names[12] = "font35"
- ended[12] = 0
- names[13] = "fright"
- ended[13] = 1
-
- pres = ORS \
-"<nav id=\"presentCont\">" ORS \
-" <img id=\"prevSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-left-tabler.svg\" alt=\"Previous\">" ORS \
-" <img id=\"nextSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-right-tabler.svg\" alt=\"Next\">" ORS \
-" <img id=\"presentBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/presentation-tabler.svg\" alt=\"Present\">" ORS \
-" <img id=\"printBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/printer-tabler.svg\" alt=\"Print\">" ORS \
-" </nav>" ORS \
-" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" integrity=\"sha512-5u+Yy4xqrGKYXeUrzgaXXj7dqNtFUnlaPtfz86v9nT+l8osWfLnjLOU/vRv2Hmx7wsmCdb3pfurH0/hQHLQOSA==\" crossorigin=\"anonymous\"></script>"
-
- pat[1] = "&#38;&#38;presentation"
- rep[1] = pres
- pat[2] = "&#38;&#38;&#47;font"
- rep[2] = "</div>"
-
- for (i = 3; i <= length(names); i++) {
- pat[i] = "&#38;&#38;" names[i]
- rep[i] = "<div class=\"" names[i] "\">"
-
- if (ended[i] == 1) {
- cpat[i] = "&#38;&#38;&#47;" names[i]
- crep[i] = "</div>"
- }
- else if (ended[i] == 2) {
- rep[i] = rep[i] "</div>"
- }
- }
-}
-
-function substitute(ind) {
- gsub(/(<p>|<\/p>)/, "")
- gsub(pat[ind], rep[ind])
- if (ended[ind] == 1)
- gsub(cpat[ind], crep[ind])
-}
-
-/^[ \t]*(<p>|)&#38;&#38;/ {
- for (i = 1; i <= length(names); i++) {
- if (index($0, names[i]) != 0)
- substitute(i)
- }
-}
-
-{
- print
-}