slweb

Једноставни генератор статичких веб страна
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 03a4ff6e7ec1956b600560954ef76d513db2d476
родитељ 62730a5defeb06e7512b23597a4cc6337eb68e5e
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Thu,  3 Dec 2020 19:57:22 +0100

Added the [()]() form of links; changed space-newline-to-break into double-space-newline; updated documentation; logo.svg: New file

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
M.gitignore | 1-
MMakefile | 4++--
Mexamples/includes/examples.slw | 1-
Mexamples/includes/options.slw | 16++++++++--------
Mexamples/includes/reference.slw | 52++++++++++++++++++++++++++--------------------------
Mindex.html | 12++++++------
Mindex.slw | 11++++++-----
Alogo.svg | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mslweb.1.in | 28++++++++++++++++++++++++++--
Mslweb.in | 6+++++-
измењених датотека: 10, додавања: 190(+), брисања: 52(-)

diff --git a/.gitignore b/.gitignore @@ -7,7 +7,6 @@ *.ps *.swp nohup.out -*.png *.gz slweb slweb.1 diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ -SLWVERSION = v0.2.4-beta -SLWDATE = 1 Dec 2020 +SLWVERSION = v0.2.5-beta +SLWDATE = 3 Dec 2020 BINDIR = /usr/local/bin MANDIR = /usr/local/share/man/man1 BROWSER = surf diff --git a/examples/includes/examples.slw b/examples/includes/examples.slw @@ -43,4 +43,3 @@ file `index.html` contains: &lt;/body&gt; &lt;/html&gt; ``` - diff --git a/examples/includes/options.slw b/examples/includes/options.slw @@ -1,21 +1,21 @@ ## OPTIONS -**-b** -**--body-only** +**-b** +**--body-only** Only add the contents of the `&lt;body&gt;` tag, skipping `&lt;html&gt;` and `&lt;head&gt;`. -**-d** -**--basedir &lt;_directory_&gt;** +**-d** +**--basedir &lt;_directory_&gt;** Set the base directory as a reference point to normalize paths in local links (the argument to **--relative-to** option for the **realpath** (1) command). -**-h** -**--help** +**-h** +**--help** Print this usage information screen. -**-v** -**--version** +**-v** +**--version** Print program version and exit. diff --git a/examples/includes/reference.slw b/examples/includes/reference.slw @@ -3,72 +3,72 @@ Files processed by **slweb** are using a minimal subset of Markdown with added directives. Supported **Markdown features** are: -<ul> -<li> +{ul} +{li} **Paragraphs.** Text surrounded by newlines will be put inside `&lt;p&gt;&lt;/p&gt;` tags. -</li> -<li> +{/li} +{li} **Headings.** A line starting with `#` followed by space will be put inside `&lt;h?&gt;&lt;/h?&gt;`, where `?` stands for 1-4, depending on the number of hashtags. -</li> -<li> +{/li} +{li} **Bold/italic (limited).** Text inside `\*asterisks\*` or `\_underlines\_` will be put inside `&lt;em&gt;&lt;/em&gt;`. Text inside `\*\*double asterisks\*\*` will be put inside `&lt;strong&gt;&lt;/strong&gt;`. -</li> -<li> +{/li} +{li} **Backticks.** Text inside `\`backticks\`` will be put inside `&lt;code&gt;&lt;/code&gt;` (one per line, both backticks need to be on the same line). -</li> -<li> +{/li} +{li} **Links (limited).** The construct `\[A link](https://example.com)` will be converted into `&lt;a href="https://example.com"&gt;A link&lt;/a&gt;`. -</li> -<li> +{/li} +{li} **Line breaks.** Space followed by a newline will be turned into `&lt;br /&gt;`. -</li> -</ul> +{/li} +{/ul} **Directives** include: -<ul> -<li> +{ul} +{li} **Class divs.** Directive `\{.myclass}\{/.myclass}` will be transformed into `&lt;div class="myclass"&gt;&lt;/div&gt;`. -</li> -<li> +{/li} +{li} **Id divs.** Directive `\{#myid}\{/#myid}` will be transformed into `&lt;div id="myid"&gt;&lt;/div&gt;`. -</li> -<li> +{/li} +{li} **General tags.** Directive `\{sometag}\{/sometag}` will be transformed into `&lt;sometag&gt;&lt;/sometag&gt;`. -</li> -<li> +{/li} +{li} **Includes.** Directive `\{include "somefile"}` will run `slweb -b` on _somefile.slw_ (related to the directory containing the file containing the directive) and include the resulting {abbr}HTML{/abbr}. Directive needs to start at the beginning of the line. -</li> -<li> +{/li} +{li} **Brand &ldquo;watermark&rdquo;.** Directive `\{made-by}` is converted into a div containing the &ldquo;watermark&rdquo; text and a link to the **slweb** home page. -</li> -</ul> +{/li} +{/ul} diff --git a/index.html b/index.html @@ -3,7 +3,7 @@ <head> <title>slweb - Simple static website generator. </title> <meta charset="utf8" /> - <meta name="description" content="" /> + <meta name="description" content="Simple static website generator" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="generator" content="slweb" /> <link rel="stylesheet" href="index.css" /> @@ -18,8 +18,8 @@ <h2>Install</h2> <pre> -$ git clone https://github.com/Strahinja/slweb.git<br /> -$ cd slweb<br /> +$ git clone https://github.com/Strahinja/slweb.git +$ cd slweb $ make && sudo make install </pre> @@ -29,7 +29,7 @@ $ make && sudo make install <p>See the <code><a href="https://github.com/Strahinja/slweb/tree/master/examples">examples/</a></code> directory in this repository.</p> -<p>GIven the file <code>index.slw</code> in the current directory:</p> +<p>Given the file <code>index.slw</code> in the current directory:</p> <pre> site-name: Test website @@ -83,7 +83,7 @@ $ slweb index.slw > index.html <h2>License</h2> <p>slweb - Simple static website generator.<br /> -Copyright (C) 2020 Страхиња Радић </p> +Copyright (C) 2020 Страхиња Радић</p> <p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -99,7 +99,7 @@ this program. If not, see &lt;https://www.gnu.org/licenses/&gt;. </p> <div id="git-log"> Previous commit: -index.slw 254ad89 2020-11-24 13:02:50 +0100 (Страхиња Радић) +index.slw 62730a5 2020-12-01 09:36:56 +0100 (Страхиња Радић) (HEAD -> master, origin/master, origin/HEAD) </div><!--git-log--> diff --git a/index.slw b/index.slw @@ -1,4 +1,5 @@ site-name: slweb - Simple static website generator. +site-desc: Simple static website generator stylesheet: index.css --- {main} @@ -10,8 +11,8 @@ stylesheet: index.css ## Install ``` -$ git clone https://github.com/Strahinja/slweb.git -$ cd slweb +$ git clone https://github.com/Strahinja/slweb.git +$ cd slweb $ make && sudo make install ``` @@ -19,7 +20,7 @@ $ make && sudo make install See the `[examples/](https://github.com/Strahinja/slweb/tree/master/examples)` directory in this repository. -GIven the file `index.slw` in the current directory: +Given the file `index.slw` in the current directory: ``` site-name: Test website @@ -66,8 +67,8 @@ file `index.html` contains: ## License -slweb - Simple static website generator. -Copyright (C) 2020 Страхиња Радић +slweb - Simple static website generator. +Copyright (C) 2020 Страхиња Радић This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/logo.svg b/logo.svg @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="210mm" + height="148mm" + viewBox="0 0 210 148" + version="1.1" + id="svg8" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" + sodipodi:docname="slweb-opt.svg"> + <title + id="title986">slweb logo</title> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.49497475" + inkscape:cx="425.71429" + inkscape:cy="309.80416" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + inkscape:document-rotation="0" + showgrid="false" + inkscape:window-width="1024" + inkscape:window-height="752" + inkscape:window-x="0" + inkscape:window-y="16" + inkscape:window-maximized="0"> + <sodipodi:guide + position="0,148" + orientation="0,793.70079" + id="guide855" /> + <sodipodi:guide + position="210,148" + orientation="559.37008,0" + id="guide857" /> + <sodipodi:guide + position="210,0" + orientation="0,-793.70079" + id="guide859" /> + <sodipodi:guide + position="0,0" + orientation="-559.37008,0" + id="guide861" /> + </sodipodi:namedview> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>slweb logo</dc:title> + <cc:license + rdf:resource="http://creativecommons.org/licenses/by/4.0/" /> + <dc:date>1.12.2020.</dc:date> + <dc:creator> + <cc:Agent> + <dc:title>Страхиња Радић</dc:title> + </cc:Agent> + </dc:creator> + <dc:rights> + <cc:Agent> + <dc:title>Copyright (c) 2020 Страхиња Радић (Strahinya Radich)</dc:title> + </cc:Agent> + </dc:rights> + </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/licenses/by/4.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:requires + rdf:resource="http://creativecommons.org/ns#Notice" /> + <cc:requires + rdf:resource="http://creativecommons.org/ns#Attribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + </cc:License> + </rdf:RDF> + </metadata> + <g + inkscape:label="Слој 1" + inkscape:groupmode="layer" + id="layer1"> + <text + xml:space="preserve" + style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:68.8717px;line-height:1.25;font-family:'Noto Serif';-inkscape-font-specification:'Noto Serif, Bold Italic';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;stroke-width:0.100886" + x="8.4366179" + y="96.85498" + id="text12"><tspan + sodipodi:role="line" + id="tspan10" + x="8.4366179" + y="96.85498" + style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:68.8717px;font-family:'Noto Serif';-inkscape-font-specification:'Noto Serif, Bold Italic';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000055;fill-opacity:1;stroke-width:0.100886">slweb</tspan></text> + </g> +</svg> diff --git a/slweb.1.in b/slweb.1.in @@ -99,10 +99,28 @@ prepends the body of a macro .I somemacro into the \fC<a></a>\fR tag. See .BR Macros . + +Also, the form \fC[(Link title)](http://asite.com)\fR will surround the link +title (text between \fC<a></a>\fR tags) with \fC<span></span>\fR, like so: +.EX +.in +4 +<a href="http://asite.com"><span>Link title</span></a> +.EE +.in -4 +This allows for separate styling of link text. It can be combined with the +macro-form: +.EX +.in +4 +[=somemacro (Link title)](http://asite.com) +.EE +.in -4 +It will prepend the body of a macro +.I somemacro +outside of the \fC<span></span>\fR. . .IP \[bu] .BR "Line breaks" . -Space followed by a newline will be turned into \fC<br />\fR. +Two spaces followed by a newline will be turned into \fC<br />\fR. . .PP .BR "Directives " include: @@ -177,10 +195,16 @@ tags. . .IP \[bu] 4 .BR site-desc . -Ths contents of this variable will be inserted as the value of the +The contents of this variable will be inserted as the value of the .I content attribute of the \fC<meta name="description">\fR tag. . +.IP \[bu] 4 +.BR stylesheet . +The contents of this variable will be treated as a +.sm CSS +file name to be included using the \fC<link rel="stylesheet" />\fR tag. +. .SH "SEE ALSO" .BR sed (1) . diff --git a/slweb.in b/slweb.in @@ -147,12 +147,16 @@ function body() -e 's/^{\/#\([a-z0-9-]\+\)}/<\/div><!--#\1-->/g' \ -e 's/\([^\\]\){\/#\([a-z0-9-]\+\)}/\1<\/div><!--#\2-->/g' \ -e 's/\\\({\/#[a-z0-9-]\+}\)/\1/g' \ - -e 's/ $/<br \/>/g' \ + -e 's/ $/<br \/>/g' \ -e "s/^\\[=\\(\\S\\+\\) \\([^]]\\+\\)\\](\\([a-z]\+:\/\/[^)]\\+\\))/<a href=\"\\3\">\\{=\\1\\}\\2<\\/a>/g" \ -e "s/\\([^\\\\]\\)\\[=\\(\\S\\+\\) \\([^]]\\+\\)\\](\\([a-z]\+:\/\/[^)]\\+\\))/\\1<a href=\"\\4\">\\{=\\2\\}\\3<\\/a>/g" \ -e "s/^\\[\\([^]]\\+\\)\\](\\([a-z]\+:\/\/[^)]\\+\\))/<a href=\"\\2\">\\1<\\/a>/g" \ -e "s/\\([^\\\\]\\)\\[\\([^]]\\+\\)\\](\\([a-z]\+:\/\/[^)]\\+\\))/\\1<a href=\"\\3\">\\2<\\/a>/g" \ -e 's/\\\(\[[^]]\+\]([a-z]\+:\/\/[^)]\+)\)/\1/g' \ + -e "s/^\\[=\\(\\S\\+\\) (\\([^]]\\+\\))\\](\\([^)]\\+\\))/<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\3\">\\{=\\1\\}<span>\\2<\\/span><\\/a>/g" \ + -e "s/\\([^\\\\]\\)\\[=\\(\\S\\+\\) (\\([^]]\\+\\))\\](\\([^)]\\+\\))/\\1<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\4\">\\{=\\2\\}<span>\\3<\\/span><\\/a>/g" \ + -e "s/^\\[(\\([^]]\\+\\))\\](\\([^)]\\+\\))/<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\2\"><span>\\1<\\/span><\\/a>/g" \ + -e "s/\\([^\\\\]\\)\\[(\\([^]]\\+\\))\\](\\([^)]\\+\\))/\\1<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\3\"><span>\\2<\\/span><\\/a>/g" \ -e "s/^\\[=\\(\\S\\+\\) \\([^]]\\+\\)\\](\\([^)]\\+\\))/<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\3\">\\{=\\1\\}\\2<\\/a>/g" \ -e "s/\\([^\\\\]\\)\\[=\\(\\S\\+\\) \\([^]]\\+\\)\\](\\([^)]\\+\\))/\\1<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\4\">\\{=\\2\\}\\3<\\/a>/g" \ -e "s/^\\[\\([^]]\\+\\)\\](\\([^)]\\+\\))/<a href=\"$(realpath --relative-to=$BASEDIR $(dirname $INFILE) | sed -e's/\//\\\//g' -e's/&/\\\&/g')\/\\2\">\\1<\\/a>/g" \