| 1 | #!/usr/bin/env perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Blio; | ||
| 5 | |||
| 6 | # ABSTRACT: Blio - domm's blogging "engine" | ||
| 7 | # PODNAME: blio.pl | ||
| 8 | |||
| 9 | Blio->new_with_options->run; | ||
| 10 | |||
| 11 | __END__ | ||
| 12 | |||
| 13 | =pod | ||
| 14 | |||
| 15 | =encoding UTF-8 | ||
| 16 | |||
| 17 | =head1 NAME | ||
| 18 | |||
| 19 | blio.pl - Blio - domm's blogging "engine" | ||
| 20 | |||
| 21 | =head1 VERSION | ||
| 22 | |||
| 23 | version 2.003 | ||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | ~/your_blog$ blio.pl --source_dir src --output_dir htdocs --template_dir templates | ||
| 28 | |||
| 29 | =head1 DESCRIPTION | ||
| 30 | |||
| 31 | C<Blio> is a very simple blogging "engine". I call it an '"engine"' because Blio is basically a slightly enhanced and streamlined (for my use cases, at least) ttree, or yet another pre-clone of jekyll. | ||
| 32 | |||
| 33 | In other words, it takes a bunch of plain text files containing some simple headers and some content, runs them through some templates, and writes out some html files for static serving. Blio also does some other things (most notably image handling, powered by Imager). | ||
| 34 | |||
| 35 | =head2 Directory Layout | ||
| 36 | |||
| 37 | C<Blio> needs three directories: F<src>, F<out> and F<templates>. | ||
| 38 | |||
| 39 | F<templates> contains the C<Template::Toolkit> templates used to render the HTML, F<src> contains all your raw content and C<out> containes the rendered HTML content ready for serving by your favourite web server. | ||
| 40 | |||
| 41 | But there a few formal restrictions you need to observer so C<Blio> can work: | ||
| 42 | |||
| 43 | =over | ||
| 44 | |||
| 45 | =item * Each node has to be a plain text file. It should have an all-lowercase filename. It must have an all-ascii filename. It must end in F<'.txt'>. | ||
| 46 | |||
| 47 | =item * If a node should contain sub-nodes, those have to be stored in a directory having exactly the same name as the node, but without the F<'.txt'>. | ||
| 48 | |||
| 49 | =item * If you want to link exactly one image to a node, the image has to have exactly the same name as the node, but with F<'.txt'> replaced with a proper extension. | ||
| 50 | |||
| 51 | =item * If you want to link one or more images to a node, you must put them in a directory at the same level as the node. This directory must have the same name as the node, but with F<'.txt'> replaced by F<'_images'> | ||
| 52 | |||
| 53 | =back | ||
| 54 | |||
| 55 | =head3 Example | ||
| 56 | |||
| 57 | |-- out | ||
| 58 | |-- templates | ||
| 59 | `-- src | ||
| 60 | |-- iceland | ||
| 61 | | |-- geysir.txt | ||
| 62 | | |-- geysir_images | ||
| 63 | | | |-- geysir_1.jpg | ||
| 64 | | | `-- geysir_2.jpg | ||
| 65 | | |-- gullfoss.txt | ||
| 66 | | |-- gullfoss.jpg | ||
| 67 | | `-- no_image.txt | ||
| 68 | `-- iceland.txt | ||
| 69 | |||
| 70 | =head2 Node Format | ||
| 71 | |||
| 72 | Each Node is a simple plain-text UTF8 encoded file consisting of an HTTP-like header, a blank line and the content. | ||
| 73 | |||
| 74 | =head3 Header Fields | ||
| 75 | |||
| 76 | =head4 title | ||
| 77 | |||
| 78 | The title of this blog post. Required | ||
| 79 | |||
| 80 | =head4 date | ||
| 81 | |||
| 82 | The publication date of this post. Has to be parsable by C<DateTime::Format::ISO8601>. If this field is not set in the file, the mtime of the file will be used. | ||
| 83 | |||
| 84 | =head4 language | ||
| 85 | |||
| 86 | The language of this post. See CONFIGURATION. | ||
| 87 | |||
| 88 | =head4 converter | ||
| 89 | |||
| 90 | The converter to use. See CONFIGURATION. | ||
| 91 | |||
| 92 | =head4 feed | ||
| 93 | |||
| 94 | If set to a true value, an RSS feed will be generated containing the children of this node. | ||
| 95 | |||
| 96 | =head4 author | ||
| 97 | |||
| 98 | The name of the author of this post | ||
| 99 | |||
| 100 | =head4 tags | ||
| 101 | |||
| 102 | A comma seperated list of tags. See also the Global Config C<tags> | ||
| 103 | |||
| 104 | =head4 paged_list | ||
| 105 | |||
| 106 | Set to a value > 0 to have the children of this node paged. | ||
| 107 | |||
| 108 | =head4 inline_images | ||
| 109 | |||
| 110 | Enable inline images | ||
| 111 | |||
| 112 | =head4 thumbnail | ||
| 113 | |||
| 114 | Thumbnail size | ||
| 115 | |||
| 116 | =head3 Content | ||
| 117 | |||
| 118 | The content can be generated using the common formatting languages supported by C<Markup::Unified>, or HTML | ||
| 119 | |||
| 120 | =head3 Example | ||
| 121 | |||
| 122 | # file: iceland/geysir.txt | ||
| 123 | title: Geysir | ||
| 124 | converter: textile | ||
| 125 | thumbnail: 400 | ||
| 126 | |||
| 127 | Lots of water | ||
| 128 | |||
| 129 | h4. Food | ||
| 130 | |||
| 131 | There's a small tourist info where you can get soup. | ||
| 132 | |||
| 133 | =head1 INSTALLATION | ||
| 134 | |||
| 135 | C<Blio> runs on L<Perl|http://perl.org> application, and thus requires a rencent Perl (>= 5.10). It also reuses a lot of code from L<CPAN|http://cpan.org>. | ||
| 136 | |||
| 137 | =head2 From CPAN | ||
| 138 | |||
| 139 | The easiest way to install the current stable version of C<Blio> is via L<CPAN|http://cpan.org> and C<cpanminus> | ||
| 140 | |||
| 141 | ~$ cpanm Blio | ||
| 142 | Fetching http://www.cpan.org/authors/id/D/DO/DOMM/Blio-2.002.tar.gz ... OK | ||
| 143 | Configuring Blio-2.002 ... OK | ||
| 144 | ... # installing dependencies | ||
| 145 | Building and testing Blio-2.002 ... OK | ||
| 146 | Successfully installed Blio-2.002 | ||
| 147 | |||
| 148 | If you don't have C<cpanminus> installed yet, L<install it right now|http://search.cpan.org/dist/App-cpanminus/lib/App/cpanminus.pm#INSTALLATION>: | ||
| 149 | |||
| 150 | ~$ curl -L http://cpanmin.us | perl - --sudo App::cpanminus | ||
| 151 | |||
| 152 | =head2 From a tarball or git checkout | ||
| 153 | |||
| 154 | To install C<Blio> from a tarball or a git checkout, you will need L<Dist::Zilla|https://metacpan.org/module/Dist::Zilla> and some C<Dist::Zilla>-plugins | ||
| 155 | |||
| 156 | ~/perl/Blio$ cpanm Dist::Zilla | ||
| 157 | ~/perl/Blio$ dzil authordeps | cpanm | ||
| 158 | |||
| 159 | Now you can build a C<Blio> distributrion | ||
| 160 | |||
| 161 | ~/perl/Blio$ dzil build | ||
| 162 | |||
| 163 | And finally you can install C<Blio> via C<dzil>: | ||
| 164 | |||
| 165 | ~/perl/Blio$ dzil install | ||
| 166 | |||
| 167 | Or change into the build directory (F<Blio-$VERSION>) and do the old install dance: | ||
| 168 | |||
| 169 | ~/perl/Blio/Blio-2.002$ perl Build.PL | ||
| 170 | ~/perl/Blio/Blio-2.002$ ./Build | ||
| 171 | ~/perl/Blio/Blio-2.002$ ./Build test | ||
| 172 | ~/perl/Blio/Blio-2.002$ ./Build install # might require sudo | ||
| 173 | |||
| 174 | =head1 CONFIGURATION | ||
| 175 | |||
| 176 | C<Blio> can be configured via a combination of command line options and a config file. | ||
| 177 | |||
| 178 | See MooseX::Getopt and MooseX::SimpleConfig for the implementation details. | ||
| 179 | |||
| 180 | =head2 Global Config | ||
| 181 | |||
| 182 | Global Config can be specified via command line option or the global config file. | ||
| 183 | |||
| 184 | =head3 configfile | ||
| 185 | |||
| 186 | Path to the configfile. Default 'blio.ini'. The configfile has to be parsable by MooseX::SimpleConfig. | ||
| 187 | |||
| 188 | =head3 source_dir | ||
| 189 | |||
| 190 | The directory containing the plain text source files. Here is where you generate and edit content. Default 'src'. | ||
| 191 | |||
| 192 | =head3 output_dir | ||
| 193 | |||
| 194 | The directory where the rendered HTML files are stored. This directory should be the document root of your webserver. Default 'out'. | ||
| 195 | |||
| 196 | =head3 template_dir | ||
| 197 | |||
| 198 | The directory containing the templates used to render your content. Default 'template'. | ||
| 199 | |||
| 200 | Please note that some very simple (and very ugly) default templates | ||
| 201 | are provided by Blio. They come in the share/templates directory of | ||
| 202 | the distribution and are installed along the module via | ||
| 203 | File::ShareDir. | ||
| 204 | |||
| 205 | =head3 name | ||
| 206 | |||
| 207 | The name of your blog. | ||
| 208 | |||
| 209 | =head3 site_url | ||
| 210 | |||
| 211 | The URL of your blog (needed to generate a proper RSS feed) | ||
| 212 | |||
| 213 | =head3 site_author | ||
| 214 | |||
| 215 | Your name (needed to generate a proper RSS feed) | ||
| 216 | |||
| 217 | =head3 tags | ||
| 218 | |||
| 219 | Set to a true value if you want to use tags in your Blog. If you do, all tags will be collected and added to a vitual top node called 'tags.html'. | ||
| 220 | |||
| 221 | =head3 schedule | ||
| 222 | |||
| 223 | Set to a true value if you want to use the scheduling feature. If active, all node with a date in the future will not be rendered. | ||
| 224 | |||
| 225 | =head3 force | ||
| 226 | |||
| 227 | Force a complete regeneration of the site. Currently, this mostly means that all images will be again converted to thumbnails. | ||
| 228 | |||
| 229 | =head3 quiet | ||
| 230 | |||
| 231 | Do not producde regular output | ||
| 232 | |||
| 233 | =head2 Per-Node config | ||
| 234 | |||
| 235 | Per-Node config can be specified per node, or falls back to a global value specified via command line option or in the config file. | ||
| 236 | |||
| 237 | =head3 language | ||
| 238 | |||
| 239 | The default language of your content. You can set other languages per node. Default "en". | ||
| 240 | |||
| 241 | =head3 converter | ||
| 242 | |||
| 243 | The default text2html converter. You can choose other converters per node. Currently valid converters are: C<html>, C<textile>, C<markdown>, C<bbcode>. If you choose C<html>, the content is not converted at all (because we assume it's already HTML). All other converters are handled via C<Markup::Unified>. | ||
| 244 | |||
| 245 | =head3 thumbnail | ||
| 246 | |||
| 247 | The width (in pixel) of thumbnails that are generated by Blio / Imager. Default "300". | ||
| 248 | |||
| 249 | =head1 USAGE | ||
| 250 | |||
| 251 | =head2 DIRECTORY LAYOUT | ||
| 252 | |||
| 253 | =head2 NODE SYNTAX | ||
| 254 | |||
| 255 | =head1 TEMPLATES | ||
| 256 | |||
| 257 | =head2 Methods available in templates | ||
| 258 | |||
| 259 | =head3 $blio->.. | ||
| 260 | |||
| 261 | =head3 $node->.. | ||
| 262 | |||
| 263 | =head1 ARTICLES & PRESENTATIONS | ||
| 264 | |||
| 265 | =over 4 | ||
| 266 | |||
| 267 | =item 2013.05.03 | ||
| 268 | |||
| 269 | L<Talk at Linuxwochen 2013 Wien|http://domm.plix.at/talks/blio.html> (in german) | ||
| 270 | |||
| 271 | =item 2013.03.28 | ||
| 272 | |||
| 273 | L<Building a static blog using Blio and Github|http://perl5maven.com/building-a-static-blog-using-blio-and-github> | ||
| 274 | |||
| 275 | =item 2013.01.20 | ||
| 276 | |||
| 277 | L<Blio updates|http://domm.plix.at/perl/2013_01_blio_updates.html> | ||
| 278 | |||
| 279 | =item 2012.09.11 | ||
| 280 | |||
| 281 | L<Some new Blio features|http://domm.plix.at/perl/2012_09_11_some_new_blio_features.html> | ||
| 282 | |||
| 283 | =item 2012.08.09 | ||
| 284 | |||
| 285 | L<Blio - my blogging "engine"|http://domm.plix.at/perl/2012_08_09_blio_my_blogging_engine.html> | ||
| 286 | |||
| 287 | =back | ||
| 288 | |||
| 289 | =head1 AUTHOR | ||
| 290 | |||
| 291 | Thomas Klausner <domm@cpan.org> | ||
| 292 | |||
| 293 | =head1 COPYRIGHT AND LICENSE | ||
| 294 | |||
| 295 | This software is copyright (c) 2013 by Thomas Klausner. | ||
| 296 | |||
| 297 | This is free software; you can redistribute it and/or modify it under | ||
| 298 | the same terms as the Perl 5 programming language system itself. | ||
| 299 | |||
| 300 | =cut |