2019-11-26 21:16:04 +00:00
|
|
|
|
2019-11-30 13:25:32 +00:00
|
|
|
variables:
|
|
|
|
HEADER: |
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en-US">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width\=device-width, initial-scale=1">
|
|
|
|
<meta name="author" content="The Tor Project, Inc.">
|
|
|
|
<title>torspec</title>
|
|
|
|
<link href="https://2019.www.torproject.org/css/master.min.css" rel="stylesheet">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="wrap"><div id="content"><div id="maincol">
|
|
|
|
FOOTER: "</div></div></div></body></html>"
|
|
|
|
|
2019-11-26 21:16:04 +00:00
|
|
|
pages:
|
|
|
|
image: debian:buster
|
|
|
|
script:
|
|
|
|
- apt-get update
|
|
|
|
- apt-get -qy install --no-install-recommends pandoc
|
|
|
|
- test -d public || mkdir public
|
2019-11-30 13:25:32 +00:00
|
|
|
- printf "${HEADER}<h1>%s</h1><ul>" $CI_PROJECT_PATH > public/index.html
|
2019-11-26 21:16:04 +00:00
|
|
|
- for f in *.txt; do
|
|
|
|
set -x;
|
|
|
|
name=`echo $f | sed s,\.txt$,,`;
|
|
|
|
md=${name}.md;
|
|
|
|
cat $f | sed --regexp-extended
|
|
|
|
-e '0,/^ +/{s/^ +/# /}'
|
|
|
|
-e 's/^ {1,3}([^ ])/\1/'
|
|
|
|
-e '/^[0-9]+\. +http/! s/^([0-9]+\. )/## \1/'
|
|
|
|
-e 's/^([0-9]+\.[0-9]+\. )/### \1/'
|
|
|
|
-e 's/^([0-9]+\.[0-9]+\.[0-9]+\. )/#### \1/'
|
|
|
|
-e 's/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\. )/##### \1/'
|
|
|
|
> $md;
|
|
|
|
printf "\n---\n\noriginal source\x3a [$f](https://gitweb.torproject.org/torspec.git/tree/$f)\n" >> $md;
|
|
|
|
title=`sed -En '0,/^# /s/^# (.*)/\1/p' $md`;
|
|
|
|
printf "<li><a href=\"${name}.html\"><tt>$name</tt>: $title</a></li>" >> public/index.html;
|
2019-11-30 13:25:32 +00:00
|
|
|
pandoc --from=markdown $md --output=${name}.html;
|
|
|
|
printf "$HEADER" > public/${name}.html;
|
|
|
|
cat ${name}.html >> public/${name}.html;
|
|
|
|
printf "$FOOTER" >> public/${name}.html;
|
2019-11-26 21:16:04 +00:00
|
|
|
mkdir public/$name;
|
|
|
|
cp public/${name}.html public/$name/index.html;
|
|
|
|
done
|
2019-11-30 13:25:32 +00:00
|
|
|
- printf "</ul>$FOOTER" >> public/index.html
|
2019-11-26 21:16:04 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
2021-12-22 08:06:03 +00:00
|
|
|
- main
|