\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{AmuseWiki: a library oriented wiki engine (talk)}
\date{September 3, 2015, Granada}
\author{Marco Pessotto (melmothX)}
\subtitle{}




% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={AmuseWiki: a library oriented wiki engine (talk)},%
pdfauthor={Marco Pessotto},%
pdfsubject={},%
pdfkeywords={}%
}


\begin{document}






  \begin{titlepage}


  \strut\vskip 2em
  \begin{center}

  {\usekomafont{title}{\huge AmuseWiki: a library oriented wiki engine (talk)\par}}%
  \vskip 1em
  
  \vskip 2em
  
  {\usekomafont{author}{Marco Pessotto (melmothX)\par}}%
  
  \vskip 1.5em



   
   \vfill



  
  {\usekomafont{date}{September 3, 2015, Granada\par}}%
  


  \end{center}


     \end{titlepage}
     
     \cleardoublepage



\tableofcontents
% start a new right-handed page

\cleardoublepage



\section{How does it look like?}


\begin{figure}[htbp!]
\centering
\includegraphics[keepaspectratio=true,height=0.75\textheight,width=0.70\textwidth]{s-s-screenshot.png}
\end{figure}

\section{Scenario}


\begin{itemize}
\item\relax 
Digital library with more than 2000 texts, including full-length books



\item\relax 
Long term archiving (not fire and forget texts), control revision



\item\relax 
Quality output required (read: LaTeX output)



\item\relax 
Imposing of PDF for home-printing



\item\relax 
EPUB output for mobile devices



\item\relax 
Preference for a flat file storage (like ikiwiki or MoinMoin)



\item\relax 
Creation of collections (like on mediawiki)



\item\relax 
One-man project




\end{itemize}
\section{The lightweight markup}


\begin{itemize}
\item\relax 
No standard, even if Markdown seems to be the winner (but with dialects)



