01 Mar 2022 00:06:08 UTC
- Distribution: Org-To-HTML
- Module version: 0.235
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (508 / 0 / 1)
- KwaliteeBus factor: 1
- 45.39% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity24 month
- Download (25.73KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userPERLANCAR perlancarand 2 contributors
- Harald Jörg
- Steven Haryanto
- SEE ALSO
- COPYRIGHT AND LICENSE
Org::To::HTML - Export Org document to HTML
This document describes version 0.235 of Org::To::HTML (from Perl distribution Org-To-HTML), released on 2022-02-12.
use Org::To::HTML qw(org_to_html); # non-OO interface my $res = org_to_html( source_file => 'todo.org', # or source_str #target_file => 'todo.html', # defaults return the HTML in $res-> #html_title => 'My Todo List', # defaults to file name #include_tags => [...], # default exports all tags. #exclude_tags => [...], # behavior mimics emacs's include/exclude rule #css_url => '/path/to/my/style.css', # default none #naked => 0, # if set to 1, no HTML/HEAD/BODY will be output. ); die "Failed" unless $res-> == 200; # OO interface my $oeh = Org::To::HTML->new(); my $html = $oeh->export($doc); # $doc is Org::Document object
Export Org format to HTML. To customize, you can subclass this module.
Note that this module is just a simple exporter, for "serious" work you'll probably want to use the exporting features or org-mode.
Export document to HTML.
org_to_html(%args) -> [$status_code, $reason, $payload, \%result_meta]
Export Org document to HTML.
This is the non-OO interface. For more customization, consider subclassing Org::To::HTML.
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
css_url => str
Add a link to CSS document.
exclude_tags => array[str]
Exclude trees that carry one of these tags.
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.
html_title => str
HTML document title, defaults to source_file.
ignore_unknown_settings => bool
include_tags => array[str]
Include trees that carry one of these tags.
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.
inline_images => bool (default: 1)
If set to true, will make link to an image filename into an <img> element instead of <a>.
naked => bool
Don't wrap exported HTML with HTML/HEAD/BODY elements.
source_file => str
Source Org file to export.
source_str => str
Alternatively you can specify Org string directly.
target_file => str
HTML file to write to.
If not specified, HTML string will be returned.
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
If set to true, export_document() will not output HTML/HEAD/BODY wrapping element. Default is false.
Title to use in TITLE HTML element, to override
#+TITLEsetting in the Org document. If unset and document does not have
#+TITLEsetting, will default to the name of the source file, or
If set, export_document() will output a LINK element pointing to this CSS.
This module might come in handy if you want to customize the Org-to-HTML translation with Perl, for example when you want to customize the default HTML title when there's no
#+TITLEsetting, change translation of table element to an ASCII table, etc.
Please visit the project's homepage at https://metacpan.org/release/Org-To-HTML.
Source repository is at https://github.com/perlancar/perl-Org-To-HTML.
For more information about Org document format, visit http://orgmode.org/
Harald Jörg <Harald.Joerg@arcor.de>
Steven Haryanto <firstname.lastname@example.org>
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, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.
This software is copyright (c) 2022, 2020, 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011 by perlancar <email@example.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
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.
Module Install Instructions
To install Org::To::HTML, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Org::To::HTML
For more information on module installation, please visit the detailed CPAN module installation guide.