App-OrgUtils

 view release on metacpan or  search on metacpan

script/org2html-wp  view on Meta::CPAN

#!perl

use 5.010;
use strict;
use warnings;

use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-01-09'; # DATE
our $DIST = 'App-OrgUtils'; # DIST
our $VERSION = '0.487'; # VERSION

our %SPEC;

$SPEC{app} = {
    v => 1.1,
    summary => 'Convert Org document to HTML (WordPress variant)',
    args => {
        input_filename => {
            schema => 'filename',
            default => '-',
            req => 1,
            pos => 0,
            cmdline_aliases => {i=>{}},
        },
        title => {
            summary => 'HTML title',
            schema => 'str*',
        },
        naked => {
            summary => "Don't wrap HTML with HTML/HEAD/BODY elements",
            schema => ['bool', is=>1],
        },
    },
};
sub app {
    my %args = @_;

    my %oth_args; # args to feed to org_to_html function
    if ($args{input_filename} eq '-') {
        $oth_args{source_str} = do {
            local $/;
            binmode STDIN, ":encoding(utf8)";
            scalar <STDIN>;
        };
    } else {
        $oth_args{source_file} = $args{input_filename};
    }

    $oth_args{ignore_unknown_settings} = 1;
    $oth_args{naked} = $args{naked};
    $oth_args{html_title} = $args{title} if defined $args{title};

    require Org::To::HTML::WordPress;
    Org::To::HTML::WordPress::org_to_html_wordpress(%oth_args);
}

Perinci::CmdLine::Any->new(
    url => '/main/app',
)->run;

# ABSTRACT: Convert Org document to HTML
# PODNAME: org2html-wp

__END__

=pod

=encoding UTF-8

=head1 NAME

org2html-wp - Convert Org document to HTML

=head1 VERSION

This document describes version 0.487 of org2html-wp (from Perl distribution App-OrgUtils), released on 2024-01-09.

=head1 SYNOPSIS

B<org2html-wp> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<org2html-wp> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<org2html-wp> [B<L<--backend|/"--backend=s, -B">>=I<str>|B<L<-B|/"--backend=s, -B">>=I<str>] [B<L<--browser|/"--browser, -b">>|B<L<-b|/"--browser, -b">>] [B<L<--config-path|/"--config-path=s, -c">>=I<path>|B<L<-c|/"--config-path=s, -c">>|B<L<--no-co...

=head1 DESCRIPTION

This is a more user-friendly CLI script for L<Org::To::HTML::WordPress> compared
to L<org-to-html-wordpress> which is a direct CLI version of the function
C<org_to_html_wordpress>.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--backend>=I<s>, B<-B>

Default value:



( run in 1.341 second using v1.01-cache-2.11-cpan-39bf76dae61 )