\item\relax 
Emacs Muse: project kind of dead, but the markup is compact and
expressive, documented, and has a reference implementation.
\href{https://www.gnu.org/software/emacs-muse/}{\texttt{https://www.gnu.org/software/emacs-muse/}}



\item\relax 
Some incompatibilities have been introduced, but they are
documented (to address corner cases where the syntax can be
confusing).



\item\relax 
Bottom line: all these markups are easy to use and it takes 5
minutes to learn one of them, as long as it is documented.




\end{itemize}
\section{Our own dialect of Emacs Muse}


\begin{itemize}
\item\relax 
Manual: \href{http://www.amusewiki.org/library/manual}{\texttt{http://www.amusewiki.org/library/manual}}



\item\relax 
Module: \href{https://metacpan.org/pod/Text::Amuse}{\texttt{Text::Amuse}} (produces LaTeX and HTML)



\item\relax 
Ill-suited for technical papers, though. No math support, no syntax
highlight, but well-suited for general prose and even poetry.



\item\relax 
It has every feature one could expect from a lightweight markup:
images, sectioning, footnotes, simple tables, bold, italics,
subscript, superscript, lists, verbatim, quotations.



\item\relax 
So far proved itself good and expressive.




\end{itemize}
\section{Importing}


\begin{itemize}
\item\relax 
Legacy library had the texts in filtered HTML



\item\relax 
People usually have the texts in Word format or copy and paste from
HTML pages



\item\relax 
The javascript HTML editor \texttt{CKEditor} has a “paste from Word” feature
\href{http://ckeditor.com/}{\texttt{http://ckeditor.com/}}



\item\relax 
Need to convert the HTML to Muse, preserving as much as possible
the logical structure of the document (and discarding the noise).



\item\relax 
Need some common search-and-replace patterns (like typographical
quotes, text cleaning).



\item\relax 
\href{https://metacpan.org/pod/Text::Amuse::Preprocessor}{\texttt{Text::Amuse::Preprocessor}}




\end{itemize}
\section{Compiling}


\begin{itemize}
\item\relax 
Templating for output: \href{https://metacpan.org/pod/Template::Tiny}{\texttt{Template::Tiny}}



\item\relax 
PDF generation: \texttt{XeTeX} or \texttt{LuaTeX} (Unicode aware, system fonts)



\item\relax 
\href{https://metacpan.org/pod/EBook::EPUB::Lite}{\texttt{EBook::EPUB::Lite}} (this is a port of \href{https://metacpan.org/pod/EBook::EPUB}{\texttt{EBook::EPUB}} withou XS
dependencies) using \texttt{Text::Amuse}’s splat HTML output



\item\relax 
\href{https://metacpan.org/pod/PDF::Imposition}{\texttt{PDF::Imposition}} (written for this project but it’s a general
purpose module): put logical pages into a physical page according
to a schema (for booklets and home printing)



\item\relax 
All the above glued together by \href{https://metacpan.org/pod/Text::Amuse::Compile}{\texttt{Text::Amuse::Compile}}



\item\relax 
\texttt{muse-compile.pl} script is shipped with \texttt{Text::Amuse::Compile}, so you
can generate the formats from the command line.




\end{itemize}
\section{Data storage}


\begin{itemize}
\item\relax 
Texts themselves are self-contained. All the information describing
the text (like author, title, categories) is stored in the header
of the text. 1 text (even a whole book), 1 file.



\item\relax 
Texts are stored in a Git archive



\item\relax 
Git integration on the site with \texttt{cgit}:
\href{http://www.amusewiki.org/git/amw/}{\texttt{http://www.amusewiki.org/git/amw/}}



\item\relax 
Full text search: Xapian (light, fast, fairly simple to setup, well
integrated in Perl with \href{https://metacpan.org/pod/Search::Xapian}{\texttt{Search::Xapian}}).



\item\relax 
Database integration: \href{https://metacpan.org/pod/DBIx::Class}{\texttt{DBIx::Class}}




\end{itemize}
\section{Web backend}


\begin{itemize}
\item\relax 
A daemon takes care of all the operations which are slow or somehow
delicate where concurrent access could be a problem (text
compilation, publication, indexing, Git interaction).



\item\relax 
Formats are pregenerated, including the HTML. The frontend just
serves them.



\item\relax 
The backend and the frontend communicate via a job queue in the
database.



\item\relax 
Some message queue systems were examined, but resorted to use the
database because it was the most straightforward and other
solutions looked like over-engineering.




\end{itemize}
\section{Web Frontend}


\begin{itemize}
\item\relax 
Catalyst application: chaining, method-to-uri mapping, actively
developed, great community, back-compatibility approach.



\item\relax 
Plack-able application (currently deployed via nginx + FCGI)



\item\relax 
Template: \href{https://metacpan.org/pod/Template}{Template Toolkit}



\item\relax 
Localization via \href{https://metacpan.org/pod/Catalyst::Plugin::I18N}{\texttt{Catalyst::Plugin::I18N}} (plus local overriding
via local JSON file).



\item\relax 
Localized for English, Italian, Croatian, Macedonian, Russian,
Finnish, Swedish, German, Spanish.



\item\relax 
Multisite: on one instance you can run as many sites as you want
(this was the most compelling argument to write AmuseWiki).




\end{itemize}
\section{User management}


\begin{itemize}
\item\relax 
Kept at minimum reusing existing solutions.


\begin{itemize}
\item\relax 
\href{https://metacpan.org/pod/Catalyst::Plugin::Authentication}{\texttt{Catalyst::Plugin::Authentication}}



\item\relax 
\href{https://metacpan.org/pod/Catalyst::Plugin::Authorization::Roles}{\texttt{Catalyst::Plugin::Authorization::Roles}}



\item\relax 
\href{https://metacpan.org/pod/DBIx::Class::PassphraseColumn}{\texttt{DBIx::Class::PassphraseColumn}}




\end{itemize}


\item\relax 
No hierarchical structure: each librarian can create other peer
librarians (plus root for site management) with the same level of
privileges.



\item\relax 
Modes:


\begin{itemize}
\item\relax 
private site



\item\relax 
blog site (only logged-in can edit)



\item\relax 
moderated wiki (approval required)



\item\relax 
open wiki (undertested)




\end{itemize}



\end{itemize}
\section{The Bookbuilder}


The basic idea is like the Wikimedia’s book creator, but with goodies.
Features:


\begin{itemize}
\item\relax 
LaTeX output



\item\relax 
Font selection



\item\relax 
Paper size selection



\item\relax 
Imposition schema selection



\item\relax 
Cover images upload



\item\relax 
Custom files are compiled by the backend, even if the users sees
the live logs and the process is pretty fast.



\item\relax 
EPUB output if required, with embedded fonts.



\item\relax 
A basic question to keep robots away (probably will not scale, but
so far works well)




\end{itemize}
\section{Some time left?}


If we have some more time and no questions\dots{}

\section{The past}


\begin{itemize}
\item\relax 
Drupal + filtered HTML, texts kept in sync on a local Git repo with
scripts. Obviously it wasn’t a brilliant idea, to be generous.



\item\relax 
Same filtered HTML inherited from Drupal, plus home-brewed CGI
scripts. It kind of worked.



\item\relax 
Dancer application and Emacs Muse markup, no database. Worked, but
didn’t scale with multisite.




\end{itemize}
\section{The future}


\begin{itemize}
\item\relax 
Slides (upcoming release)



\item\relax 
A better installer



\item\relax 
Teasers



\item\relax 
Decorative images




\end{itemize}






% 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}


Marco Pessotto (melmothX)

AmuseWiki: a library oriented wiki engine (talk)



September 3, 2015, Granada


\bigskip



   

       

       

       

       

       
   



\bigskip
\textbf{amusewiki.org}


\end{center}

% end final page with colophon


\end{document}


% No format ID passed.



