Permalink
Browse files

Folded in work for PDF and HTML formatting

1. Updated the Simply_Lift.lyx file with settings comparable
   to what we use in Exploring Lift for formatting (fonts,
   margins, listings, code syntax highlighting)
2. Modified localization.lyx to "czech" language to allow for
   proper encoding (for whatever reason UTF8 puked horribly)
3. Added in customizations for latex2html (and post-processing)
   to use SyntaxHighlighter for HTML output
  • Loading branch information...
1 parent a4d7b09 commit a4c42c4706aa8e1980fad734b846ea8fe8d08602 @dchenbecker dchenbecker committed Dec 3, 2010
View
@@ -52,3 +52,17 @@ lift_proto*
# Pax Runner (for easy OSGi launching)
runner
+# LyX-generated artifacts
+*.aux
+*.idx
+*.ilg
+*.ind
+*.lof
+*.log
+*.lol
+*.out
+*.pdf
+*.tex
+*.toc
+Simply_Lift/
+Simply_Lift.html.tgz
View
@@ -0,0 +1,83 @@
+# -*- perl -*-
+package main;
+
+sub do_env_lstlisting {
+ local($liststyle,$listcaption,$listlabel,$listlang);
+
+ $liststyle = "style=\"border: 2px solid #ddd;\"";
+
+ if (/label=(.*?),/) {
+ $listlabel = "<div $liststyle id=\"$1\">";
+ } else {
+ $listlabel = "<div $liststyle>";
+ }
+
+ if (/caption=(.*?),/) {
+ $listcaption = "<div style=\"text-align: center; font-weight: bold\">$1</div>";
+ } else {
+ $listcaption = "";
+ }
+
+ if (/language=XML/) {
+ $listlang = "class=\"brush: xml\"";
+ } elsif (/language=HTML/) {
+ $listlang = "class=\"brush: html\"";
+ } else {
+ $listlang = "class=\"brush: scala\"";
+ }
+
+ $result = join('',"$listlabel$listcaption<pre $listlang>","@_","</pre></div>");
+
+ $result =~ s/\[.*\]//;
+
+ $result;
+}
+
+sub do_cmd_lstinputlisting {
+ local($liststyle,$listcaption,$listlabel,$listlang,$listsrc,$rest);
+
+ if (/\].*>(\S+)<(.*)/) {
+ $listsrc = do {
+ local $/ = undef;
+ open my $fh, "<", "../$1"
+ or die "could not open \"$1\": $!";
+ <$fh>;
+ };
+
+ # Let's attempt to escape left angles. Frustratingly, 15 minutes
+ # on google led to no good suggestions on escaping XML
+ $listsrc =~ s/</&lt;/;
+
+ $rest = $2;
+ }
+
+ $liststyle = "style=\"border: 2px solid #ddd;\"";
+
+ if (/label=(.*?),/) {
+ $listlabel = "<div $liststyle id=\"$1\">";
+ } else {
+ $listlabel = "<div $liststyle>";
+ }
+
+ if (/caption=(.*?),/) {
+ $listcaption = "<div style=\"text-align: center; font-weight: bold\">$1</div>";
+ } else {
+ $listcaption = "";
+ }
+
+ if (/language=XML/) {
+ $listlang = "class=\"brush: xml\"";
+ } elsif (/language=HTML/) {
+ $listlang = "class=\"brush: html\"";
+ } else {
+ $listlang = "class=\"brush: scala\"";
+ }
+
+ $result = join('',"$listlabel$listcaption<pre $listlang>","$listsrc","</pre></div>$2");
+
+ $result =~ s/\[.*\]//;
+
+ $result;
+}
+
+1; # Must be last line
View
@@ -0,0 +1,32 @@
+RSYNCFLAGS = "-rv --delete"
+
+all : Simply_Lift.pdf
+
+html : Simply_Lift.tex Simply_Lift.aux
+ @echo [Building HTML]
+ latex2html -split 3 -local_icons -no_antialias_text -no_antialias -white Simply_Lift.tex
+ ./highlightHtml.sh
+ tar cvzf Simply_Lift.html.tgz Simply_Lift/
+
+pdf : Simply_Lift.pdf
+
+Simply_Lift.pdf : Simply_Lift.aux
+
+Simply_Lift.tex : *.lyx
+ @echo [Exporting PDFLaTeX]
+ @lyx -e pdflatex Simply_Lift.lyx
+
+Simply_Lift.aux : Simply_Lift.tex
+ @echo [Building PDF]
+ pdflatex Simply_Lift.tex
+ makeindex Simply_Lift.idx
+ @bash -c "while pdflatex Simply_Lift.tex && grep -q \"Rerun to get cross-references right\" Simply_Lift.log ; do echo \" Rebuilding references\" ; done"
+ @echo [Built PDF]
+
+clean:
+ rm -f *.tex images/*.eps *.toc *.aux *.dvi *.idx *.lof *.log *.out *.toc *.lol Simply_Lift.pdf
+ rm -rf Simply_Lift/
+
+#install: pdf html
+# rsync $(RSYNC_FLAGS) Simply_Lift.pdf Simply_Lift.html.tgz lion.harpoon.me:/home/scalatools/hudson/www/exploring/downloads/
+# rsync $(RSYNC_FLAGS) Simply_Lift/ lion.harpoon.me:/home/scalatools/hudson/www/exploring/Simply_Lift/
View
@@ -3,42 +3,103 @@
\begin_document
\begin_header
\textclass book
+\begin_preamble
+\usepackage[notbib]{tocbibind}
+\usepackage{breakurl}
+\usepackage{textcomp}
+\usepackage[htt]{hyphenat}
+
+% redefine the \LyX macro for PDF bookmarks
+\def\LyX{\texorpdfstring{%
+ L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
+ {LyX }}
+
+
+% "define" Scala
+\lstdefinelanguage{scala}{morekeywords={abstract,case,catch,class,def,do,else,extends,false,final,finally,for,forSome,if,implicit,import,lazy,match,new,null,object,override,package,private,protected,return,sealed,super,this,throw,trait,try,true,type,val,var,while,with,yield},
+otherkeywords={=>,<-,<:,<\%,>:},
+sensitive=true,
+morecomment=[l]{//},
+morecomment=[s]{/*}{*/},
+morestring=[b]"}
+
+\definecolor{darkgreen}{rgb}{0,0.4,0}
+
+% Default settings for code listings
+\lstset{frame=tb,
+language=scala,
+aboveskip=3mm,
+belowskip=3mm,
+showstringspaces=false,
+columns=flexible,
+basicstyle={\small\ttfamily},
+keywordstyle=\color{blue},
+commentstyle=\color{darkgreen},
+stringstyle=\color{red},
+upquote=true,
+showtabs=true,
+tab=BADTAB,
+numbers=left,
+numberstyle=\tiny}
+
+% Fix the List of Listings title
+\renewcommand{\lstlistlistingname}{List of Listings}
+
+% Be less rigorous with line breaking
+\sloppy
+\end_preamble
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
\end_modules
\language english
-\inputencoding auto
-\font_roman default
+\inputencoding latin2
+\font_roman palatino
\font_sans default
-\font_typewriter default
+\font_typewriter courier
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
-\paperfontsize default
+\paperfontsize 11
\spacing single
-\use_hyperref false
+\use_hyperref true
+\pdf_title "Simply Lift"
+\pdf_author "David Pollak"
+\pdf_bookmarks true
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen false
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks true
+\pdf_pdfborder true
+\pdf_colorlinks true
+\pdf_backref false
+\pdf_pdfusetitle false
+\pdf_quoted_options "urlcolor=blue,linkcolor=blue"
\papersize letterpaper
\use_geometry true
\use_amsmath 1
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
+\leftmargin 1in
+\topmargin 1in
+\rightmargin 1in
+\bottommargin 1in
\secnumdepth 2
\tocdepth 2
\paragraph_separation skip
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 2
-\paperpagestyle default
+\paperpagestyle headings
\tracking_changes false
\output_changes false
\author ""
@@ -47,6 +108,22 @@ figs-within-sections
\begin_body
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+frontmatter
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
\begin_layout Title
Simply Lift
\end_layout
@@ -60,10 +137,24 @@ David Pollak
\end_layout
\begin_layout Standard
-\begin_inset Newpage pagebreak
+\noindent
+Copyright © 2010 by David Pollak
+\begin_inset Newline newline
\end_inset
+This document is licensed Creative Commons Attribution, Non Commercial,
+ No Derivatives:
+\begin_inset Flex URL
+status open
+\begin_layout Plain Layout
+
+http://creativecommons.org/licenses/by-nc-nd/3.0/
+\end_layout
+
+\end_inset
+
+
\end_layout
\begin_layout Standard
@@ -76,7 +167,40 @@ LatexCommand tableofcontents
\end_layout
\begin_layout Standard
-\begin_inset Newpage clearpage
+\begin_inset FloatList figure
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lstlistoflistings
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+mainmatter
+\end_layout
+
\end_inset
@@ -175,7 +299,17 @@ target "http://exploring.liftweb.net/"
\begin_layout Standard
Lift is different from most web frameworks and it's likely that Lift's differenc
es will present a challenge and a friction if you are familiar with the
- MVC school of web frameworks
+ MVC
+\begin_inset Index
+status open
+
+\begin_layout Plain Layout
+MVC
+\end_layout
+
+\end_inset
+
+ school of web frameworks
\begin_inset Foot
status open
@@ -251,21 +385,10 @@ When writing a Lift app, it's often best to start off with the user interface...
\end_layout
\begin_layout Standard
-\begin_inset listings
-inline false
-status open
-
-\begin_layout Plain Layout
-
\begin_inset CommandInset include
LatexCommand lstinputlisting
filename "chat/src/main/webapp/index.html"
-lstparams "caption={index.html}"
-
-\end_inset
-
-
-\end_layout
+lstparams "caption={index.html},language=XML"
\end_inset
@@ -2691,5 +2814,14 @@ I've looked at Atmosphere and CometD (both JVM-oriented Comet technologies).
per page or connection starvation avoidance.
\end_layout
+\begin_layout Standard
+\begin_inset CommandInset index_print
+LatexCommand printindex
+
+\end_inset
+
+
+\end_layout
+
\end_body
\end_document
Oops, something went wrong.

0 comments on commit a4c42c4

Please sign in to comment.