The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Org::To::Base - Base class for Org exporters

VERSION

This document describes version 0.236 of Org::To::Base (from Perl distribution Org-To-HTML), released on 2023-11-06.

SYNOPSIS

# Not to be used directly. Use one of its subclasses, like Org::To::HTML.

DESCRIPTION

This module is a base class for Org exporters. To create an exporter, subclass from this class (as well as add Org::To::Role role) and provide an implementation for the export_*() methods. Add extra attributes for export options as necessary (for example, Org::To::HTML adds html_title, css_url, and so on).

ATTRIBUTES

include_tags

Arrayref. Works like Org's 'org-export-select-tags' variable. If the whole document doesn't have any of these tags, then the whole document will be exported. Otherwise, trees that do not carry one of these tags will be excluded. If a selected tree is a subtree, the heading hierarchy above it will also be selected for export, but not the text below those headings.

exclude_tags

Arrayref. If the whole document doesn't have any of these tags, then the whole document will be exported. Otherwise, trees that do not carry one of these tags will be excluded. If a selected tree is a subtree, the heading hierarchy above it will also be selected for export, but not the text below those headings.

exclude_tags is evaluated after "include_tags".

source_file

String. Optional. Can be set for informational purposes, e.g. will be used as default title when document does not set C>#+TITLE>.

METHODS

$exp->export($doc) => STR

Export Org.

$exp->export_elements(@elems) => STR

Export Org element objects and with the children, recursively. Will call various export_*() methods according to element class. Should return a string which is the exported document.

Several hooks are recognized and will be invoked if defined:

  • before_export_element

    Will be called before calling each export_*(). Will be passed hash argument %hash containing these keys: hook (hook name, in this case before_export_element), elem (the element object).

  • after_export_element

    Will be called after calling each export_*(). Will be passed hash argument %hash containing these keys: hook (hook name, in this case after_export_element), elem (the element object).

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Org-To-HTML.

SOURCE

Source repository is at https://github.com/perlancar/perl-Org-To-HTML.

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2022, 2020, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Org-To-HTML

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.