WikiViz | |
---|---|
founder: | sachy |
depends on: | |
interested: | |
software license: | CC |
hardware license: |
~~META: status = active &relation firstimage = :project:wikiviz:nahled.png ~~
WikiViz je automaticky generator brmlabich vizitek z projektu ktere jsou popsane tady na wiki. Napriklad BrmHistology a BioOSM uz kolujiā¦
WikiViz.sh je bashovy script, ktery stahne prehled projektu z wiki, vyparsuje URL nahledoveho obrazku a z URL projektu vygeneruje jeho QR kod.
Oba obrazky vlozi do templatu wikiviz_sample.tex a zkompiluje ho pomoci pdflatex do PDF (dvojity pruchod kvuli dynamickemu prepocitani velikosti nekterych elementu).
Predni strana je logo brmlabu s kontaktnimi informacemi.
#!/bin/bash # # Generator vizitek z brmlabi wiki # $1 = nazev projektu pro ktery se ma vizitka vygenerovat, pokud neni zadano, vygeneruji se vsechny # Zavislosti: pdflatex (+ amssymb, tikz, multicol, xcolor, calc, graphicx), wget # if [ "$1" = "WikiViz" ]; then echo "Too meta" exit fi wiki=$(wget https://brmlab.cz/project/start -O - 2>/dev/null | grep -e '^<div class="mosaicMain">.*$' | sed -e $"s/<\/a>/<\/a>\n/g") if [ "$1" != "" ]; then wiki=$(echo "$wiki" | grep "$1") fi while IFS='' read -r w || [[ -n "$w" ]]; do t=$(echo "$w" | grep -o -e ' title="[A-Za-z0-9_+ -]*">' | sed -e 's/ title="//g' -e 's/>//g' | tr -d '"') i=$(echo "$w" | grep -o -e 'background-image:url([^?]*' | sed -e 's/background-image:url(//g') u=$(echo "$w" | grep -o -e 'href="[^"]*' | cut -b 6- | tr -d '"') img=$(echo "$i" | grep -o -e '[^/]*$') url=$(echo "$u" | sed -e 's/\//%2F/g' -e 's/:/%3A/g') echo "$t $i $img $u" wget "$i" -O "$img" 2>/dev/null wget "https://api.qrserver.com/v1/create-qr-code/?data=$url&size=220x220&margin=10" -O ./qr.png 2>/dev/null cat ./wikiviz_sample.tex | sed -e "s/__LOGO__/$img/g" | sed -e "s/__PROJECT__/$t/g" > "./$t.tex" # Pustit dvakrat kvuli prepoctu velikosti pdflatex -synctex=1 -interaction=nonstopmode "./$t.tex" >/dev/null sleep 1 pdflatex -synctex=1 -interaction=nonstopmode "./$t.tex" >/dev/null #atril "./$t.pdf" done <<< "$wiki"
%\includegraphics[scale=1]{obrazek.png} %\tableofcontents %\newpage \documentclass[11pt]{article} %\usepackage{a4wide} \usepackage[paperwidth=90mm,paperheight=50mm,left=0in,right=0in,top=0in,bottom=0in]{geometry} \usepackage[utf8]{inputenc} %\usepackage[czech]{babel} \usepackage{url} \usepackage{graphicx} %\usepackage{indentfirst} \usepackage[none]{hyphenat} \usepackage{amssymb} %\usepackage{minted} %syntax hi; apt-get install python-pygments \usepackage{xcolor} %Coloring text \color{barva}{text} \usepackage{multicol} %\begin{multicols}{sloupce} \usepackage{tikz} \usetikzlibrary{calc} \newcommand{\placetextbox}[4][center]{% % [#1]: box anchor: center (default) | % south west | west | north west | north | % north east | east | south east | south | % mid west | mid | mid east | % base west | base | base east % #2: horizontal position (fraction of page width) % #3: vertical position (fraction of page height) % #4: content % \tikz[remember picture,overlay,x=\paperwidth,y=\paperheight]{% \node[anchor=#1,inner sep=0pt] at ($(current page.south west)+(#2,#3)$) {#4}; }% } \begin{document} $$\includegraphics[width=80mm]{./brmlab-contact-card.pdf}$$ \newpage \noindent\includegraphics[height=50mm]{__LOGO__} \placetextbox[north east]{0.975}{0.9}{\resizebox{20mm}{!}{\textit{Project}}} \placetextbox[center]{0.87}{0.75}{\resizebox{20mm}{!}{\textbf{__PROJECT__}}} \placetextbox[south east]{1}{0}{\includegraphics[width=22mm]{./qr.png}} \end{document}