| 1 | package XML::Grammar::Fiction; | ||
| 2 | 1 | $XML::Grammar::Fiction::VERSION = '0.22.0'; | |
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | |||
| 7 | 1 | 1; | |
| 8 | |||
| 9 | __END__ | ||
| 10 | |||
| 11 | =pod | ||
| 12 | |||
| 13 | =encoding UTF-8 | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | XML::Grammar::Fiction - CPAN distribution implementing an XML grammar | ||
| 18 | and a lightweight markup language for stories, novels and other fiction. | ||
| 19 | |||
| 20 | =head1 VERSION | ||
| 21 | |||
| 22 | version 0.22.0 | ||
| 23 | |||
| 24 | =head1 SYNOPSIS | ||
| 25 | |||
| 26 | See L<XML::Grammar::Fiction::FromProto>, | ||
| 27 | L<XML::Grammar::Fiction::ToDocBook> and | ||
| 28 | L<XML::Grammar::Fiction::ToHTML>. | ||
| 29 | |||
| 30 | =head1 DESCRIPTION | ||
| 31 | |||
| 32 | XML::Grammar::Fiction is a CPAN distribution that facilitates writing prose | ||
| 33 | fiction (= stories, novels, novellas, etc.). What it does is: | ||
| 34 | |||
| 35 | =over 4 | ||
| 36 | |||
| 37 | =item 1. Convert a well-formed plain text format to a specialized XML format. | ||
| 38 | |||
| 39 | =item 2. Convert the XML to DocBook/XML or directly to HTML for rendering. | ||
| 40 | |||
| 41 | =back | ||
| 42 | |||
| 43 | The best way to use it non-programatically is using | ||
| 44 | L<XML::Grammar::Fiction::App::FromProto>, | ||
| 45 | L<XML::Grammar::Fiction::App::ToDocBook> and | ||
| 46 | L<XML::Grammar::Fiction::App::ToHTML>, which are modules implementing | ||
| 47 | command line applications for their processing. | ||
| 48 | |||
| 49 | In order to be able to share the common code and functionality more easily, | ||
| 50 | then L<XML::Grammar::Screenplay>, which provides similar XML grammar and | ||
| 51 | text-based markup language for writing screenplays, is now included in this | ||
| 52 | CPAN distribution, and you can refer to its documentation as well: | ||
| 53 | L<XML::Grammar::Screenplay> . | ||
| 54 | |||
| 55 | The rest of this page will document the syntax of the custom textual format. | ||
| 56 | |||
| 57 | =head1 FORMAT | ||
| 58 | |||
| 59 | =head2 Sections | ||
| 60 | |||
| 61 | Sections are placed in XML-like tags of C<< <section> ... </section> >> or | ||
| 62 | abbreviated as C<< <s> ... </s> >>. Opening tags in the format may have | ||
| 63 | attributes whose keys are plaintext and whose values are surrounded by | ||
| 64 | double quotes. (Single-quotes are not supported). | ||
| 65 | |||
| 66 | The section tag must have an C<id> attribute (for anchors, etc.) and could | ||
| 67 | contain an optional (but highly recommended) C<< <title> >> sub-tag. If the | ||
| 68 | title is not specified, it will default to the ID. | ||
| 69 | |||
| 70 | Sections may be B<nested>. | ||
| 71 | |||
| 72 | =head2 Text | ||
| 73 | |||
| 74 | Text is any of: | ||
| 75 | |||
| 76 | =over 4 | ||
| 77 | |||
| 78 | =item 1. Plaintext | ||
| 79 | |||
| 80 | Regular text | ||
| 81 | |||
| 82 | =item 2. XML-like tags. | ||
| 83 | |||
| 84 | Supported tags are C<< <b> >> for bold text, and C<< <i> >> for italic | ||
| 85 | text. | ||
| 86 | |||
| 87 | =item 3. Entities | ||
| 88 | |||
| 89 | The text format supports SGML-like entities such as C<< & >>, | ||
| 90 | C<< < >>, C<< " >> and all other entities that are supported by | ||
| 91 | L<HTML::Entities>. | ||
| 92 | |||
| 93 | =item 4. Supported initial characters | ||
| 94 | |||
| 95 | The following characters can start a regular paragraph: | ||
| 96 | |||
| 97 | =over 4 | ||
| 98 | |||
| 99 | =item * Any alphanumeric character. | ||
| 100 | |||
| 101 | =item * Some special characters: | ||
| 102 | |||
| 103 | The characters C<"> (double quotes), C<'> (single quotes), etc. are supported. | ||
| 104 | |||
| 105 | =item * XML/SGML entities. | ||
| 106 | |||
| 107 | XML/SGML entities are also supported at the start. | ||
| 108 | |||
| 109 | =back | ||
| 110 | |||
| 111 | All other characters are reserved for special markup in the future. If you | ||
| 112 | need to use them at the beginning of the paragraph you can escape them with | ||
| 113 | a backslash (C<\>) or their SGML/XML entity (e.g: C<&qout;>). | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | =head2 Types of top-level items. | ||
| 118 | |||
| 119 | =head3 Paragraphs | ||
| 120 | |||
| 121 | These are not delimited by anything - just a paragraph of text not containing | ||
| 122 | an empty line. If a paragraph starts with a Plus sign ( C<+> ) then it is | ||
| 123 | immediately expected to be followed by a styling tag (as opposed to a | ||
| 124 | |||
| 125 | =head3 <ol> | ||
| 126 | |||
| 127 | This is an ordered list with <li>s, similar to its purpose in XHTML. | ||
| 128 | |||
| 129 | =head3 <ul> | ||
| 130 | |||
| 131 | An unordered list. | ||
| 132 | |||
| 133 | =head2 EXAMPLES | ||
| 134 | |||
| 135 | =head3 Examples Document. | ||
| 136 | |||
| 137 | <body id="index" lang="en-UK"> | ||
| 138 | |||
| 139 | <title>David vs. Goliath - Part I</title> | ||
| 140 | |||
| 141 | <s id="top"> | ||
| 142 | |||
| 143 | <title>The Top Section</title> | ||
| 144 | |||
| 145 | <!-- David has Green hair here --> | ||
| 146 | |||
| 147 | King <a href="http://en.wikipedia.org/wiki/David">David</a> and Goliath | ||
| 148 | were standing by each other. | ||
| 149 | |||
| 150 | David said unto Goliath: “I will shoot you. I <b>swear</b> I will” | ||
| 151 | |||
| 152 | <s id="goliath"> | ||
| 153 | |||
| 154 | <title>Goliath's Response</title> | ||
| 155 | |||
| 156 | <!-- Goliath has to reply to that. --> | ||
| 157 | |||
| 158 | Goliath was not amused. | ||
| 159 | |||
| 160 | He said to David: “Oh, really. <i>David</i>, the red-headed!”. | ||
| 161 | |||
| 162 | </s> | ||
| 163 | |||
| 164 | </s> | ||
| 165 | |||
| 166 | </body> | ||
| 167 | |||
| 168 | =head3 Other Examples | ||
| 169 | |||
| 170 | Examples can be found in the C<t/data> directory, and here: | ||
| 171 | |||
| 172 | =over 4 | ||
| 173 | |||
| 174 | =item * The Pope Died on Sunday (Hebrew version) | ||
| 175 | |||
| 176 | L<http://www.shlomifish.org/humour/Pope/> | ||
| 177 | |||
| 178 | =item * The Enemy and How I Helped to Fight it (Hebrew version) | ||
| 179 | |||
| 180 | L<http://www.shlomifish.org/humour/TheEnemy/> | ||
| 181 | |||
| 182 | =item * The Human Hacking Field Guide (Hebrew version) | ||
| 183 | |||
| 184 | L<http://www.shlomifish.org/humour/human-hacking/> | ||
| 185 | |||
| 186 | =back | ||
| 187 | |||
| 188 | =head1 MOTIVATION | ||
| 189 | |||
| 190 | I (= Shlomi Fish) originated this CPAN distribution (after forking | ||
| 191 | L<XML:Grammar::Screenplay> which was similar enough) so I'll have a convenient | ||
| 192 | way to edit a story I'm writing in Hebrew and similar fiction, as | ||
| 193 | OpenOffice.org caused me many problems, and I found editing bi-directional | ||
| 194 | DocBook/XML to be painful with either gvim or KDE 4's kate, so I opted for a | ||
| 195 | more plain-texty format. | ||
| 196 | |||
| 197 | I hope a lightweight markup language like that for fiction (and possibly | ||
| 198 | other types of manuscripts) will prove useful for other writers. At the | ||
| 199 | moment, a lot of stuff in the proto-text format is subject to change, | ||
| 200 | so you'll need to accept that some modifications to your sources will be | ||
| 201 | required in the future. I hope you still find it useful and let me know | ||
| 202 | if you need any feature or bug-fix. | ||
| 203 | |||
| 204 | =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan | ||
| 205 | |||
| 206 | =head1 SUPPORT | ||
| 207 | |||
| 208 | =head2 Websites | ||
| 209 | |||
| 210 | The following websites have more information about this module, and may be of help to you. As always, | ||
| 211 | in addition to those websites please use your favorite search engine to discover more resources. | ||
| 212 | |||
| 213 | =over 4 | ||
| 214 | |||
| 215 | =item * | ||
| 216 | |||
| 217 | MetaCPAN | ||
| 218 | |||
| 219 | A modern, open-source CPAN search engine, useful to view POD in HTML format. | ||
| 220 | |||
| 221 | L<https://metacpan.org/release/XML-Grammar-Fiction> | ||
| 222 | |||
| 223 | =item * | ||
| 224 | |||
| 225 | RT: CPAN's Bug Tracker | ||
| 226 | |||
| 227 | The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. | ||
| 228 | |||
| 229 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=XML-Grammar-Fiction> | ||
| 230 | |||
| 231 | =item * | ||
| 232 | |||
| 233 | CPANTS | ||
| 234 | |||
| 235 | The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. | ||
| 236 | |||
| 237 | L<http://cpants.cpanauthors.org/dist/XML-Grammar-Fiction> | ||
| 238 | |||
| 239 | =item * | ||
| 240 | |||
| 241 | CPAN Testers | ||
| 242 | |||
| 243 | The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. | ||
| 244 | |||
| 245 | L<http://www.cpantesters.org/distro/X/XML-Grammar-Fiction> | ||
| 246 | |||
| 247 | =item * | ||
| 248 | |||
| 249 | CPAN Testers Matrix | ||
| 250 | |||
| 251 | The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. | ||
| 252 | |||
| 253 | L<http://matrix.cpantesters.org/?dist=XML-Grammar-Fiction> | ||
| 254 | |||
| 255 | =item * | ||
| 256 | |||
| 257 | CPAN Testers Dependencies | ||
| 258 | |||
| 259 | The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. | ||
| 260 | |||
| 261 | L<http://deps.cpantesters.org/?module=XML::Grammar::Fiction> | ||
| 262 | |||
| 263 | =back | ||
| 264 | |||
| 265 | =head2 Bugs / Feature Requests | ||
| 266 | |||
| 267 | Please report any bugs or feature requests by email to C<bug-xml-grammar-fiction at rt.cpan.org>, or through | ||
| 268 | the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=XML-Grammar-Fiction>. You will be automatically notified of any | ||
| 269 | progress on the request by the system. | ||
| 270 | |||
| 271 | =head2 Source Code | ||
| 272 | |||
| 273 | The code is open to the world, and available for you to hack on. Please feel free to browse it and play | ||
| 274 | with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull | ||
| 275 | from your repository :) | ||
| 276 | |||
| 277 | L<https://github.com/shlomif/fiction-xml> | ||
| 278 | |||
| 279 | git clone git://github.com/shlomif/fiction-xml.git | ||
| 280 | |||
| 281 | =head1 AUTHOR | ||
| 282 | |||
| 283 | Shlomi Fish <shlomif@cpan.org> | ||
| 284 | |||
| 285 | =head1 BUGS | ||
| 286 | |||
| 287 | Please report any bugs or feature requests on the bugtracker website | ||
| 288 | L<https://github.com/shlomif/fiction-xml/issues> | ||
| 289 | |||
| 290 | When submitting a bug or request, please include a test-file or a | ||
| 291 | patch to an existing test-file that illustrates the bug or desired | ||
| 292 | feature. | ||
| 293 | |||
| 294 | =head1 COPYRIGHT AND LICENSE | ||
| 295 | |||
| 296 | This software is Copyright (c) 2007 by Shlomi Fish. | ||
| 297 | |||
| 298 | This is free software, licensed under: | ||
| 299 | |||
| 300 | The MIT (X11) License | ||
| 301 | |||
| 302 | =cut | ||