Skip to content

Commit

Permalink
Merge branch 'doc'
Browse files Browse the repository at this point in the history
  • Loading branch information
RKrahl committed Dec 7, 2021
2 parents 58337df + 053b17a commit 570e2ad
Show file tree
Hide file tree
Showing 9 changed files with 950 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.meta.tex
/schema.aux
/schema.bbl
/schema.blg
/schema.log
/schema.out
/schema.pdf
/schema.toc
82 changes: 82 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#=========================================================================
# Builders and flags:

BIBTEX = bibtex
PDFLATEX = pdflatex
EPSTOPDF = epstopdf
INKSCAPE = inkscape --without-gui

RM = rm -f
MV = mv


#=========================================================================
# Files:

SRCS = schema

LOGFILES = $(addsuffix .log, $(SRCS)) $(addsuffix .blg, $(SRCS)) \
$(addsuffix .out, $(SRCS)) $(addsuffix .snm, $(SRCS))
AUXFILES = $(addsuffix .aux, $(SRCS)) $(addsuffix .bbl, $(SRCS)) \
$(addsuffix .vrb, $(SRCS)) $(addsuffix .toc, $(SRCS)) \
$(addsuffix .nav, $(SRCS))
RESFILES = $(addsuffix .pdf, $(SRCS))

BIBFILES = schema.bib

#=========================================================================
# Maintargets:

# default target
all: $(RESFILES)

# clean: Remove temporary files
clean:
$(RM) $(LOGFILES)

# realclean: Remove all intermediate files
realclean:
$(RM) $(AUXFILES) .meta.tex $(LOGFILES)

# distclean: Remove all automatically created files
distclean:
$(RM) $(RESFILES) $(AUXFILES) .meta.tex $(LOGFILES) $(PDFIMGS)

# metafile: Create a file containing some metadata such as version and date
metafile:
python3 meta.py > .meta.tex

# Tell make, that the main targets are not actually files, that should
# considered to be build:
.PHONY: all clean realclean distclean metafile


#=========================================================================
# Implicit rules:

.SUFFIXES:
.SUFFIXES: .tex .pdf .eps .svg .dot

%.bbl: %.tex
$(PDFLATEX) $*
$(BIBTEX) $*

%.pdf: %.tex
while true; do \
$(PDFLATEX) $*; \
grep -s 'Rerun to get .* right' $*.log || break; \
done

%.pdf: %.eps
$(EPSTOPDF) $<

%.eps: %.svg
$(INKSCAPE) --export-eps=$@ $<

%.svg: %.gv
dot -Tsvg -o $@ $<


#=========================================================================
# Dependencies:
schema.pdf: metafile schema.tex
Binary file added doc/cc-by.pdf
Binary file not shown.
48 changes: 48 additions & 0 deletions doc/meta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#! /usr/bin/python3

import datetime
import os
from pathlib import Path
import subprocess

class GitProps:
"""Determine properties of the git repository.
"""

def __init__(self, root="."):
self.root = Path(root).resolve()

def _exec(self, cmd):
proc = subprocess.run(cmd.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=self.root,
check=True,
env=dict(os.environ, LC_ALL='C'),
universal_newlines=True)
return proc.stdout.strip()

@property
def is_dirty(self):
return bool(self._exec("git status --porcelain --untracked-files=no"))

@property
def date(self):
if self.is_dirty:
d = datetime.date.today()
else:
ts = int(self._exec("git log -1 --format=%cd --date=unix"))
d = datetime.date.fromtimestamp(ts)
return d.strftime("%e %B %Y").strip()

@property
def version(self):
return self._exec("git describe --always --dirty").strip()

def main():
git = GitProps()
print("\\newcommand{\\schemaversion}{%s}" % git.version)
print("\\newcommand{\\schemadate}{%s}" % git.date)

if __name__ == "__main__":
main()
Binary file added doc/pidinst-logo.pdf
Binary file not shown.
54 changes: 54 additions & 0 deletions doc/pidinsttitle.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
\ProvidesPackage{pidinsttitle}[2021/11/09 customized title page]
\RequirePackage{graphicx}
\RequirePackage{url}

\renewcommand*{\@titlehead}{%
\includegraphics[height=15ex]{rda-logo}%
\hfill%
\includegraphics[height=15ex]{pidinst-logo}%
}

\newcommand*{\@titlefoot}{%
\hfill%
\href{https://creativecommons.org/licenses/by/4.0/}{\includegraphics[height=3ex]{cc-by}}%
}%
\newcommand{\titlefoot}[1]{\gdef\@titlefoot{%
#1%
}}%

\renewcommand\maketitle{%
\begin{titlepage}
\setcounter{page}{1}%
\ifx\@titlehead\@empty \else
\begin{minipage}[t]{\textwidth}%
\usekomafont{titlehead}{\@titlehead\par}%
\end{minipage}\par
\fi
\null\vfill
\begin{center}
{\usekomafont{title}{\huge \@title\par}}%
\vskip 1em
{\ifx\@subtitle\@empty\else\usekomafont{subtitle}{\@subtitle\par}\fi}%
\vskip 2em
{%
\usekomafont{author}{%
\lineskip 0.75em
\begin{tabular}[t]{c}
\@author
\end{tabular}\par
}%
}%
\vskip 1.5em
{\usekomafont{date}{\@date \par}}%
\vskip \z@ \@plus3fill
{\usekomafont{publishers}{\@publishers \par}}%
\vskip 3em
\end{center}\par
\vfill
\ifx\@titlefoot\@empty \else
\begin{minipage}[t]{\textwidth}%
\usekomafont{titlehead}{\@titlefoot\par}%
\end{minipage}\par
\fi
\end{titlepage}
}%
Binary file added doc/rda-logo.pdf
Binary file not shown.
31 changes: 31 additions & 0 deletions doc/schema.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@Misc{pidinst:github,
author = {RDA Persistent Identification of Instruments WG},
title = {Medadata Schema for the
Persistent Identification of Scientific Instruments},
note = {Code repository},
url = {https://github.com/rdawg-pidinst/schema}
}

@Article{pidinst2020,
author = {Stocker, Markus and Darroch, Louise and Krahl, Rolf
and Habermann, Ted and Devaraju, Anusuriya and
Schwardmann, Ulrich and D'Onofrio, Claudio and
Häggström, Ingemar},
title = {Persistent Identification of Instruments},
journal = {Data Science Journal},
year = 2020,
volume = 19,
number = 1,
pages = 18,
doi = {10.5334/dsj-2020-018}
}

@Misc{datacite:schema,
author = {DataCite Metadata Working Group},
title = {DataCite Metadata Schema Documentation for the
Publication and Citation of Research Data and Other
Research Outputs v4.4},
month = mar,
year = 2021,
doi = {10.14454/3W3Z-SA82}
}
Loading

0 comments on commit 570e2ad

Please sign in to comment.