How can I print Ruby syntax code?

I use TextMate to edit Ruby, but the code is not syntax highlighted when printing files. Are there any good programs for printing well-formatted Ruby color code?

+3
source share
6 answers

A good solution I'm using is to print from TextMate with help vim, which gives you the result with a syntactically allocated and string number (or, nevertheless, you are setting it up). In addition to vimthis, it is required ps2pdfbut they are easy to install with macports, etc.

The only limitation is to save the file first.

, , TextMate.

+2

.

require 'hpricot'               
require 'syntax/convertors/html'
def filter_content(content)
    h = Hpricot(content)
    c = Syntax::Convertors::HTML.for_syntax "ruby"
    h.search('//pre[@class="ruby"]') do |e|
        e.inner_html = c.convert(e.inner_text,false)
    end
    h.to_s
end

: , ... , HTML .

+1

, Mac-, SciTE, Windows HP Laserjet. IDE - .

+1

Ultraviolet, HTML, ...

+1

-, , *.txt , , , . TextMate , , , , .

Aptana , .

vim. vim, , .

vim filename.m
:syntax on
:hardcopy

, , , , .

:syntax on, vim :

vim , :

nano ~/.vimrc
syntax on

+1

, boulder_ruby

2016 (2 10 ):

Windows, , VIM . Qaru , , , 90%). VIM Windows . www.vim.org/download.php

MacVim .

Mac, MacVim, , , , .

: hardcopy VIM. PDF Preview. .

, edavey http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.html, TextMate . TextMate :

, , (View Source as PDF) PDF , .

, ( " " ), PDF, , TextMate. , - ( ).

, .

0

Source: https://habr.com/ru/post/1729444/


All Articles