Commits

Anonymous committed 510a88f

moved to RubySocialClub

  • Participants
  • Parent commits d849f92

Comments (0)

Files changed (13)

+source "https://rubygems.org"
+
+gem 'RubySocialClub'
 all: slides handout
 	
 rb_sources: sources/* 
-	cd sources; make
+	rake
 	
 	
 slides: ruby.slides.pdf
 				rm -f *.pdfsync *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg  \
 				*.inx *.ps *.dvi *.pdf *.toc *.out *.url *~ *.out *.log *.bm *.bak \#*\# \
 				*.nav *.snm
-				cd sources; make clean
+				rake clean
 
 SOURCEFILES = beamerthemeruby.sty brianbib.sty images keyval.tex listings.cfg \
 	      listings.sty lstlang1.sty lstlang2.sty lstlang3.sty lstmisc.sty lstpatch.sty \

sources/Makefile

-#| \
-#ruby -e 'print $$stdin.read.gsub(/\s*#NO=OUTPUT.*?==>/m, "\n ==>")' | \
-#ruby -e 'print $$stdin.read.gsub(/\s*#NO=RESULT\n\s*==>\s*.*?\n/m, "\n")' | \
-#ruby -e 'print $$stdin.read.gsub(/\s*\n\s*==>\s*/m, "this_is_the_result;")'
-
-xmptex := $(patsubst %.rb,%.xmp.tex,$(wildcard *.rb))
-#oxmptex := $(patsubst %.rb,%.oxmp.tex,$(wildcard *.rb))
-output := $(patsubst %.rb,%.out,$(wildcard *.rb))
-tex := $(patsubst %.rb,%.tex,$(wildcard *.rb))
-
-all: output snippets/last_update tex xmptex 
-
-xmp:	$(xmp)
-
-output:	$(output)
-
-tex: $(tex)
-
-xmptex: $(xmptex)
-
-oxmptex: $(oxmptex)
-
-%.out: %.rb 
-	echo '' | ruby $< > $@ 2>&1 ; true
-
-%.html: %.rb 
-	./code2html < $< > $@
-
-%.xmp.tex: %.xmp.html 
-	cat $< | ./htmltolatex | ruby -e 'print $$stdin.read.gsub(/\t"\\codestring\{thisistheresult\\_bwdye\}"\t(.*)�$$/, "\t\\\\XMPresult{\\1}�")' | \
-	ruby -e 'print $$stdin.read.gsub(/\\codekeyword\{class\t\}"thisistheresult\\_bwdye"\t(.*)�$$/, "class\t\\\\XMPresult{\\1}�")' > $@
-
-%.tex: %.html htmltolatex 
-	cat $< | ./htmltolatex > $@
-
-%.xmp.rb: %.rb  
-	cat $< | irb -f --noreadline --prompt-mode xmp | \
-	ruby -e 'print $$stdin.read.gsub(/\s*#NO=OUTPUT.*?==>/m, "\n ==>")' | \
-	ruby -e 'print $$stdin.read.gsub(/\s*#NO=RESULT\n\s*==>\s*.*?\n/m, "\n")' | \
-	ruby -e 'print $$stdin.read.gsub(/\s*\n\s*==>\s*/m, "\t\"thisistheresult_bwdye\"\t")'> $@
-	
-
-
-%.oxmp.rb: %.xmp.rb 
-	cat $< | ruby -e 'print $$stdin.read.gsub(/(^.*\#==> |^.*$)/, "")' > $@
-
-clean:
-	rm -f *.out *.tex *~ *.xmp *.xmp.rb *.oxmp *.oxmp.rb *.html snippets/*
-	rm -rf auto 
-
-snippets/Makefile: Makefile.snippets
-	cp $< $@
-
-snippets/last_update: *.rb snippets/Makefile extract_snippets
-	./extract_snippets && cd snippets && make && touch last_update
-	
-prova:
-	cat tmp.xmp.tex | ruby -e 'print $$stdin.read.gsub(/\t"\\codestring\{thisistheresult_bwdye\}"\t(.*)\244$$/, "\t\\\\XMPresult{\\1}\244")'
-	

sources/Makefile.snippets

-xmptex := $(patsubst %.rb,%.xmp.tex,$(wildcard *.rb))
-#oxmptex := $(patsubst %.rb,%.oxmp.tex,$(wildcard *.rb))
-output := $(patsubst %.rb,%.out,$(wildcard *.rb))
-tex := $(patsubst %.rb,%.tex,$(wildcard *.rb))
-
-all: output tex xmptex 
-
-xmp:	$(xmp)
-
-output:	$(output)
-
-tex: $(tex)
-
-xmptex: $(xmptex)
-
-oxmptex: $(oxmptex)
-
-%.out: %.rb Makefile
-	echo '' | ruby $< > $@ 2>&1 ; true
-
-%.html: %.rb Makefile
-	../code2html < $< > $@
-
-%.xmp.tex: %.xmp.html Makefile
-	cat $< | ../htmltolatex | ruby -e 'print $$stdin.read.gsub(/\t"\\codestring\{thisistheresult\\_bwdye\}"\t(.*)�$$/, "\t\\\\XMPresult{\\1}�")' | \
-	ruby -e 'print $$stdin.read.gsub(/\\codekeyword\{class\t\}"thisistheresult\\_bwdye"\t(.*)�$$/, "class\t\\\\XMPresult{\\1}�")' > $@
-	
-%.tex: %.html Makefile
-	cat $< | ../htmltolatex > $@
-
-%.xmp.rb: %.rb Makefile 
-	cat $< | irb -f --noreadline --prompt-mode xmp | \
-	ruby -e 'print $$stdin.read.gsub(/\s*#NO=OUTPUT.*?==>/m, "\n ==>")' | \
-	ruby -e 'print $$stdin.read.gsub(/\s*#NO=RESULT\n\s*==>\s*.*?\n/m, "\n")' | \
-	ruby -e 'print $$stdin.read.gsub(/\s*\n\s*==>\s*/m, "\t\"thisistheresult_bwdye\"\t")'> $@
-
-%.oxmp.rb: %.xmp.rb Makefile
-	cat $< | ruby -e 'print $$stdin.read.gsub(/(^.*\#==> |^.*$)/, "")' > $@
-
-clean:
-	rm -f *.out *.tex *~ *.xmp *.xmp.rb *.oxmp *.oxmp.rb *.html 
-	rm -rf auto 

