\documentclass[DIV=13,%
               BCOR=0mm,%
               headinclude=false,%
               footinclude=false,open=any,%
               fontsize=10pt,%
               oneside,%
               paper=a5]%
               {scrbook}






\usepackage[noautomatic]{imakeidx}



\usepackage{microtype}
\usepackage{graphicx}
\usepackage{alltt}
\usepackage{verbatim}
\usepackage[shortlabels]{enumitem}
\usepackage{tabularx}
\usepackage[normalem]{ulem}
\def\hsout{\bgroup \ULdepth=-.55ex \ULset}
% https://tex.stackexchange.com/questions/22410/strikethrough-in-section-title
% Unclear if \protect \hsout is needed. Doesn't looks so
\DeclareRobustCommand{\sout}[1]{\texorpdfstring{\hsout{#1}}{#1}}
\usepackage{wrapfig}

% avoid breakage on multiple <br><br> and avoid the next [] to be eaten
\newcommand*{\forcelinebreak}{\strut\\*{}}

\newcommand*{\hairline}{%
  \bigskip%
  \noindent \hrulefill%
  \bigskip%
}

% reverse indentation for biblio and play

\newenvironment*{amusebiblio}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newenvironment*{amuseplay}{
  \leftskip=\parindent
  \parindent=-\parindent
  \smallskip
  \indent
}{\smallskip}

\newcommand*{\Slash}{\slash\hspace{0pt}}


% http://tex.stackexchange.com/questions/3033/forcing-linebreaks-in-url
\PassOptionsToPackage{hyphens}{url}\usepackage[hyperfootnotes=false,hidelinks,breaklinks=true]{hyperref}
\usepackage{bookmark}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont{texgyrepagella-regular.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]
\setmonofont{cmuntt.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmuntb.ttf,%
 BoldItalicFont=cmuntx.ttf,%
 ItalicFont=cmunit.ttf]
\setsansfont{cmunss.ttf}[Script=Latin,%
 Ligatures=TeX,%
 Scale=MatchLowercase,%
 Path=/usr/share/fonts/truetype/cmu/,%
 BoldFont=cmunsx.ttf,%
 BoldItalicFont=cmunso.ttf,%
 ItalicFont=cmunsi.ttf]
\newfontfamily\englishfont{texgyrepagella-regular.otf}[Script=Latin,%
 Ligatures=TeX,%
 Path=/usr/share/texmf/fonts/opentype/public/tex-gyre/,%
 BoldFont=texgyrepagella-bold.otf,%
 BoldItalicFont=texgyrepagella-bolditalic.otf,%
 ItalicFont=texgyrepagella-italic.otf]



\renewcommand*{\partpagestyle}{empty}


% global style

\pagestyle{plain}




\usepackage{indentfirst}

% remove the numbering
\setcounter{secnumdepth}{-2}

% remove labels from the captions
\renewcommand*{\captionformat}{}
\renewcommand*{\figureformat}{}
\renewcommand*{\tableformat}{}
\KOMAoption{captions}{belowfigure,nooneline}
\addtokomafont{caption}{\centering}







\deffootnote[3em]{0em}{4em}{\textsuperscript{\thefootnotemark}~}


\addtokomafont{disposition}{\rmfamily}
\addtokomafont{descriptionlabel}{\rmfamily}


\frenchspacing
% avoid vertical glue
\raggedbottom

% this will generate overfull boxes, so we need to set a tolerance
% \pretolerance=1000
% pretolerance is what is accepted for a paragraph without
% hyphenation, so it makes sense to be strict here and let the user
% accept tweak the tolerance instead.
\tolerance=200
% Additional tolerance for bad paragraphs only
\setlength{\emergencystretch}{30pt}

% (try to) forbid widows/orphans
\clubpenalty=10000
\widowpenalty=10000





% given that we said footinclude=false, this should be safe
\setlength{\footskip}{2\baselineskip}

\title{Offline editing via git}
\date{}
\author{}
\subtitle{}




% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={Offline editing via git},%
pdfauthor={},%
pdfsubject={},%
pdfkeywords={doc; howto}%
}


\begin{document}






  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge Offline editing via git\par}}%
  \vskip 1em
  
  \vskip 2em
  
  \vskip 1.5em



   
   \vfill



  
    \strut\par
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage



\tableofcontents
% start a new right-handed page

\cleardoublepage



\chapter{Editing}


Amusewiki fully supports offline editing. This document describes how
you can do it. It assumes you have some knowledge about how Git works.
The internet is full of tutorials and documentation on this matter.


The procedure depends if you can access the server where Amusewiki is
running with a system user, or if you need to use an external service
like GitLab, GitHub, etc.


