Blob Blame History Raw
Name: 		txt2tags
Summary: 	Summary: Converts text files to HTML, XHTML, LaTeX, and other formats
Version: 	2.5
Release:	2%{?dist}
License: 	GPLv2
Group: 		Applications/Text
URL: 		http://txt2tags.sourceforge.net/

Source0: http://txt2tags.googlecode.com/files/txt2tags-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildArch: noarch

BuildRequires: python
BuildRequires: gettext

Requires: python

%description
Txt2tags is a document generator. It reads a text file with minimal markup as 
**bold** and //italic// and converts it to the following formats:

    * HTML
    * XHTML
    * SGML
    * LaTeX
    * Lout
    * Man page
    * Wikipedia (NEW)
    * Google Code Wiki (NEW)
    * DokuWiki (NEW)
    * MoinMoin
    * MagicPoint
    * PageMaker
    * Plain text 

%prep
#NONE

%setup -q
#Remove executable flag
chmod 0644 extras/*

#Create locale files
for file in $(ls -1 po/*.po); do
	msgfmt -o ${file//.po/.mo} $file
done

%build
#NONE

%install
#For sanity protection, nuke buildroot
rm -rf %{buildroot}

#Install the executable
install -Dp -m0755 txt2tags %{buildroot}%{_bindir}/txt2tags

#Install manpages
install -Dp -m0644 doc/manpage.man %{buildroot}%{_mandir}/man1/txt2tags.1
for file in $(ls -1 doc/manpage-*.man); do
	lang="${file##doc/manpage-}"
	lang="${lang%%.man}"
	install -Dp -m0644 $file %{buildroot}%{_mandir}/$lang/man1/txt2tags.1
done

#Install locale(s)
for file in $(ls -1 po/*.mo); do
	basename="${file##po/}"
	lang="${basename%%.mo}"
	install -Dp -m0644 $file %{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES/txt2tags.mo
done

# Install extras without Mac OS files - Thanks to Kairo Araujo <kairo@kairo.eti.br>
for extras in $(ls -1 extras/ | grep -v .__); do
   install -Dp -m0644 extras/$extras $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/extras/$extras
   iconv -f iso8859-1 -t UTF-8 $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/extras/$extras > $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/extras/$extras.tmp
   mv -f $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/extras/$extras.tmp $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/extras/$extras
done

#get rid of the .mgp files as they are not applicable anymore
rm -f samples/*.mgp
 
# Install samples without Mac OS files - Thanks to Kairo Araujo <kairo@kairo.eti.br>
for samples in $(ls -1 samples/sample*); do
         install -Dp -m0644 $samples $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples
         iconv -f iso8859-1 -t UTF-8 $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples > $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples.tmp
         mv -f $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples.tmp $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples
done

for samples_css in $(ls -1 samples/css/*); do
   install -Dp -m0644 $samples_css $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$samples_css
done
for sample_img in $(ls -1 samples/img/*); do
   install -Dp -m0644 $sample_img $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$sample_img
done
for sample_module in $(ls -1 samples/module/*); do
   install -Dp -m0644 $sample_module $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/$sample_module
done


%find_lang %{name}

%clean
%{__rm} -rf %{buildroot}

%files -f %{name}.lang
%defattr(-, root, root, 0755)
%doc ChangeLog COPYING README TODO doc/*.pdf extras/ samples/
%doc %{_mandir}/man1/txt2tags.1*
%doc %{_mandir}/*/man1/txt2tags.1*
%{_bindir}/txt2tags
%{_docdir}/%{name}/extras/*
%{_docdir}/%{name}/samples/*


%changelog
* Mon Aug 11 2008 Adam Miller <maxamillion [AT] gmail.com> - 2.5-2
- Fourth attempt, issues resolved:
- Increased release number
- Added BuildRequires entry for gettext (for msgfmt)
* Fri Aug 1 2008 Adam Miller <maxamillion [AT] gmail.com> - 2.5-1
- Third attempt, got rid of the Mac files (Thanks again to Kairo)
- Took care of the .mgp files
* Thu Jul 31 2008 Adam Miller <maxamillion [AT] gmail.com> - 2.5-1
- Second attempt at packaging txt2tags
* Mon Jul 28 2008 Adam Miller <maxamillion [AT] gmail.com> - 2.5-1
- First attempt at packaging txt2tags