sources/code2html

-#!/usr/bin/env ruby
-
-require 'rubygems'
-require 'syntax/convertors/html'
-
-if ARGV.size > 0
-    code= File.read(ARGV[0])
-else
-    code= $stdin.read
-end
-
-convertor = Syntax::Convertors::HTML.for_syntax "ruby"
-@code_html = convertor.convert( code )
-
-
-if ARGV.size > 0
-    fn= "#{File.basename(ARGV[0], File.extname(ARGV[0]))}.html"
-    File.open(fn,'w') { |file|  file << @code_html }
-else
-    puts @code_html
-end
-

sources/extract_snippets

-#!/usr/bin/ruby
-
-# Fixme: Implement close on GC.
-#        How is that done?
-class Snippet
-  def initialize(filename)
-    @filename = filename
-    @content = []
-  end
-
-  def print(line)
-    @content << line
-  end
-
-  def strip
-    @content.pop until /[\S]/ =~ @content[-1]
-    @content.shift until /[\S]/ =~  @content[0]
-  end
-
-  def close
-    strip
-    text = @content.join('')
-    if (not File.exist?(@filename+'.rb')) or (File.read(@filename + '.rb') != text)
-      puts "Rewriting #{@filename}.rb"
-      File.open(@filename + '.rb', 'w') do | file |
-        file.print(text)
-      end
-    else
-      puts "Skipped #{@filename}.rb because it was the same"
-    end
-  end
-end
-
-Dir['*.rb'].each do | filename |
-  puts "Splitting #{filename}"
-  File.open(filename) do | file |
-    output = nil
-    file.each do | line |
-      if /^\s*\#+<\/>\#*\s*$/ =~ line 
-        output.close if output
-        output = nil
-      elsif /^\s*\#+<(.*)>\#*\s*$/ =~ line 
-        output.close if output
-        output = nil
-        output = Snippet.new("snippets/#{$1}")
-      elsif output
-        output.print(line)
-      end
-    end
-    output.close if output
-  end
-end

sources/hello_world.rb

 
 #############<hello_puts>############# 
 
-puts "Cosa è puts?"
-puts("un semplice metodo")
+puts "Cosa e` puts?"
+puts("un semplice metodo")

sources/htmltolatex