The instructions can be found at \texttt{/console/git}, where you will find
the exact paths to use.

\section{System user with SSH access}


This is as simple as doing:


\begin{alltt}
git clone ssh://amusewiki.org/var/lib/amusewiki/shared/repo/amw.git
cd amw
git pull
\# edit, commit...
git push
\end{alltt}


The instance will pull the changes automatically.


Please ensure that your system user is member of the \texttt{amusewiki} group.

\section{Provide a remote reposity}


Create a public repository on GitLab, GitHub or similar services (or
on your own server).


Please initialized it empty, without any README,license, .gitignore or
similar.


Get the repository HTTPS URL, e.g. https:\Slash{}\Slash{}example.com\Slash{}git\Slash{}test and
add it using the form you can find on the \texttt{/console/git} page of you
Amusewiki instance. You can have one personal repository.


Now we are going to populate it and get it ready:


\begin{alltt}
git clone https://amusewiki.org/git/amw
cd amw
git remote rename origin web
\# Please replace the example URL in the next line with the real one with SSH protocol
git remote add origin git@example.com/git/test
git push -u origin master
git checkout -b upstream -t web/master
\end{alltt}


And the workflow is:


\begin{alltt}
git checkout upstream
git pull
git checkout master
git merge upstream
\# edit, commit...
git push
\end{alltt}


The tricky part is that you need to visit \texttt{/console/git} and press the
"fetch" button to pull the changes into the site. This doesn't happen
automatically.

\chapter{Naming convention in the archive tree}


Creating new pages while via git is fully supported, but you have to
pay attention to the naming convention, otherwise the texts will not
show up.


Anyway, the recommended way to create files and attachments, it's to
use the web interface, because the site is able to avoid conflicts and
it's supposed to know where to place files. Also, if you're importing,
you can use the HTML converter and save quite a few effort.


So the local editing is more useful for \emph{editing} rather than uploading
new texts. You could, e.g., import, add the images (with some
placeholders in the text), place a \texttt{\#DELETED wip} header line, commit,
and resume the editing locally.

\section{Filenames}


The maximum length is 95 characters in the range, ASCII letters and
digits only, separated by a single dash. No leading or trailing
dashes. The extension must be \texttt{.muse}. E.g. \texttt{my-new-page.muse}. The
filename is arbitrary and doesn't have to (even if it's recommended)
map to the real title set in the header via \#title.

\section{Directory}


Special page's files go in the \texttt{specials} directory, from the root of
the archive (1 level down).


E.g. \texttt{specials/index.muse}


Normal page's files go in a two level deep directory.


The top-level directory is a single character or digit, using the
\emph{first} character of the filename.


If the filename has is composed by more words (separated by a dash),
the target subdirectory will be the first character of the filename
and the first character of the second word of the filename. The
rationale for this is that usually you want URIs in the form
firstname-lastname-title, so there is an high chance to put all the
files from the same author in the same directory.


E.g., john-doe-the-title have to go into the \texttt{j/jd} directory, as
\texttt{j/jd/john-doe-the-title.muse}


If the filename has only one word, then the second character used for
the subdirectory will be the \emph{last} character of the filename. E.g.
\texttt{t/tg/testing.muse}


In all the files, the \texttt{\#title} header line is mandatory.

\section{Images}


Images belongs to the same directory as the corresponding text. You
need to use a \textbf{prefix} to make it clear to which subdirectory it
belongs, following the naming convention described in the previous
section.


E.g., a file attached to the normal page \texttt{my-test-file.muse} should
have a name like \texttt{m-t-image-1.png} or \texttt{my-test-whatever.png}. Only PNG
and JPG images should be attached.


E.g.:


\begin{alltt}
m/mt/my-test-file.muse
m/mt/my-test-image-1.png
m/mt/my-test-image-2.png
\end{alltt}


or, using the same scheme the web application is using:


\begin{alltt}
m/mt/my-test-file.muse
m/mt/m-t-image-1.png
m/mt/m-t-image-2.png
\end{alltt}


PDFs attached to the page (via \texttt{\#ATTACH filename.pdf} header), must be
placed into the \texttt{uploads} directory.







% begin final page

\clearpage



% new page for the colophon

\thispagestyle{empty}

\begin{center}





\bigskip
\includegraphics[width=0.25\textwidth]{logo-amw.pdf}
\bigskip

\end{center}

\strut

\vfill

\begin{center}




Offline editing via git






\bigskip



   

       

       

       

       

       
   



\bigskip
\textbf{amusewiki.org}


\end{center}

% end final page with colophon


\end{document}


% No format ID passed.



