Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:jgarber/redcloth
Browse files Browse the repository at this point in the history
  • Loading branch information
kleb committed Mar 7, 2009
2 parents e2d48eb + 75a57cc commit 8c60c35
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/redcloth/formatters/latex.rb
Expand Up @@ -18,8 +18,8 @@ def latex_image_styles
{ :h1 => 'section*',
:h2 => 'subsection*',
:h3 => 'subsubsection*',
:h4 => 'textbf',
:h5 => 'textbf',
:h4 => 'paragraph*',
:h5 => 'subparagraph*',
:h6 => 'textbf',
}.each do |m,tag|
define_method(m) do |opts|
Expand Down Expand Up @@ -179,7 +179,7 @@ def image(opts)
# Resolve CSS styles if any have been set
styling = opts[:class].to_s.split(/\s+/).collect { |style| latex_image_styles[style] }.compact.join ','
# Build latex code
[ "\\begin{figure}[htp]",
[ "\\begin{figure}[htbp]",
" \\includegraphics[#{styling}]{#{opts[:src]}}",
(" \\caption{#{escape opts[:title]}}" if opts[:title]),
(" \\label{#{escape opts[:alt]}}" if opts[:alt]),
Expand Down
10 changes: 5 additions & 5 deletions test/images.yml
Expand Up @@ -2,15 +2,15 @@
in: This is an !image.jpg!
html: <p>This is an <img src="image.jpg" alt="" /></p>
latex: |+
This is an \begin{figure}[htp]
This is an \begin{figure}[htbp]
\includegraphics[]{image.jpg}
\end{figure}
---
in: This is an !image.jpg(with alt text)!
html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" /></p>
latex: |+
This is an \begin{figure}[htp]
This is an \begin{figure}[htbp]
\includegraphics[]{image.jpg}
\caption{with alt text}
\end{figure}
Expand Down Expand Up @@ -192,7 +192,7 @@ name: image with relative src with dot
in: "!../../image.jpg!"
html: <p><img src="../../image.jpg" alt="" /></p>
latex: |+
\begin{figure}[htp]
\begin{figure}[htbp]
\includegraphics[]{../../image.jpg}
\end{figure}
Expand Down Expand Up @@ -225,7 +225,7 @@ name: image attributes has ampersand html entity in alt and title
in: "!/pictures/cat_and_fox.jpg(Trady Blix & The cartoon fox)!"
html: '<p><img src="/pictures/cat_and_fox.jpg" title="Trady Blix &amp; The cartoon fox" alt="Trady Blix &amp; The cartoon fox" /></p>'
latex: |+
\begin{figure}[htp]
\begin{figure}[htbp]
\includegraphics[]{/pictures/cat_and_fox.jpg}
\caption{Trady Blix \& The cartoon fox}
\end{figure}
Expand All @@ -235,7 +235,7 @@ name: image attributes has double quote html entity in alt and title
in: '!/pictures/bacon.jpg(The fox said: "Have some chunky bacon")!'
html: '<p><img src="/pictures/bacon.jpg" title="The fox said: &quot;Have some chunky bacon&quot;" alt="The fox said: &quot;Have some chunky bacon&quot;" /></p>'
latex: |+
\begin{figure}[htp]
\begin{figure}[htbp]
\includegraphics[]{/pictures/bacon.jpg}
\caption{The fox said: "Have some chunky bacon"}
\end{figure}
Expand Down
26 changes: 23 additions & 3 deletions test/textism.yml
Expand Up @@ -2,17 +2,32 @@
name: header one
in: h1. Header 1
html: <h1>Header 1</h1>
latex: "\section*{Header 1}\n\n"
latex: "\\section*{Header 1}\n\n"
---
name: header two
in: h2. Header 2
html: <h2>Header 2</h2>
latex: "\subsection*{Header 2}\n\n"
latex: "\\subsection*{Header 2}\n\n"
---
name: header three
in: h3. Header 3
html: <h3>Header 3</h3>
latex: "\subsubsection*{Header 3}\n\n"
latex: "\\subsubsection*{Header 3}\n\n"
---
name: header four
in: h4. Header 4
html: <h4>Header 4</h4>
latex: "\\paragraph*{Header 4}\n\n"
---
name: header five
in: h5. Header 5
html: <h5>Header 5</h5>
latex: "\\subparagraph*{Header 5}\n\n"
---
name: header six
in: h6. Header 6
html: <h6>Header 6</h6>
latex: "\\textbf{Header 6}\n\n"
---
name: blockquote
in: |-
Expand Down Expand Up @@ -188,6 +203,11 @@ html: |-
<td>row</td>
</tr>
</table>
latex: |
\begin{tabular}{ l l l l l }
This & is & a & simple & table \\
This & is & a & simple & row \\
\end{tabular}
---
in: |-
table{border:1px solid black}.
Expand Down

0 comments on commit 8c60c35

Please sign in to comment.