Merge pull request #1548 from Cimbali/latex

pull/1552/head
Simon Legner 4 years ago committed by GitHub
commit 5916ee829c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

File diff suppressed because one or more lines are too long

@ -0,0 +1,25 @@
module Docs
class Latex
class CleanHtmlFilter < Filter
def call
css('hr, div.header, div.referenceinfo').remove
css('div.shortcontents, div.contents, h2.shortcontents-heading, h2.contents-heading, h1.settitle').remove if root_page?
css('span[id] + h1, span[id] + h2, span[id] + h3, span[id] + h4, span[id] + h5, span[id] + h6').each do |node|
id = node.previous['id']
node.previous.remove
node['id'] = id.sub(/-\d$/, '') if id
end
css('h1, h2, h3, h4').each { |node| node.content = node.content.sub /^[0-9A-Z]+(\.[0-9]+)* /, '' }
css('pre').each do |node|
node.delete 'class'
node['data-language'] = 'latex'
end
doc
end
end
end
end

@ -0,0 +1,46 @@
module Docs
class Latex
class EntriesFilter < Docs::EntriesFilter
@@entries = Hash.new
def initialize(*)
super
return unless root_page?
css('.contents > ul > li').each do |node|
lev1 = node.at_css('> a:first-child').text.sub /^[0-9A-Z]+(\.[0-9]+)* /, ''
node.css('a').each do |link|
href = link['href'].split('#')[0].parameterize.downcase
@@entries[href] = lev1
end
end
end
def get_name
at_css('h1, h2, h3, h4, h5, h6').content.sub /^[0-9A-Z]+(\.[0-9]+)* /, ''
end
def get_type
begin
return @@entries[slug.downcase]
rescue
return "Missing type with slug #{slug}"
end
end
def include_default_entry?
true
end
def additional_entries
return []
end
private
end
end
end

@ -0,0 +1,22 @@
module Docs
class Latex < UrlScraper
self.name = 'LaTeX'
self.slug = 'latex'
self.type = 'simple'
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
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

@ -0,0 +1 @@
Compiling \LaTeX with pdflatex https://www.tug.org/applications/pdftex/
Loading…
Cancel
Save