iXBRLViewerPlugin.iXBRLViewer

Module Contents

Classes

NamespaceMap

Class for building a 1:1 map of prefixes to namespace URIs Will attempt to use a provided, preferred prefix, but will uniquify as required.

IXBRLViewerBuilder

iXBRLViewerFile

iXBRLViewer

Functions

Data

API

iXBRLViewerPlugin.iXBRLViewer.REPORT_TYPE_EXTENSIONS

(‘.xbrl’, ‘.xhtml’, ‘.html’, ‘.htm’, ‘.json’)

iXBRLViewerPlugin.iXBRLViewer.UNRECOGNIZED_LINKBASE_LOCAL_DOCUMENTS_TYPE

‘unrecognizedLinkbase’

None

iXBRLViewerPlugin.iXBRLViewer.WIDER_NARROWER_ARCROLE

‘http://www.esma.europa.eu/xbrl/esef/arcrole/wider-narrower’

class iXBRLViewerPlugin.iXBRLViewer.NamespaceMap

Class for building a 1:1 map of prefixes to namespace URIs Will attempt to use a provided, preferred prefix, but will uniquify as required.

Initialization

getPrefix(ns, preferredPrefix=None)

Get the prefix for the specified namespace.

If no prefix is yet defined, define one using the preferred prefix, if provided and not yet used, otherwise add a number to the end of the preferred prefix (or the string “ns”)

qname(qname)
exception iXBRLViewerPlugin.iXBRLViewer.IXBRLViewerBuilderError

Bases: Exception

iXBRLViewerPlugin.iXBRLViewer.isInlineDoc(doc: arelle.ModelDocument.ModelDocument | None) bool
class iXBRLViewerPlugin.iXBRLViewer.IXBRLViewerBuilder(cntlr: Cntlr, basenameSuffix: str = '', useStubViewer: bool = False, features: dict[str, Any] | None = None)

Initialization

outputFilename(filename)
lineWrap(s, n=80)
dateFormat(d)

Strip the time component from an ISO date if it’s zero

escapeJSONForScriptTag(s)

JSON encodes XML special characters XML and HTML apply difference escaping rules to content within script tags and we need our output to be valid XML, but treated as HTML by browsers.

If we allow XML escaping to occur in a script tag, browsers treating the document as HTML won’t unescape it. If we don’t escape XML special characters, it won’t be valid XML. We avoid this whole mess by escaping XML special characters using JSON string escapes. This is only safe to do because < > and & can’t occur outside a string in JSON. It can’t safely be used on JS.

addRoleDefinition(report: arelle.ModelXbrl.ModelXbrl, elr)
addConcept(report: arelle.ModelXbrl.ModelXbrl, concept, dimensionType=None)
treeWalk(rels, item, indent=0)
getRelationships(report: arelle.ModelXbrl.ModelXbrl)
validationErrors()
addFact(report: arelle.ModelXbrl.ModelXbrl, f)
oimUnitString(unit)

Returns an OIM-format string representation of the given ModelUnit. See https://www.xbrl.org/Specification/oim-common/REC-2021-10-13/oim-common-REC-2021-10-13.html#term-unit-string-representation

Parameters:

unit – ModelUnit

Returns:

String representation of unit (OIM format)

addViewerData(viewerFile, scriptUrl)
getStubDocument()
newTargetReport(target)
addSourceReport()
processModel(report: arelle.ModelXbrl.ModelXbrl)
createViewer(scriptUrl: str = DEFAULT_JS_FILENAME, showValidations: bool = True, packageDownloadURL: str | None = None) iXBRLViewerPlugin.iXBRLViewer.iXBRLViewer | None

Create an iXBRL file with XBRL data as a JSON blob, and script tags added.

Parameters:
  • scriptUrl – The src value of the script tag that loads the viewer script.

  • showValidations – True if validation errors should be included in output taxonomy data.

Returns:

An iXBRLViewer instance that is ready to be saved.

class iXBRLViewerPlugin.iXBRLViewer.iXBRLViewerFile(filename, xmlDocument)

Initialization

class iXBRLViewerPlugin.iXBRLViewer.iXBRLViewer(cntlr: Cntlr)

Initialization

addReportAssets(assets)
addFile(ivf)
property files
addFilingDoc(filingDocuments)
save(destination: io.BytesIO | str, zipOutput: bool = False, copyScriptPath: pathlib.Path | None = None)

Save the iXBRL viewer.

Parameters:
  • destination – The target that viewer data/files will be written to (path to file/directory, or a file object itself).

  • zipOutput – True if the destination is a zip archive.

  • copyScriptPath – If provided, the path from where the viewer JS will be copied into the output from.

_copyScript(destDirectory: pathlib.Path, scriptPath: pathlib.Path)