\documentclass[DIV=13,%
BCOR=0mm,%
headinclude=false,%
footinclude=false,%
fontsize=10pt,%
oneside,%
paper=a5]%
{scrartcl}
\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
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]
\let\chapter\section
% 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{Include remote files}
\date{}
\author{}
\subtitle{}
% https://groups.google.com/d/topic/comp.text.tex/6fYmcVMbSbQ/discussion
\hypersetup{%
pdfencoding=auto,
pdftitle={Include remote files},%
pdfauthor={},%
pdfsubject={},%
pdfkeywords={howto}%
}
\begin{document}
\thispagestyle{empty}
\strut\vskip 2em
\begin{center}
{\usekomafont{title}{\huge Include remote files\par}}%
\vskip 1em
\vskip 2em
\vskip 1.5em
\strut\par
\end{center}
\vskip 3em
\par
It was asked if it would be possible to include (possibly remote)
files at markup level, something like:
\begin{alltt}
[[include file.txt]]
\end{alltt}
This idea of external resources embedded at markup level is bad
because it just goes against the whole amusewiki architecture, which
tries and keep the archive as a whole and the texts as self-contained
units.
However, the problem is fixable in another way, which looks saner and
more secure (because of course, this feature would open up a whole set
of vulnerabilities: think e.g. about an URL as
\texttt{http://localhost/path/which/is/supposed/to/be/served/only/to/localhost}
which could be possibly get embedded on a public wiki).
Instead, you could have a script which does the following:
\begin{enumerate}[1.]
\item\relax
Read a user provided file with an identifier and an URL. Which at
this point could be very well file:\Slash{}\Slash{}\Slash{}etc\Slash{}passwd as it's under the
user control and out of the app.
\item\relax
In the muse file, leave some comments, like \texttt{; START INCLUDE file} and
\texttt{; STOP INCLUDE} (which are invisible in the generated formats)
\item\relax
Fetch the application git and do forced update to keep it in sync
using the freshest version.
\item\relax
Scan the archive and replace with the content between the comments
with the LWP->decoded\_content stuff the script pulls from the
identifiers, and commit the changes, if any. Bonus point: you
actually keep track of the changes not just display the content
at some random time. I see this as feature, of course.
\item\relax
Add a cronjob to the application which pulls this cloned git every
hour or so. The applications will refuse to pull non-fast-forward
anyway, so it's safe.
\end{enumerate}
See \texttt{script/sync-remote-archive.pl} for an example of a script which
automatically pulls the content from a remote archive.
% 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}
Include remote files
\bigskip
\bigskip
\textbf{amusewiki.org}
\end{center}
% end final page with colophon
\end{document}
% No format ID passed.