HTML¶
- class astropy.io.ascii.HTML(htmldict={})[source]¶
Bases:
BaseReader
HTML format table.
In order to customize input and output, a dict of parameters may be passed to this class holding specific customizations.
htmldict : Dictionary of parameters for HTML input/output.
- cssCustomized styling
If present, this parameter will be included in a <style> tag and will define stylistic attributes of the output.
- table_idID for the input table
If a string, this defines the HTML id of the table to be processed. If an integer, this specifies the index of the input table in the available tables. Unless this parameter is given, the reader will use the first table found in the input file.
- multicolUse multi-dimensional columns for output
The writer will output tuples as elements of multi-dimensional columns if this parameter is true, and if not then it will use the syntax 1.36583e-13 .. 1.36583e-13 for output. If not present, this parameter will be true by default.
- raw_html_colscolumn name or list of names with raw HTML content
This allows one to include raw HTML content in the column output, for instance to include link references in a table. This option requires that the bleach package be installed. Only whitelisted tags are allowed through for security reasons (see the raw_html_clean_kwargs arg).
- raw_html_clean_kwargsdict of keyword args controlling HTML cleaning
Raw HTML will be cleaned to prevent unsafe HTML from ending up in the table output. This is done by calling
bleach.clean(data, **raw_html_clean_kwargs)
. For details on the available options (e.g. tag whitelist) see: https://bleach.readthedocs.io/en/latest/clean.html
- parserSpecific HTML parsing library to use
If specified, this specifies which HTML parsing library BeautifulSoup should use as a backend. The options to choose from are ‘html.parser’ (the standard library parser), ‘lxml’ (the recommended parser), ‘xml’ (lxml’s XML parser), and ‘html5lib’. html5lib is a highly lenient parser and therefore might work correctly for unusual input if a different parser fails.
jsfiles : list of js files to include when writing table.
cssfiles : list of css files to include when writing table.
js : js script to include in the body when writing table.
table_class : css class for the table
Initialize classes for HTML reading and writing.
Attributes Summary
Methods Summary
fill_values
(col, col_str_iters)Return an iterator of the values with replacements based on fill_values
read
(table)Read the
table
in HTML format and return a resultingTable
.write
(table)Return data in
table
converted to HTML as a list of strings.Attributes Documentation
- max_ndim = 2¶
Methods Documentation