devdocs/lib/docs/scrapers/latex.rb

32 lines
714 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# coding: utf-8
module Docs
class Latex < UrlScraper
self.name = 'LaTeX'
self.slug = 'latex'
self.type = 'simple'
self.release = 'May 2022'
self.links = {
home: 'https://ctan.org/pkg/latex2e-help-texinfo/'
}
self.base_url = 'http://latexref.xyz'
html_filters.push 'latex/entries', 'latex/clean_html'
options[:skip_patterns] = [/^\/dev\//, /\.(dvi|pdf)$/]
options[:attribution] = <<-HTML
&copy; 20072018 Karl Berry<br>
Public Domain Software
HTML
def get_latest_version(opts)
body = fetch('https://latexref.xyz/', opts)
body = body.scan(/\(\w+\s\d+\)/)[0]
body.sub!('(', '')
body.sub!(')', '')
end
end
end