From: Sven Schöling Date: Fri, 18 Mar 2011 15:30:04 +0000 (+0100) Subject: Auf Romans Anregen - Ein simples POD basiertes Hilfesystem X-Git-Tag: release-2.6.3~46 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c574ecd33acd23af72ffbd2982bbebd22c048792;p=kivitendo-erp.git Auf Romans Anregen - Ein simples POD basiertes Hilfesystem So funktionierts: - 1. Hilfe in eine pod Datei schreiben - 2. Pod Datei nach doc/online//.html legen, wobei der countrycode der locale ist, und ein /[a-zA-Z0-9_]+/ Identifier ist. - 3. HTML erzeugen mit: scripts/make_docs.pl - 4. Im Template einen Hilfelink einbinden mit: [% L.online_help_tag('tag') %] --- diff --git a/.gitignore b/.gitignore index 999a9bf53..d51218180 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ crm /users/templates-cache/ /users/pid/ /config/lx_office.conf +/doc/online/*/*.html +pod2html* diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 513f4a221..2299a66b1 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -396,6 +396,18 @@ EOCODE return $code; } +sub online_help_tag { + my ($self, $tag, @slurp) = @_; + my %params = _hashify(@slurp); + my $cc = $::myconfig{countrycode}; + my $file = "doc/online/$cc/$tag.html"; + my $text = $params{text} || $::locale->text('Help'); + + die 'malformed help tag' unless $tag =~ /^[a-zA-Z0-9_]+$/; + return unless -f $file; + return $self->html_tag('a', $text, href => $file, target => '_blank'); +} + sub dump { my $self = shift; require Data::Dumper; diff --git a/css/lx-office-erp.css b/css/lx-office-erp.css index 6f25ee507..6fbe8c29e 100644 --- a/css/lx-office-erp.css +++ b/css/lx-office-erp.css @@ -134,7 +134,7 @@ body.menu { /* Überschriftsbalken */ -.listtop { +.listtop, h1 { background-color: rgb(236,233,216); text-align:left; padding:5px; diff --git a/doc/online/.dummy b/doc/online/.dummy new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/make_docs.pl b/scripts/make_docs.pl new file mode 100644 index 000000000..f5ec66ef8 --- /dev/null +++ b/scripts/make_docs.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; + +use Pod::Html; +use File::Find; + +my $doc_path = "doc/online"; +#my $pod2html_bin = `which pod2html` or die 'cannot find pod2html on your system'; + +find({no_chdir => 1, wanted => sub { + next unless -f; + next unless /\.pod$/; + print "processing $_,$/"; + my $html_file = $_; + $html_file =~ s/\.pod$/.html/; + pod2html( +# $pod2html_bin, + '--noindex', + '--css=../../../css/lx-office-erp.css', + "--infile=$_", + "--outfile=$html_file", + ); +}}, $doc_path); + +1;