-#!/usr/bin/ruby -w
-
-require 'rexml/document'
-
-include REXML
-
-text = $stdin.read
-
-file = Document.new text
-body = file.elements['//pre[1]']
-
-class String
-  def to_latex
-    self.gsub(%r!\\|\^|\$|&lt;|&gt;|&amp;|&quot;|#|\{|\}|"|~|_|%| |&!) do | match |
-      case match
-      when '\\' then '\ensuremath{\backslash}'
-      when '^' then '\ensuremath{\hat{\ }}'
-      when '$' then '\$'
-      when '&lt;' then '<'
-      when '&gt;' then '>'
-      when '&amp;' then '\&'
-      when '&quot;' then '"'
-      when '#' then '\#'
-      when '{' then '\{'
-      when '}' then '\}'
-      when '"' then '"'
-      when '~' then '\textasciitilde{}'
-      when '_' then '\_'
-      when '%' then '\%'
-      when ' ' then '\ '
-      when '&' then '\&'
-      end
-    end.gsub('<<', '<{}<').gsub('>>', '>{}>')
-  end
-end
-
-def remap(string)
-  prefisso = "\\code"
-  suff = case string
-    when "comment"
-      "comment"
-    when "method"
-      "functionname"
-    when "attribute"
-      "variablename"
-    when "punct"
-      nil
-    when "constant"
-      "variablename"
-    when "number"
-      "type"
-    when "ident"
-      nil
-    when "symbol"
-      "type"
-    when "global"
-      "variablename"
-    when "string"
-      "string"
-    when "keyword"
-      "keyword"
-    else       #esistono anche excape ed expr
-      nil  
-  end
-
-  return prefisso + suff unless suff.nil?
-  return ""
-end
-
-first = true
-
-r = ''
-body.each do | e |
-  if e.is_a?Text 
-    t = e.to_s 
-    t = t[1..-1] if first
-    first = false
-    r << t.to_latex
-  else
-    first = false
-    text = e.get_text.to_s 
-    r << text.split("\n",-1).map do | t | 
-      if e.attributes['class'] == 'string' 
-        codes = "\\codestring"    
-        tmp = e.map do |ee|     
-                if ee.is_a?Text 
-                  ee.to_s.to_latex
-                else    
-                  eet = ee.get_text.to_s 
-                  pref = remap(ee.attributes['class'])
-                  "#{pref}#{'{' unless pref.nil?}#{eet.to_latex}#{'}' unless pref.nil?}" 
-                end
-        end.join
-        codes + "{" + tmp + "}" 
-      elsif (t.to_latex !~ /^\s*$/) 
-        pref = remap(e.attributes['class'])
-        "#{pref}#{'{' if pref != ""}#{t.to_latex}#{'}' if pref != ""}"
-      else
-         ''
-      end
-    end.join("\n")
-  end
-end
-
-lines = r.split("\n")
-lines.map! { | line | "�{#{line.gsub(/^\s*/) { | m | "\\RubyIndent{#{m.gsub(/\t/, '  ').length}}" }}}�" }
-print lines.join("\n")

sources/info/auctex.info

Binary file removed.

sources/info/preview-latex.info

Binary file removed.

sources/irbtorb

-#!/usr/bin/ruby
-
-irb = []
-output = []
-
-$stdin.read.split("\n").each do | line |
-  case line
-  when /^[>?]> (.*?)\s*$/
-    if output.length > 0
-      irb << [:output, output.join("\n")]
-      output = []
-    end
-    irb << [:input, $1]
-  when /^(.*?)=> (.*?)\s*$/
-    irb << [:result, "\t=result=>> #{$2}\n"]
-    o = $1
-    output << '#OUTPUT:' + o unless o =~ /^\S*$/
-    if output.length > 0
-      irb << [:output, output.join('')]
-      output = []
-    end
-  else
-    output << "#OUTPUT:#{line}\n"
-  end
-end
-
-irb.each_index do | i |
-  irb[i][1] << "\n" if (irb[i][0] == :input) and (irb[i+1]) and (irb[i+1][0] != :result)  
-end
-
-print irb.map{|type, text| text}.join("")

sources/object2.rb

 [1, 2, 3, 4, 5].length
 [1, 2, 3, 4, 5].reverse
 
-# Tutto  un oggetto
+# Tutto e` un oggetto
 1.+(2)
 # ma va bene anche in questo modo 
 1 + 2

sources/snippets/.hgkeep

Empty file removed.