Difference between revisions of "Navigating to HTML page"

From Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
< [[HTML_and_ConTeXt]]
+
<< [[HTML_and_ConTeXt]] | [[ Setting_up_ConTeXt_document]] >
  
 
The next step is to retrieve the HTML pages created in the step above. Here I have used the ruby library 'open-uri' to
 
The next step is to retrieve the HTML pages created in the step above. Here I have used the ruby library 'open-uri' to
Line 23: Line 23:
  
 
</pre>
 
</pre>
 +
 +
[[Category:Old_Content]]

Latest revision as of 15:05, 8 June 2020

<< HTML_and_ConTeXt | Setting_up_ConTeXt_document >

The next step is to retrieve the HTML pages created in the step above. Here I have used the ruby library 'open-uri' to retrieve the web-page and another libray 'hpricot' to edit these pages and translate html markup into ConTeXt markup.


#scan_page.rb = Retrieves the html page of interest from the server,
#        navigates to links within the main page and construct a
#        context document
                            
#!/usr/bin/ruby                   
                
require 'rubygems'
require 'open-uri'        # the open-uri library                                                                                   
require 'hpricot'         # the hpricot library                                                                                        
require 'scrape_page'     # user-defined function to filter html  into ConTeXt                                                
                                                                   
# scans the home page and lists     
# all the directories and subdirectories

doc=Hpricot(open("http://ipa.dd.re.ss/AnnRep07"))