Commit 7a8d58bf authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Prépare au passage à gulp.

No related merge requests found
Showing with 6540 additions and 202 deletions
+6540 -202
/plz-out /node_modules
/.plz-cache
.please-build:
tags: [docker]
image: ubuntu
variables:
PLEASE_VERSION: "14.3.5"
before_script:
- apt-get update -yqq >/dev/null
- apt-get install -yqq curl wget >/dev/null
- curl -sSL https://github.com/thought-machine/please/releases/download/v${PLEASE_VERSION}/please_${PLEASE_VERSION}_linux_amd64.tar.gz | tar xz -C /usr/local/bin --strip-components=1
script:
- please build --noupdate -p :${CI_JOB_NAME}
cache:
key: "plz-cache-$CI_COMMIT_REF_SLUG"
paths:
- .plz-cache
[please]
version = 14.3.5
[cache]
dir=.plz-cache
This diff is collapsed.
package.json 0 → 100644
{
"name": "@irstea/reveal.js",
"version": "1.0.0",
"description": "Customized reveal.js.",
"main": "index.js",
"directories": {
"lib": "lib"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "gitlab-ssh.irstea.fr:pole-is/tools/reveal.js"
},
"keywords": [
"reveal.js",
"irstea",
"inrae"
],
"author": "Guillaume Perréal <guillaume.perreal@inrae.fr>",
"license": "MIT",
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"esm": "^3.2.25",
"gulp": "^4.0.2",
"gulp-sass": "^4.1.0",
"gulp-terser": "^1.2.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.2",
"prettier": "^2.0.5",
"reveal.js": "^3.9.2"
}
}
#!/usr/bin/env bash
set -u
RED="\x1B[31m"
GREEN="\x1B[32m"
YELLOW="\x1B[33m"
RESET="\x1B[0m"
DEFAULT_URL_BASE="https://get.please.build"
# We might already have it downloaded...
LOCATION=`grep -i "^location" .plzconfig | cut -d '=' -f 2 | tr -d ' '`
if [ -z "$LOCATION" ]; then
if [ -z "$HOME" ]; then
echo -e "${RED}\$HOME not set, not sure where to look for Please.${RESET}"
exit 1
fi
LOCATION="${HOME}/.please"
fi
# If this exists at any version, let it handle any update.
TARGET="${LOCATION}/please"
if [ -f "$TARGET" ]; then
exec "$TARGET" $@
fi
URL_BASE="`grep -i "^downloadlocation" .plzconfig | cut -d '=' -f 2 | tr -d ' '`"
if [ -z "$URL_BASE" ]; then
URL_BASE=$DEFAULT_URL_BASE
fi
URL_BASE="${URL_BASE%/}"
VERSION="`grep -i "^version[^a-z]" .plzconfig`"
VERSION="${VERSION#*=}" # Strip until after first =
VERSION="${VERSION/ /}" # Remove all spaces
VERSION="${VERSION#>=}" # Strip any initial >=
if [ -z "$VERSION" ]; then
echo -e "${YELLOW}Can't determine version, will use latest.${RESET}"
VERSION=`curl -fsSL ${URL_BASE}/latest_version`
fi
# Find the os / arch to download. You can do this quite nicely with go env
# but we use this script on machines that don't necessarily have Go itself.
OS=`uname`
if [ "$OS" = "Linux" ]; then
GOOS="linux"
elif [ "$OS" = "Darwin" ]; then
GOOS="darwin"
else
echo -e "${RED}Unknown operating system $OS${RESET}"
exit 1
fi
# Don't have any builds other than amd64 at the moment.
ARCH="amd64"
PLEASE_URL="${URL_BASE}/${GOOS}_${ARCH}/${VERSION}/please_${VERSION}.tar.xz"
DIR="${LOCATION}/${VERSION}"
# Potentially we could reuse this but it's easier not to really.
if [ ! -d "$DIR" ]; then
rm -rf "$DIR"
fi
echo -e "${GREEN}Downloading Please ${VERSION} to ${DIR}...${RESET}"
mkdir -p "$DIR"
curl -fsSL "${PLEASE_URL}" | tar -xJpf- --strip-components=1 -C "$DIR"
# Link it all back up a dir
for x in `ls "$DIR"`; do
ln -sf "${DIR}/${x}" "$LOCATION"
done
ln -sf "${DIR}/please" "${LOCATION}/plz"
echo -e "${GREEN}Should be good to go now, running plz...${RESET}"
exec "$TARGET" $@
REVEALJS_DEFAULT_CONFIG = {
"width": "1024",
"height": "768",
"history": "true",
"navigationMode": "linear",
"fragmentInURL": "true",
"theme": "inrae",
"slideNumber": "true",
}
def pandoc(name: str, src: str, out: str = None, toc: bool = True, toc_depth: int = 1, slide_level: int = 2, variables: dict = {}, pandoc_args: list = [], visibility: list = None):
"""Use pandoc to generate a reveal.hs index.html from a markdown file.
Args:
name (str): target name.
src (str): markdown source.
out (str): html output.
toc (bool): pandoc --toc option.
toc_depth (int): pandoc --toc_depth option.
slide_level (int): pandoc --slide_level option.
variables (dict): defines variables for pandoc templates.
pandoc_args (list): supplementary arguments to pass to pandoc.
visibility (list): visilibity of the generated target.
"""
if out is None:
out = src.replace('.md', '.html')
args = [
"$TOOL",
"$SRC",
"--output=$OUT",
"--from=markdown+backtick_code_blocks+pandoc_title_block+yaml_metadata_block",
"--to=revealjs",
"--standalone",
"--slide-level=%d" % slide_level,
]
if toc:
args.append("--toc")
args.append("--toc-depth=%d" % toc_depth)
vars = REVEALJS_DEFAULT_CONFIG.copy()
for k,v in variables.items():
vars[k] = str(v)
args = args + ["--variable=%s:%s" % v for v in vars.items()] + pandoc_args
return genrule(
name = name,
cmd = " ".join(args),
srcs = [src],
outs = [out],
tools = ["///tools/pandoc//:bin"],
visibility = visibility,
)
def presentation(directory: str, slides: str = 'index.md', toc: bool = True, toc_depth: int = 1, slide_level: int = 2, variables: dict = {}, pandoc_args: list = [], visibility: list = None):
"""Generate a presentation from a directory.
Args:
directory (str): path to the directory containing
slides (str): name of the files containing the slides in Markdown format.
toc (bool): see pandoc option.
toc_depth (int): see pandoc option.
slide_level (int): see pandoc option.
variables (dict): see pandoc option.
pandoc_args (list): see pandoc option.
visibility (list): visilibity of the generated targets
"""
name = directory.replace('/', '_')
provides = {
'index': pandoc(
name = '%s#index' % name,
src = "%s/%s" % (directory, slides),
out = "%s/index.html" % directory,
toc = toc,
toc_depth = toc_depth,
slide_level = slide_level,
variables = variables,
pandoc_args = pandoc_args,
visibility = visibility
),
}
static_files = glob(["%s/**" % directory], exclude = [slides])
if static_files:
provides['static'] = filegroup(
name = '%s#static' % name,
srcs = static_files,
visibility = visibility
)
return filegroup(
name = name,
deps = provides.values(),
provides = provides,
visibility = visibility
)
REVEALJS_VERSION = "v1.0.0"
http_archive(
name = "reveal.js",
urls = ["https://gitlab.irstea.fr/pole-is/tools/reveal.js/-/archive/%s/reveal.js-%s.zip" % (REVEALJS_VERSION, REVEALJS_VERSION)],
strip_prefix = "reveal.js-%s" % REVEALJS_VERSION,
)
subinclude("///reveal.js//:rules")
presentation("ma_presentation")
File moved
File moved
File moved
File moved
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment