![]() the page's type).Įntries without a type can be searched for but won't be listed in the app's sidebar (unless no other entries have a type). It is usually guessed from the slug (documented above) or by searching the HTML markup.ĭefault: modified version of slug (underscores are replaced with spaces and forward slashes with dots) The base class already implements the call method and includes four methods which the subclasses can override: The following two models are used under the hood to represent the metadata:Įach scraper must implement its own EntriesFilter by subclassing the Docs::EntriesFilter class. The Entries filter is responsible for extracting the page's metadata, represented by a set of entries, each with a name, type and path. It'll make updating the documentation easier. Try to document your filter's behavior as much as possible, particularly modifications that apply only to a subset of pages.Custom CSS is the preferred way of normalizing the pages (except for hiding stuff which should always be done by removing the markup). ![]() ![]() Although the goal is to end up with a clean version of the page, try to keep the number of modifications to a minimum, so as to make the code easier to maintain. ![]() Empty elements will be automatically removed by the core CleanTextFilter later in the pipeline's execution.name = 'th' end # Remove code highlighting css ( 'pre' ). at_css ( 'a' ) end # Make proper table headers css ( 'td.header' ). Module Docs class MyScraper class CleanHtmlFilter instead of an empty css ( 'h3' ). Here's an example implementation that covers the most common use-cases: Nokogiri's many jQuery-like methods make it easy to search and modify elements - see the API docs. Only the core documentation should remain at the end. The CleanHtml filter is tasked with cleaning the HTML markup where necessary and removing anything superfluous or nonessential. The class's name must be the CamelCase equivalent of the filename. Note: filters are located in the lib/docs/filters directory. Scrapers can have any number of custom filters but require at least the two described below. EntriesFilter - abstract filter for extracting the page's metadata.TitleFilter - prepends the document with a title (disabled by default).AttributionFilter - appends the license info and link to the original document. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |