Mediawiki con lighttpd y soporte para latex
He estado creando un fichero de texto "documentando" (en realidad, no deja de ser una chuleta con mucho haz esto, pero sin explicar :) ) todo el proceso de instalación de mediawiki con lighttpd y varias extensiones (algunas bastante majas para quienes usan LaTeX).
Nótese que en principio va a ser una copia más o menos de lo que tengo en mi fichero de texto, poco a poco intentaré darle formato y quizá con el tiempo haga algún artículo para el wiki en base a éste. De momento es lo que hay ;) . Es decir, que me reservo el derecho a cambiar cosas.
Vamos a ello.
Versión 0.2 (13/07/09)
Copyright © 2009 Minaya minaya[una_arroba]esdebian[un_punto]org
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, and with no Front-Cover Texts, and with no Back-Cover Texts. Full text of the license is at http://www.gnu.org/copyleft/fdl.txt
Puesta a punto de Debian (lenny)
Esta parte es más bien indicativa. En mi caso, las pruebas (antes de implementarlo de forma definitiva) las estoy haciendo con una máquina virtual. A grandes rasgos, los pasos a seguir son:
- instalar debian, conjunto de paquetes mínimo.
- deshabilitar paquetes recomendados en aptitude
- instalar openssh-server
Hasta aquí nada nuevo. La configuración de openssh os la dejo a vosotros. He deshabilitado los paquetes recomendados de aptitude para evitar que instale chorrocientos paquetes que se tornan inútiles en un servidor.
Instalación del servidor web, mysql, mediawiki, etc
En mi caso, voy a instalar lighttpd. Las razones de usar este servidor web y no apache se reducen a:
- No conocía lighttpd y tenía curiosidad.
- Existe el rumor de que como servidor suele ir más suelto en máquinas escasas de recursos, y quería verlo con mis propios ojos.
Por supuesto, puedes instalar apache si así lo deseas.
- Conjunto de paquetes "recomendado"
aptitude install lighttpd lighttpd-doc mysql-server php5-cgi mediawiki mediawiki-extensions php-geshi unzip
(nota: php-geshi se utiliza para dar resaltado de sintaxis)
Este sería el conjunto de paquetes normal para mediawiki, sin soporte para LaTeX (aunque sí soportaría resaltado de sintaxis para varios lenguajes de programación).
- Soporte para LaTeX
aptitude install mediawiki-math texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-lang-spanish latexmk
Este conjunto, añadido al primero, dotaría a nuestro servidor de la posibilidad de compilar documentos LaTeX, tanto fórmulas sueltas en una página del wiki (extensión mediawiki-math) como compilar un documento completo a pdf (más adelante comentaré como).
Configurar lighttpd-mediawiki:
Es la primera vez que instalo y me pongo a trabajar con lighttpd, así que no os fiéis mucho de lo que os muestro. Eso de copiar y pegar nada. De momento, mediawiki va a ser el único CMS instalado, así que voy a redireccionar toda petición hacia el mismo.
Más o menos he seguido esta guía así como la documentación oficial para aclarar dudas.
Que módulos he usado y con que configuración
ls /etc/lighttpd/conf-enabled/* -l
-rw-r--r-- 1 root root 758 jul 12 14:55 /etc/lighttpd/conf-enabled/10-fastcgi.conf
-rw-r--r-- 1 root root 162 jul 12 15:35 /etc/lighttpd/conf-enabled/10-modredirect.conf
-rw-r--r-- 1 root root 326 jul 12 15:34 /etc/lighttpd/conf-enabled/10-modrewrite.conf
-rw-r--r-- 1 root root 53 jul 12 15:22 /etc/lighttpd/conf-enabled/5-alias.confContenido de cada .conf
- 10-fastcgi.conf:
## FastCGI programs have the same functionality as CGI programs,
## but are considerably faster through lower interpreter startup
## time and socketed communication
##
## Documentation: /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
## http://www.lighttpd.net/documentation/fastcgi.html
server.modules
+= ( "mod_fastcgi" )
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server = ( ".php" =>
((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket",
"max-procs" => 2,
"idle-timeout" => 20,
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "4",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"bin-copy-environment" => (
"PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"
))
)
- 10-modredirect.conf:
## Modredirect config
##
server.modules += ( "mod_redirect" )
url.redirect = ( "^/(?!tecexp/|robots\.txt|favicon\.ico)(.*)" => "/tecexp/index.php" )
- 10-modrewrite.conf:
## Modrewrite config
##
server.modules += ( "mod_rewrite" )
url.rewrite-once = ( "^/$" => "/tecexp/index.php" )
- 5-alias.conf:
alias.url = ( "/tecexp/" => "/var/lib/mediawiki/" )Puesta a punto de mediawiki:
- Rellenar datos de usuarios, sitio, base de datos, etc.
- Dejar que sea mediawiki quien cree la base de datos usando la cuenta de administrador de mysql.
- Mover LocalSettings.php como se comenta
mv /var/lib/mediawiki/config/LocalSettings.php /var/lib/mediawiki/ - Dejar con permisos en solo lectura para el dueño de dicho fichero.
chmod 400 /var/lib/mediawiki/LocalSettings.php
Con esto, mediawiki ya tendría su base de datos y una configuración mínima pero funcional.
Configuración de mediawiki:
Prácticamente toda la configuración del wiki se hace a través del fichero /var/lib/mediawiki/LocalSettings.php
Editar LocalSettings.php
En mi caso, se tratará de un wiki privado (sí, ya se que usar mediawiki para este fin es una aberración, pero tiene muchas extensiones, una gestión de permisos más que suficiente para lo que nos atañe y un manejo de conflictos al editar bastante decentes).
- Al final del fichero:
# My settings
# ACL settings
# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;
$wgWhitelistRead = array ( "Portada", "Special:Userlogin", "Help:Contents");
# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;
# Prevent new user registrations except by sysops
$wgGroupPermissions['*']['createaccount'] = false;
# minimal length of a user password
$wgMinimalPasswordLength = 5;
# Session timeout
$wgCookieExpiration = 0;
# File uploads
$wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'eps', 'svg', 'pdf');
# Extensions
require_once "$IP/extensions/LatexDoc/SyntaxHighlight.php";
require_once "$IP/extensions/LatexDoc/LatexDoc.php";
- Modificar algunas de las preexistentes
$wgDefaultSkin = 'monobook'; ---> $wgDefaultSkin = 'bluwiki_skin';
$wgUseTeX = false; ---> $wgUseTeX = true;
$wgEnableUploads = false; ---> $wgEnableUploads = true;- Descargar skin (en mi caso bluwiki):
cd /var/lib/mediawiki/skins
wget http://odioworks.com/download/bluwiki_skin_0.1.9.zip
unzip bluwiki_skin_0.1.9.zip
Adaptar estilo: en el fichero bluwiki_skin.php, cambiar
$bluwiki_skin_url = 'http://www.bluwiki.com';por
$bluwiki_skin_url = 'http://localhost';Extensiones
Habilitar extensiones de mediawiki-extensions
Al principio de este documento, uno de los paquetes que recomendábamos para su instalación es mediawiki-extensions, un conjunto de extensiones interesante que se encuentra empaquetado y listo para usar dentro de los repositorios.
Para activar algunas de estas extensiones, nos movemos al directorio de extensiones habilitadas:
cd /etc/mediawiki-extensions/extensions-enabled
Hacemos enlaces simbólicos pertinentes desde el directorio de extensiones disponibles:
ln -s ../extensions-available/SpecialRenameuser.php
ln -s ../extensions-available/SyntaxHighlight_GeSHi.php (útil si no quieres la parte de latex)
ln -s ../extensions-available/NewestPages.php
ln -s ../extensions-available/SpecialLastUserLogin.php
Otras extensiones utiles
Aquí nombro dos extensiones que no vienen empaquetadas, ambas algo peligrosas si no se tiene cuidado.
http://www.mediawiki.org/wiki/Extension:User_Merge_and_Delete
http://www.mediawiki.org/wiki/Extension:SpecialDeleteOldRevisions2
Dos extensiones no oficiales, LaTeX
La idea es convertir nuestro wiki en un potente editor colaborativo de documentos LaTeX. Antes de nada, quiero que os hagais una idea: http://openwetware.org/wiki/OpenWetWare:Feature_test/LatexDoc .
Visto esto, nos ponemos manos a la obra. Creamos los ficheros:
- /var/lib/mediawiki/extensions/LatexDoc/LatexDoc.php:
<?php
/*
This extension has been modified by Austin Che (c) 2006
See <a href="http://openwetware.org/wiki/User:Austin_J._Che/Extensions/LatexDoc" title="http://openwetware.org/wiki/User:Austin_J._Che/Extensions/LatexDoc" rel="nofollow">http://openwetware.org/wiki/User:Austin_J._Che/Extensions/LatexDoc</a> for the latest documentation
Changes:
- Uses syntax highlighting if the SyntaxHighlight extension is installed
- Uses/requires latexmk
- Allows use of other files on wiki such as for bibtex and graphics
- Removed DVI output (isn't very useful on web)
- Removed filter for "obviously dangerous control words" (not a good security mechanism)
- Add link to get log file
Security: change texmf.cnf so that
shell_escape=f
openout_any=p
openin_any=p
and/or run latex under a chroot jail.
Released under the GNU GPL.
----------------------------------------
Original documentation:
INSTALLATION
------------
This is an extension for the collaborative editing of LaTeX documents.
Installation is by the usual method, put the following line in your
LocalSettings.php:
require_once( "extensions/LatexDoc/LatexDoc.php" );
This creates an object called $wgLatexDoc. Member variables of that object can
be changed in order to customise the behaviour of the extension.
latexCommand
Path to the latex command
pdflatexCommand
Path to the pdflatex command. This must be installed, otherwise the PDF
links won't work.
workingDir
Filesystem directory where all related files go. Must be in the web
server document root.
workingPath
Relative URI of workingDir
All of these variables have sensible defaults, as long as latex and pdflatex are
in the PATH, it should work out of the box.
USE
---
The extension operates by searching the text of articles at render time for
"\begin{document}". If this string is present, the article is not rendered like
ordinary wikitext. Instead, it's displayed with a fixed-width font, with a
"Make DVI" and a "Make PDF" link at the top. Clicking on the links will invoke
latex, generate the requested file, and redirect the browser to it.
SECURITY
--------
Executing LaTeX documents written by untrusted users is a security risk. I've put
in a simple filter for some obviously dangerous control words, but there may well be
holes. No guarantee is made. If you're brave enough to make a wiki with this
extension publically editable, it's recommended that you run latex from a chroot
jail.
KEEP BACKUPS OF IMPORTANT DATA!
COPYING
-------
LatexDoc.php and this documentation were written by Tim Starling, (c) 2005. You
may choose one of the following two licenses, at your option:
1) The GNU General Public License
2) You may use or copy this work for any purpose, with the sole restriction
that the rights of GPL licensors other than myself are not infringed.
Assessment of the extent of those rights is at your own risk.
*/
if ( !defined( 'MEDIAWIKI' ) ) {
die( "Not a valid entry point\n" );
}
$wgExtensionFunctions[] = 'wfLatexDocInit';
$wgExtensionCredits['other'][] = array(
'name' => 'LatexDoc',
'version' => '2008/03/09',
'author' => 'Austin Che',
'url' => 'http://openwetware.org/wiki/User:Austin_J._Che/Extensions/LatexDoc',
'description' => 'Write LaTeX documents on the wiki',
);
class
LatexDoc
{
var $latexmk; // full path to latexmk
var $args; // args to latexmk
var $workingDir;
var $workingPath;
function
LatexDoc()
{
global $wgUploadDirectory, $wgUploadPath, $wgScriptPath, $IP;
$this->latexmk = "/usr/bin/latexmk";
$this->args = "-f -silent -pdf";
if ($wgUploadDirectory)
$this->workingDir = "$wgUploadDirectory/latexdoc";
else
$this->workingDir = "$IP/images/latexdoc";
if ($wgUploadPath)
$this->workingPath = "$wgUploadPath/latexdoc";
else
$this->workingPath = "$wgScriptPath/images/latexdoc";
}
function
onUnknownAction( $action, $article ) {
global $wgOut, $wgRequest, $IP;
// Respond only to latexdoc action
if ( $action != 'latexdoc' ) {
return true;
}
// Check for non-existent article
if ( !$article || !( $text = $article->fetchContent() ) ) {
$wgOut->addWikiText( wfMsg( 'latexdoc_no_text' ) );
return false;
}
// Check permissions
if ( !$article->mTitle->userCanRead() ) {
$wgOut->loginToUse();
return false;
}
$ext = $wgRequest->getText( 'ext' );
$wgOut->setArticleFlag( false );
$wgOut->setArticleRelated( true );
$wgOut->setRobotpolicy( 'noindex,nofollow' );
$wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
// Get path
if ( !is_dir( $this->workingDir ) ) {
if ( !mkdir( $this->workingDir, 0777 ) ) {
$wgOut->addWikiText( wfMsg( 'latexdoc_cant_create_dir', $this->workingDir ) );
return false;
}
}
chdir( $this->workingDir );
$hash = md5( $text );
$filename = 'ltd_' . $hash;
$fullpath = $this->workingDir . '/' . $filename;
$url = $this->workingPath . '/' . $filename;
if ( !
$wgRequest->getBool('cache', true) && file_exists( "$fullpath.$ext"))
@unlink("$fullpath.$ext");
if ( !
file_exists( "$fullpath.$ext" ) )
{
// need to generate/regenerate the output
if ($this->getHelperFiles($text) && $this->runLatex( $text, $filename ))
{
$wgOut->redirect( "$url.$ext" );
}
// else it failed
}
else
$wgOut->redirect( "$url.$ext" );
chdir( $IP );
return false;
}
function
getHelperFiles($text)
{
global $wgOut;
// search for \usewikifile{..}
preg_match_all("/\\\\usewikifile{(.*)}{(.*)}/", $text, $matches, PREG_SET_ORDER);
foreach ($matches as $val)
{
$page = $val[1];
$outfile = $val[2];
if (preg_match("/[^-\w.]/", $outfile) || preg_match("/^[.]/", $outfile))
{
$wgOut->addWikiText(wfMsg('latexdoc_invalid_filename', $outfile));
return false;
}
$title = Title::newFromText($page);
if ($title)
{
if ($title->getNamespace() == NS_IMAGE)
{
$localFile = wfLocalFile($title);
if (! $localFile->exists())
{
$wgOut->addWikiText(wfMsg('latexdoc_no_page', $page));
return false;
}
if (!
copy ($localFile->getPath(), $outfile))
{
$wgOut->addWikiText( wfMsg( 'latexdoc_cant_write', "$outfile" ) );
return false;
}
continue;
}
$rev = Revision::newFromTitle($title);
}
if (!$title || ! $rev)
{
$wgOut->addWikiText(wfMsg('latexdoc_no_page', $page));
return false;
}
else
{
$inFile = fopen( $this->workingDir . '/' . $outfile, 'w' );
if ( !$inFile )
{
$wgOut->addWikiText( wfMsg( 'latexdoc_cant_write', "$outfile" ) );
return false;
}
fwrite( $inFile, $rev->getText());
fclose( $inFile );
}
}
return true;
}
function
runLatex( $text, $file )
{
global $wgOut, $wgRequest;
// remove all \usewikifile commands
$text = preg_replace("/\\\\usewikifile{.*}{.*}/", "", $text);
// Write input file
$inFile = fopen( "$file.tex", 'w' );
if ( !$inFile ) {
$wgOut->addWikiText( wfMsg( 'latexdoc_cant_write', "$file.tex" ) );
return false;
}
fwrite( $inFile, $text );
fclose( $inFile );
// Run LaTeX
$cmd = $this->latexmk . " $this->args " . wfEscapeShellArg( "$file" ) . " 2>&1";
exec($cmd, $output, $error);
// Report errors
// we currently use -f with latexmk so that no exit code is returned
// as we need to distinguish between undefined references (which we still consider success)
// and genuine latex errors
foreach ($output as $outputline)
{
if (preg_match("/^====.*error.*====$/", $outputline))
{
// this is an erorr
// could have partially generated pdf, delete it (some browsers will crash)
@unlink("$file.pdf" );
wfSuppressWarnings();
$log = '<pre>' . file_get_contents( "$file.log" ) . '</pre>';
wfRestoreWarnings();
$wgOut->addWikiText( wfMsg( 'latexdoc_error', $log ) );
return false;
}
}
return true;
// Delete temporary files
//@unlink( "$file.tex" );
//@unlink( "$file.aux" );
//@unlink( "$file.log" );
}
function
onParserBeforeStrip( &$parser, &$text, &$stripState )
{
// If the article looks vaguely like TeX, render it with syntax highlighting (if available)
// with a link for pdf generation
global $wgSyntaxHighlight;
if ( strpos( $text, '\begin{document}' ) !== false ) {
$sk =& $parser->mOptions->getSkin();
$links = $sk->makeKnownLinkObj( $parser->mTitle, wfMsg( 'latexdoc_get_pdf' ),
'action=latexdoc&ext=pdf' ) . " | " .
$sk->makeKnownLinkObj( $parser->mTitle, wfMsg( 'latexdoc_get_log' ),
'action=latexdoc&ext=log' ) . " | " .
$sk->makeKnownLinkObj( $parser->mTitle, wfMsg( 'latexdoc_get_pdf_no_cache' ),
'action=latexdoc&ext=pdf&cache=0' ) . " | " .
$sk->makeKnownLinkObj( $parser->mTitle, wfMsg( 'latexdoc_get_source' ),
'action=raw&ctype=application/x-tex&filename=wiki_latex_source.tex' );
$links = $parser->insertStripItem($links, $stripState);
// make list of included files
preg_match_all("/\\\\usewikifile{(.*)}{(.*)}/", $text, $matches, PREG_SET_ORDER);
$files = '<div class="latexdoc-files">';
$files = $files . '<b>Included files:</b>';
foreach ($matches as $val)
{
$files = $files . "\n*[[:" . $val[1] . "]]";
}
$files = $files . '</div>';
$text = wordwrap($text);
if ($wgSyntaxHighlight)
$text = $wgSyntaxHighlight->highlight($text, "latex");
else
$text = "<pre>$text</pre>"; // no syntax highlighting
$text = $parser->insertStripItem($text, $stripState);
$text = "$links<hr />$files<p>$text";
}
return true;
}
// Needed in some versions to prevent Special:Version from breaking
function __toString() { return 'LatexDoc'; }
}
$wgLatexDoc = new LatexDoc;
function
wfLatexDocInit() {
global $wgHooks, $wgLatexDoc, $wgMessageCache;
$wgHooks['UnknownAction'][] = &$wgLatexDoc;
$wgHooks['ParserBeforeStrip'][] = &$wgLatexDoc;
$wgMessageCache->addMessages( array(
'latexdoc_invalid_filename' => 'Filename $1 is invalid',
'latexdoc_no_page' => 'Wiki page $1 does not exist',
'latexdoc_no_text' => 'Article contains no text, cannot generate output',
'latexdoc_cant_create_dir' => 'Cannot create temporary directory $1',
'latexdoc_cant_write' => 'Cannot write to file $1',
'latexdoc_error' => "LaTeX error:<br />\n\n$1",
'latexdoc_get_pdf' => 'Get PDF',
'latexdoc_get_log' => 'Get log',
'latexdoc_get_pdf_no_cache' => 'Regenerate PDF',
'latexdoc_get_source' => 'Export Source',
));
}
?>- /var/lib/mediawiki/extensions/LatexDoc/SyntaxHighlight.php:
<?php
/**
* Syntax highlighting using GeSHi (<a href="http://qbnz.com/highlighter/" title="http://qbnz.com/highlighter/" rel="nofollow">http://qbnz.com/highlighter/</a>)
* Based on code from Andrew Nicol (<a href="http://meta.wikimedia.org/wiki/User:Ajqnic:GeSHiHighlight" title="http://meta.wikimedia.org/wiki/User:Ajqnic:GeSHiHighlight" rel="nofollow">http://meta.wikimedia.org/wiki/User:Ajqnic:GeSHiHighlight</a>)
*
* Wiki syntax used is:
* <syntax type="my-language">...</syntax> (highlight given text)
* <syntax type="my-language" file="wiki file" /> (highlight uploaded file)
* <syntax type="my-language" file="http://..." /> (highlight file from web)
*
* Code released under the GPL <a href="http://www.gnu.org/licenses/gpl.html
" title="http://www.gnu.org/licenses/gpl.html
" rel="nofollow">http://www.gnu.org/licenses/gpl.html
</a> * Author: Austin Che
*/
include_once('/usr/share/php-geshi/geshi.php');
define('SYNTAX_HIGHLIGHT_MAX_BYTES_FROM_FILE', 128 * 1024); // shouldn't be highlighting more text than this
$wgExtensionFunctions[] = "wfSyntaxHighlightExtension";
$wgExtensionCredits['other'][''] = array('name' => 'SyntaxHighlight',
'version' => '2007/03/18',
'author' => 'Austin Che',
'url' => 'http://openwetware.org/wiki/User:Austin/Extensions/SyntaxHighlight',
'description' => 'Allows for syntax highlighting using GeSHi');
function
wfSyntaxHighlightExtension()
{
global $wgParser, $wgSyntaxHighlight;
$wgSyntaxHighlight = new SyntaxHighlight;
$wgParser->setHook("syntax", array(&$wgSyntaxHighlight, "syntaxTag"));
}
class
SyntaxHighlight
{
function syntaxTag($text, $argv, &$parser)
{
// if "type" argument is not given or is unknown, we let GeSHi do whatever it does by default
$type = $argv["type"];
if (
$argv["file"])
{
$file = $argv["file"];
if (preg_match("@^http://@", $file))
{
// get a remote url via fopen
$fp = @fopen($file, "r");
if (!$fp)
return $text;
$text = stream_get_contents($fp, SYNTAX_HIGHLIGHT_MAX_BYTES_FROM_FILE);
fclose($fp);
}
else
{
// treat as an uploaded file on the wiki
$image = new Image(Title::makeTitle(NS_IMAGE, $file));
if (! $image->exists())
return $text;
$text = file_get_contents($image->getImagePath(), SYNTAX_HIGHLIGHT_MAX_BYTES_FROM_FILE);
}
// maybe disable parser cache?
//$parser->disableCache();
}
return
$this->highlight($text, $type);
}
function
highlight($text, $type)
{
$geshi = new GeSHi($text, $type);
$geshi->enable_classes();
$geshi->set_header_type(GESHI_HEADER_PRE);
//$geshi->set_overall_class("code");
$geshi->set_encoding("utf-8");
// Set the style for the PRE around the code. The line numbers are contained within this box (not
// XHTML compliant btw, but if you are liberally minded about these things then you'll appreciate
// the reduced source output).
$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
/*
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5);
// Set the style for line numbers. In order to get style for line numbers working, the <li> element
// is being styled. This means that the code on the line will also be styled, and most of the time
// you don't want this. So the set_code_style reverts styles for the line (by using a <div> on the line).
// So the source output looks like this:
//
// <pre style="[set_overall_style styles]"><ol>
// <li style="[set_line_style styles]"><div style="[set_code_style styles]>...</div></li>
// ...
// </ol></pre>
$geshi->set_code_style('color: #000020;', 'color: #000020;');
*/
$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
// Styles for hyperlinks in the code. GESHI_LINK for default styles, GESHI_HOVER for hover style etc...
// note that classes must be enabled for this to work.
$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
return
"<style>".$geshi->get_stylesheet()."</style>".$geshi->parse_code();
}
}
?>- Como añadir imágenes a nuestro documento:
- Subir una imagen a mediawiki: Ejemplo.png
- Incrustarla en nuestro documento: %\usewikifile{Image:Ejemplo.png}{ejemplo.png}
- Poner: \includegraphics{ejemplo}
Nota: en este caso, tal y como se presenta la extensión LatexDoc, se compilará el documento con pdflatex. Si te interesa manejar imagenes eps, podrías intentar pasarles purifyeps, convertirlas a otro formato o hacer que en vez de pdflatex se use latex+dvipdf.
Para este último caso, se trata de cambiar el argumento "-pdf" de latexmk por "-dvi -pdfdvi" dentro de LatexDoc.php
De momento es todo.
Cambios:
- 0.3 (12/09/10)
- 0.2 (13/07/09)
- 0.1 (12/07/09)
- Corregido bug en la extensión LatexDoc al pasar de Mediawiki 1.12 (Lenny) a 1.15 (Squeeze).
Antes:
function onUnknownAction( $action, &$article ) {
Ahora
function onUnknownAction( $action, $article ) {
Los cambios parecen permitir que siga funcionando en Lenny sin problemas.
- Añado algo de texto para explicar el porqué de algunas cosas.
- Corrección de algunas erratas, errores ortográficos, etc.
- Versión inicial de éste documento.
ToDo:
- Probar que todo el conjunto funcione como debe. Hecho, lleva meses funcionando ;) .
- Documentar mejor este texto
- Revisar en busca de erratas
- Implementar alguna extensión que me haya dejado en el tintero
En octubre de 2.008 comentaste que estabas trabajando en esto, y que en próximos post comentarias algo sobre el tema. Has cumplido! Enhorabuena por el resultado, y espero que sea realmente útil, sobre todo para prácticas de laboratorio en las que tienen que colaborar diferentes personas.
En octubre de 2.008 comentaste que estabas trabajando en esto, y que en próximos post comentarias algo sobre el tema. Has cumplido! Enhorabuena por el resultado, y espero que sea realmente útil, sobre todo para prácticas de laboratorio en las que tienen que colaborar diferentes personas.
Jeje, muchas gracias.
Comenté que iba a hacer algo sobre dokuwiki (realmente no he cumplido
). La verdad es que es un software muy bueno, sencillo de usar y configurar, y guarda los textos en texto plano (puede ser útil bajo ciertas circunstancias). Pero para lo que quiero tiene una pega. La forma que tiene de evitar conflictos al editar entre varias personas funciona, pero es algo tosca: bloquear el fichero.
Mediawiki (y otros muchos wikis como MoinMoin, Twiki e ikiwiki) se lo curran un poco más en este aspecto e intentan importar los cambios de cada usuario. Generalmente, esto funciona bien si editas partes diferentes del texto. Si editas un mismo fragmento (sobre todo la misma línea) suele fallar, y te envían a páginas comparando ambas ediciones para que resuelvas a mano el conflicto.
Y nada, me animó hacer este post sobre todo el haber encontrado una extensión como LatexDoc, que puede ser útil en más ámbitos, no solo en la edición colaborativa. Entre otras cosas, permitiría tener tus documentos en un servidor propio y acceder a ellos y compilarlos desde cualquier ordenador con un simple navegador a internet. Ya no hace falta poner en el lado del cliente un compilador de LaTeX ni nada parecido, de eso se encargaría el servidor.
Tu redactas tu documento con su resaltado de sintaxis, su control de versiones, etc. Y cuando lo tengas, basta dar un botón para obtener el pdf.
Como dices lighttpd es más liviano que apache, en pruebas de benchmark realizadas acepta mas peticiones , el problema es que es más restrictivo en lenguajes usados, pero si sólo vas a servir php por ejemplo es recomendable , un ejemplo es mininova.
Amigos , pueden enviarme un ejemplo de virtual host en lighttpd?
Amigos , pueden enviarme un ejemplo de virtual host en lighttpd?
Faltaría más,
Buen aporte, no seria mas conveniente subirlo a la Wiki?
PD: Pensé que optarías por Copyleft
Saludos.