diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..96a071d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: python + +matrix: + include: + - python: "pypy" + - python: "pypy3" + - python: "2.7" + - python: "3.5" + - python: "3.6" + - python: "3.7" + - python: "3.8" +install: + - pip install tox +script: + - python --version + - tox -e py + - if [ "$TRAVIS_PYTHON_VERSION" == "3.6" ]; then tox -e style; fi diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..defcc54 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,570 @@ +# Version 3.4 (2019-12-25) + +* Remove macros (Jendrik Seipp). +* Fix MoinMoin URL and email syntax (Jendrik Seipp). + +# Version 3.3 (2019-11-04) + +* Update html target to HTML5 and drop xhtml target (Jendrik Seipp). +* Remove ASCII art and PageMaker targets (Jendrik Seipp). +* Remove %!csv macro (Jendrik Seipp). +* Drop `--css-inside` option (Jendrik Seipp). +* Always use CSS sugar and drop `--css-sugar` option (Jendrik Seipp). +* Remove i18n (Jendrik Seipp). +* Remove plugins and tools that now live in their own repositories (Jendrik Seipp). +* Remove code for unused split feature (Jendrik Seipp). +* Use \n for linebreaks on all platforms as recommended by Python docs (Jendrik Seipp). +* Fix errors detected by flake8 (Jendrik Seipp). +* Fix test statistics (Jendrik Seipp). +* Only keep English docs (Jendrik Seipp). +* Fold sample tests into main test suite (Jendrik Seipp). +* Explain how to install txt2tags with pipx in README file (Jendrik Seipp). + +# Version 3.2 (2019-10-30) + + * Remove GUI (Jendrik Seipp). + * Rename txt2tags to txt2tags.py (Jendrik Seipp). + * Add setup.py file (Jendrik Seipp). + * Upload txt2tags to PyPI (Jendrik Seipp). + +# Version 3.1 (2019-10-29) + + * Check code format with black (Jendrik Seipp). + * Correctly compute title length under Python 3 for txt target (Jendrik Seipp). + * Update and continuously check Python sample scripts under samples/module (Jendrik Seipp). + * Check that sample file is converted to all targets correctly in CI (Jendrik Seipp). + * lout: fix email markup (Martin Michel, backported by Jendrik Seipp). + * man: fix closing lists (Matteo Cypriani, backported by Jendrik Seipp). + * Improve table regex (Aurelio Jargas, backported by Jendrik Seipp). + * man: fix extra line (Nicolas Delvaux, backported by Jendrik Seipp). + * Improve comments inside doHeader() (Aurelio Jargas, backported by Jendrik Seipp). + * Don't list targets manually (Aurelio Jargas, backported by Jendrik Seipp). + * Canonicalize paths before checking whether input and output files match (Jason Seeley, backported by Jendrik Seipp). + +# Version 3.0 (2019-10-21) + + * Convert changelog file to Markdown (Jendrik Seipp). + * Add travis-ci config file (Jendrik Seipp). + * Add tox.ini file for testing multiple Python versions (Jendrik Seipp). + * Reformat test suite with black (Jendrik Seipp). + * Support running test suite under Python 3 (Jendrik Seipp). + * Fix and refactor tests (Jendrik Seipp). + * Add support for SVG images (Jendrik Seipp). + * Don't escape underscores in tagged and raw LaTeX text (Jendrik Seipp). + * Support Python 3 (Jendrik Seipp). + * Use spaces instead of tabs (Jendrik Seipp). + +# Version 2.6 (2010-11-05) + + * New target: art (ASCII Art). (Florent Gallaire) + * New target: adoc (AsciiDoc). (Neil Voss) + * New target: creole (Creole 1.0). (Eric Forgeot) + * New target: dbk (DocBook). (David Hajage) + * New target: pmw (PmWiki). (Ritesh Sood) + + * New mark: `''tagged''` for inline tagged text. + * New mark: `'''` for blocks of tagged text. + + * New option: `--targets` to list all the available targets. + * New option: `--slides` to format output as presentation slides (-t art). (Florent Gallaire) + * New option: `--width` to set the document's width (used by -t art). (Florent Gallaire) + * New option: `--height` to set the document's height (used by -t art). (Florent Gallaire) + * New option: `--art-chars` to set the ASCII Art decorations. (Florent Gallaire) + * New options (turn off): `--no-slides`, `--no-targets`. + + * New command: `%!csv` to include an external CSV file as a table. (Florent Gallaire) + + * HTML/XHTML: Removed those random `

` that used to appear on the output. + * HTML: Headers changed to avoid orphan tags when not using `--css-sugar`. (Thomas Hafner) + * HTML: Removed `id="toc"` from the toc DIV, but `class="toc"` still remains. + * LaTeX: New compact lists with no paragraph breaks between items. (Mark White) + * LaTeX: Added column span and cell alignment to tables. (Mark White) + * LaTeX: UTF-8 encoding is now correctly set as `utf8` instead `utf-8`. (Aad Mathijssen) + * Lout: Removed list indent to avoid gaps in text. (Barrie Stott) + * Lout: Now paragraphs are allowed inside lists. (Barrie Stott) + * Man: Removed indentation in verbatim blocks. + + * i18n: Sample files converted to UTF-8. + * i18n: Manual Pages converted to UTF-8. + * i18n: All .po files converted to UTF-8. + * i18n: Added po/tools folder and po/stats.txt file. + * i18n: Added Basque translations. (Ales Zabala Alava) + * i18n: Added Ukrainian translations. (Bunyk Taras) + * Docs: the Manual Page was rewritten: now a reference not a guide. + * Docs: Markup Demo, Sample File, Manual Page translated to Basque. (Ales Zabala Alava) + * Docs: User Guide translated to Chinese (simplified). (Chris Leng) + * Docs: Sample File translated to Ukrainian. (Bunyk Taras) + + * extras: Added syntax files for JOE, "ne", "le" text editors. (Stefano D'Archino) + * extras: Added a txt2tags markup set for markItUp! (Florent Gallaire) + * extras: Added "dynartslides", a script to generate art slides dynamically. (Florent Gallaire) + * extras: Added the Cookbook to use txt2tags markup in a PmWiki website. (Eric Forgeot) + * extras: t2tmake.rb: Now compatible with ruby 1.9. (Lucas Buchala) + * extras: Improved txt2tags.vim, unhtml.vim and txt2tagsrc files. + * extras: Removed TextMate Bundle, it's already available at TextMate's SVN. + + * PHP Web interface improved: targets in alphabetical order, new $dfttarget. + * Blank lines were added/removed to improve the generated code of all targets. + * No more several blank lines at the end of the document. + * Raw and tagged blocks are allowed inside paragraphs, they don't close it. (Kruzslicz Ferenc) + * If called with no arguments, don't load the Gui. Must use `--gui` to load it. + * The ":" char is now allowed in the query component of a URI (link). (sphaira, Chris lavabit) + * Added TOC formatting example in samples/module/module-body.py file. (Jendrik Seipp) + * Test-suite: 256 tests. New modules: art, csv, include, includeconf, sample. + * Improved some error messages. (Leo Rosa) + * Raise error when using `(target)` in `%!target` and `%!includeconf`. + * The program code is now cleaner/safer with the help of `pychecker`. + * Removed string module import: using `foo.upper()` instead `string.upper(foo)`. + * Bugfix: Now `-C`,`--config-file` respects `(target)` in the config file settings. (Emmanuel Godard) + * Bugfix: Now inline verbatim, raw and tagged marks are really mutually +exclusive. No marks are interpreted inside them. + + * **IMPORTANT:** This release requires Python 2.2 or newer. The only exception +is the new %!csv command that requires Python 2.3 or newer. + + * New website: http://txt2tags.org - Thanks Florent Gallaire for the domain! + + * This release was sponsored by Rubens Queiroz de Almeida. + +# Version 2.5 (2008-07-26) + + * New target: wiki (Wikipedia) (Eric Forgeot @ .fr for the idea) + * New target: gwiki (Google Code Wiki) + * New target: doku (DokuWiki) (Joerg Desch) + * New mark `--` for ~~strikeout~~ text, currently implemented for: +html, xhtml, tex, wiki, gwiki, doku, moin + * New document: How to add a new target to txt2tags + * New tools: TextMate bundle, Gedit language file, gensite program +(see 'extras' folder) + + * Improved Unicode (UTF-8) support + * PHP Web interface rewrote: now configurable, clean and modular + * Moin target improved: added support for definition list and strong line + * LaTeX target improved: Added support for anchors and local links + * Lout target improved: Added support for anchors in titles + * Added PreProc sample on the samples/module/module-body.py file + + * i18n: Added Finnish translations (Mikko J Piippo) + * Docs: Sample file translated to Finnish (Mikko J Piippo) + * Docs: Man Page translated to Chinese (Abby Pan) + * Docs: Portuguese Man Page updated + + * Bugfix: Fixed title underline length on txt target for UTF-8 files (Jan Rejlek) + * Bugfix: Fixed fatal error on sources files with UTF-8 encoding (Miguel Filho) + + * **IMPORTANT:** Txt2tags is not compatible with old Python 1.5.2 anymore, +because Unicode strings were added in Python 2.0. If your Python is +older than 2.0, please use txt2tags version 2.4. + + * This release was sponsored by Dmitri Popov. + +# Version 2.4 (2006-12-24) + + * New mark `%%%` for commented blocks (Leo Rosa) + * The Style config now may be used multiple times + * Different list types on the same indent now forces previous to close + * Empty anchor is now part of a link (i.e. foo.html#) (Fabiano Engler) + * tex: Default headers cleanup, now it's minimalist + * tex: Now limiting the maximum quote depth to six + * tex: User-defined styles now overwrite default formatting on headers + * (x)html: New header comment showing the CSS file path, when using +`--css-inside` + + * i18n: Added Chinese translations (wfifi) + + * Bugfix: xhtml: Fixed encoding declaration when using `--css-sugar` + * Bugfix: (x)html: No empty `' +%!postproc: () 'body { margin:3em ;} \n\1' +%!postproc: () 'a { text-decoration:none ;} \n\1' +%!postproc: () 'pre,code { background-color:#ffffcc ;} \n\1' +%!postproc: () 'th { background-color:yellow ;} \n\1' +``` + +All the filters are tied to the first one, by replacing a string that it +has inserted. So a single "" turns to: + +``` + + +``` + +----------------------------------------------------------------------- + +== Creating "Target-Specific" Contents with %!preproc ==[target-specific-contents] + +Sometimes you need to insert some text on a specific target, but not on +the others. This kind of strange behavior can be done using some +PreProc tricks. + +The idea is to insert this extra text on the document source as +comments, but mark it in a way that a target-specific filter will +"uncomment" those lines. + +For example, if an extra paragraph must be added only in HTML target. +Place the text as special comments, like this: + +``` +%html% This HTML page is Powered by [txt2tags http://txt2tags.org]. +%html% See the source TXT file [here source.t2t]. +``` + +As those lines start with ``%``, they are plain comments lines and will be +ignored. But when adding this special filter: + +``` %preproc(html): '^%html% ' '' + +The leading string is removed and those lines will be "activated", not +being comments anymore. As a explicit target config, this filter will be +processed for HTML targets only. + +----------------------------------------------------------------------- + +== Changing Txt2tags Marks with %!preproc ==[creating-marks] + +Being a Regular Expressions guru, the user can customize the document +source syntax, changing the txt2tags default marks to some he find more +comfortable. + +For example, a leading TAB is the Quotation mark. If the user doesn't +like it, or his text editor has some strange relationship with TABs, he +can define a new mark for Quoted text. Say a leading ">>> " was his +choice. Then he will do this simple filter: + +``` %!preproc: '^>>> ' '\t' + +And on the document source, the quoted text will be something like: + +``` +>>> This is a quoted text. +>>> The user defined this strange mark. +>>> But they will be converted to TABs by PreProc. +``` + +Before the parsing begins, the strange ">>> " will be converted to +TABs and txt2tags will recognize the Quote mark. + + **BEWARE!** Extreme PreProc rules could eventually + change the entire marks syntax, even generating conflicts + between marks. Be really really careful when doing this. + +======================================================================= + += The End = + +Thanks for reading! :) + +URLWEBSITE + +([see source userguide.t2t]) diff --git a/extras/css-reference.txt b/extras/css-reference.txt new file mode 100644 index 0000000..1456b6d --- /dev/null +++ b/extras/css-reference.txt @@ -0,0 +1,163 @@ +%%%%% CSS Reference File (grep friendly) +% +% by Aurelio Jargas +% Part of txt2tags project - http://txt2tags.org +% + + +% +%%% Font Properties +% + +font-family : Verdana, Arial, Helvetica, Times, Courier +font-family : sans-serif, serif, monospace, cursive, fantasy +font-style : normal, italic, oblique +font-variant : normal, small-caps +font-weight : normal, bold, bolder, lighter +font-size : xx-large, x-large, large, medium +font-size : small, x-small, xx-small +font-size : larger, smaller, 120%, 12pt +font : bold 12pt Arial + +% +%%% Color and Background Properties +% + +color : white, #FFF, #FFFFFF, rgb(100%,100%,100%) +color : aqua, black, blue, fuchsia, gray, green, lime +color : maroon, navy, olive, orange, purple, red, silver +color : teal, white, yellow +background-color : transparent, white, #FFF, #FFFFFF +background-image : none, url(file.jpg) +background-repeat : repeat, repeat-x, repeat-y, no-repeat +background-attachment : scroll, fixed +background-position : top, center, bottom, left, center, right +background : white url(file.jpg) repeat-y + +% +%%% Text Properties +% + +text-align : left, right, center, justify +text-decoration : none, underline, overline, line-through, blink +line-height : normal, 5, 5px, 5.0em, 5% +text-indent : 25px, 25% +text-transform : none, capitalize, uppercase, lowercase +letter-spacing : normal, 5pt, 5.0em +word-spacing : normal, 5pt, 5.0em +white-space : normal, pre, nowrap, pre-wrap, pre-line +vertical-align : top, bottom, middle, sub, super +vertical-align : baseline, text-top, text-bottom +direction : ltr, rtl + +% +%%% Box Properties +% + +margin-top : auto, 5px, 5.0em, 5% +margin-right : auto, 5px, 5.0em, 5% +margin-bottom : auto, 5px, 5.0em, 5% +margin-left : auto, 5px, 5.0em, 5% +margin : auto, 5px 10px 5px 10px +padding-top : 5px, 5.0em, 5% +padding-right : 5px, 5.0em, 5% +padding-bottom : 5px, 5.0em, 5% +padding-left : 5px, 5.0em, 5% +padding : 5px 10px 5px 10px +border-top-width : thin, medium, thick, 5px, 5.0em +border-right-width : thin, medium, thick, 5px, 5.0em +border-bottom-width : thin, medium, thick, 5px, 5.0em +border-left-width : thin, medium, thick, 5px, 5.0em +border-width : thin, medium, thick, 5px 10px 5px 10px (T R B L) +border-top-color : white, #FFF, #FFFFFF +border-right-color : white, #FFF, #FFFFFF +border-bottom-color : white, #FFF, #FFFFFF +border-left-color : white, #FFF, #FFFFFF +border-color : white red green blue +border-top-style : none, solid, double, dashed, dotted, groove, ridge, ... +border-right-style : none, solid, double, dashed, dotted, groove, ridge, ... +border-bottom-style : none, solid, double, dashed, dotted, groove, ridge, ... +border-left-style : none, solid, double, dashed, dotted, groove, ridge, ... +border-style : none, solid, double, dashed, dotted, groove, ridge, ... +border-style : ..., inset, outset +border-top : thin solid white (width style color) +border-right : thin solid white (width style color) +border-bottom : thin solid white (width style color) +border-left : thin solid white (width style color) +border : thin solid white (width style color) + +% +%%% List Properties +% + +list-style-type : none, disc, circle, square +list-style-type : decimal, decimal-leading-zero +list-style-type : lower-roman, upper-roman, lower-alpha, upper-alpha +list-style-type : lower-latin, upper-latin, lower-greek +list-style-type : hebrew, armenian, georgian, cjk-ideographic +list-style-type : hiragana, katakana, hiragana-iroha, katakana-iroha +list-style-image : none, url(list.gif) +list-style-position : inside, outside +list-style : square outside url(list.gif) +marker-offset : auto, 5px, 5.0em + +% +%%% Positioning Properties +% + +float : none, left, right +clear : none, left, right, both +clip : auto, rect(0px 200px 200px 0px) +height : auto, 5px, 5.0em +left : auto, 5px, 5.0em, 5% +right : auto, 5px, 5.0em, 5% +overflow : auto, visible, hidden, scroll +position : absolute, relative, static, fixed +top : auto, 5px, 5.0em, 5% +bottom : auto, 5px, 5.0em, 5% +visibility : visible, hidden, collapse +width : auto, 5px, 5.0em, 5% +z-index : auto, 5, -5 +display : none, inherit, inline, block, list-item, run-in, table +display : inline-block, inline-table, table-row, table-cell +display : table-column, table-row-group, table-column-group +display : table-caption, table-header-group, table-footer-group + +% +%%% Table Properties +% + +border-collapse : collapse, separate +border-spacing : 5px, 5.0em +caption-side : top, bottom +empty-cells : show, hide +table-layout : auto, fixed + +% +%%% Printing Properties +% + +page-break-before : auto, always, left, right +page-break-after : auto, always, left, right + +% +%%% Pseudo Classes +% + +active : ... +hover : ... +link : ... +visited : ... +first-letter : ... +first-line : ... + +% +%%% Other +% + +quotes : none, " ", ' ' +cursor : auto, crosshair, default, pointer +cursor : hand, move, text, wait, help, progress +cursor : e-resize, n-resize, s-resize, w-resize +cursor : ne-resize, nw-resize, se-resize, sw-resize + diff --git a/extras/txt2tagsrc b/extras/txt2tagsrc new file mode 100644 index 0000000..b9abe3b --- /dev/null +++ b/extras/txt2tagsrc @@ -0,0 +1,87 @@ +% +% txt2tags sample config file +% +% This is a sample for the .txt2tagsrc user config file. +% Part of the txt2tags project (http://txt2tags.org). +% +% Copy this file to $HOME/.txt2tagsrc (or %homepath%/_t2trc +% on Windows) and edit it to fit your needs. All configs are +% COMMENTED, just remove the leading % for the ones you want +% to use. +% +% The config syntax is: +% +% %!keyword (target) : value +% +% Keywords: +% target, options, encoding, style, preproc, postproc, +% guicolors +% Targets: +% The valid txt2tags targets (i.e.: html, man, tex) +% +% Details: +% - If the '(target)' part is omitted, the config is valid for +% all targets +% - The %!keyword must be at the line start, no leading spaces +% - All the options defined here can be overwritten by command +% line options and document config +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Set a default target if none specified +% Useful if you always use the same target for all documents +%%!target: html + +% Set the default encoding for all documents +% Examples: iso-8859-1, UTF-8 +% This can be turned off later with --no-encoding +%%!encoding: UTF-8 + +% Set the TOC depth for all targets +% Valid values: 1, 2, 3, 4, 5 +% The default is 3 +%%!options: --toc-level 2 + +% Always mask e-mails from robots in HTML and MOIN documents +% Example: john@company.com turns to +% This can be turned off later with --no-mask-email +%%!options(html): --mask-email +%%!options(moin): --mask-email + +% Always enumerate all title lines for text output +% This can be turned off later with --no-enum-title +%%!options(txt): --enum-title + +% Always make TOC (Table of Contents) in LaTeX documents +% This can be turned off later with --no-toc +%%!options(tex): --toc + +% Change the graphical interface colors +% Valid values for colors: colorname, #RGB, #RRGGBB +% The order is: bg1, fg1, bg2, fg2 +%%!guicolors: blue white brown yellow + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% FILTERS +% +% PreProc and PostProc filters are powerful tools to customize +% txt2tags behavior and perform nice tricks. But be careful, +% they do use Regular Expressions and can be dangerous if bad +% written. Really test them before including here. + +% Shorthand for the javascript BACK call in HTML +% Contribution from Prof. Sergio de Albuquerque Souza +% Example: [Click here JAVABACK] to go back. +%%!postproc(html): JAVABACK javascript:history.back() + +% Trick to create super/subscript text in HTML +% Example: I will use ^^superscript^^ and also ,,subscript,, +%%!postproc(html): '\^\^(.*?)\^\^' '\1' +%%!postproc(html): ',,(.*?),,' '\1' + +% LaTeX and TeX names appearing on their classical formats +%%!postproc(tex): LaTeX \\LaTeX{} +%%!postproc(tex): \bTeX \\TeX{} + diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..4c9b649 --- /dev/null +++ b/release.sh @@ -0,0 +1,37 @@ +#! /bin/bash + +set -exuo pipefail + +VERSION="$1" + +# Check dependencies. +twine -h > /dev/null + +# Check for uncommited changes. +set +e +git diff --quiet && git diff --cached --quiet +retcode=$? +set -e +if [[ $retcode != 0 ]]; then + echo "There are uncommited changes:" + git status + exit 1 +fi + +git pull + +# Check that changelog file is up-to-date. +grep "$VERSION" CHANGELOG.md || (echo "Version $VERSION missing in changelog." && exit 1) + +tox + +# Bump version. +sed -i -e "s/__version__ = \".*\"/__version__ = \"${VERSION}\"/" txt2tags.py +git commit -am "Update version number to ${VERSION} for release." +git tag "$VERSION" + +python3 setup.py sdist bdist_wheel --universal +python3 -m twine upload dist/txt2tags-${VERSION}.tar.gz dist/txt2tags-${VERSION}-py2.py3-none-any.whl + +git push +git push --tags diff --git a/samples/css/build b/samples/css/build new file mode 100755 index 0000000..995d869 --- /dev/null +++ b/samples/css/build @@ -0,0 +1,11 @@ +#! /bin/bash +# Convert the CSS samples + +set -euo pipefail + +cd $(dirname "$0") + +for file in *.css ; do + base=${file%.*} + sed 's|img/|../&|' ../sample.t2t | python ../../txt2tags.py --style $base.css -o $base.html --toc -t html - +done diff --git a/samples/css/color.css b/samples/css/color.css new file mode 100644 index 0000000..0047e06 --- /dev/null +++ b/samples/css/color.css @@ -0,0 +1,116 @@ +/* + + color.css - A colorful CSS sample file + + Author : Osvaldo Santana Neto + Date : June 2004 + License: GPL + + Part of the txt2tags project + +*/ + +div.header h1 { + text-align: center; + font-family: Sans-Serif; + font-size: 18pt; + color: #00A; +} + +div.header h2 { + text-align: center; + font-family: Sans-Serif; + font-size: 14pt; +} + +div.header h3 { + text-align: center; + font-family: Sans-Serif; + font-size: 12pt; +} + +div.toc { + margin-top: 24pt; + margin-bottom: 24pt; + padding: 8pt; + border: 1px solid black; + background: #FFFFBB; +} + +div.toc a { + font-family: Sans-Serif; + font-size: 10pt; + color: black; + text-decoration: none; +} + +div.toc a:hover { + text-decoration: underline; +} + +div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { + text-align: left; + font-family: Sans-Serif; +} + +div.body h1 { + font-size: 18pt; +} + +div.body h2 { + font-size: 16pt; +} + +div.body h3 { + font-size: 14pt; +} + +div.body h4 { + font-size: 12pt; +} + +div.body h5 { + font-size: 10pt; + font-weight: bold; +} + +div.body h6 { + font-size: 10pt; +} + +div.body a { + font-family: monospace; + font-size: 8pt; + text-decoration: none; + color: black; +} + +div.body a:hover { + text-decoration: underline; +} + +div.body blockquote { + background: #AACCFF; + padding: 18pt; +} +div.body blockquote p { + margin-top: 2pt; + margin-bottom: 2pt; +} + +div.body pre { + background: #FFFFBB; + padding: 18pt; + border: 1px dashed black; +} + +div.body dt { + background: #BBFFBB; + padding: 3pt; + border: 1px solid black; + font-family: Sans-Serif; + font-size: 10pt; + margin-top: 18pt; + margin-bottom: 8pt; +} + diff --git a/samples/css/modern.css b/samples/css/modern.css new file mode 100644 index 0000000..1032220 --- /dev/null +++ b/samples/css/modern.css @@ -0,0 +1,178 @@ +/* + + modern.css - A modern look CSS sample file + + Author : Osvaldo Santana Neto + Date : June 2004 + License: GPL + + Part of the txt2tags project + +*/ + +body { + margin: 0px; + padding: 0px; + font-family: Garamond, Times, Serif; +} + +div.header { + border-bottom: 2px solid black; +} + +div.header h1 { + float: left; + margin-left: 12pt; + font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: 18pt; + font-weight: bold; +} + +div.header h2 { + text-align: right; + margin-right: 12pt; + font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: 8pt; +} + +div.header h3 { + text-align: right; + margin-right: 12pt; + margin-bottom: 24pt; + font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: 8pt; + font-weight: normal; +} + +div.toc { + float: right; + width: 20%; + padding-left: 6pt; + padding-right: 6pt; +} + +div.toc ul { + padding-left: 6pt; +} + +div.toc li { + font-size: 8pt; +} + +div.toc a { + font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: 14px/1.2; + font-weight: bold; + color: #C00; + text-decoration: none; +} + +div.toc a:hover { + text-decoration: underline; +} + +div.body { + float: left; + width: 75%; + padding: 10px; + border-right: 2px dotted black; + text-align: justify; +} + +div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { + font-family: Verdana, Arial, Helvetica, Sans-Serif; +} + +div.body h1 { + text-align: left; + margin-top: 24pt; + margin-bottom: 18pt; + font-size: 12pt; + border-left: 4px solid black; + border-bottom: 2px solid black; + padding: 5px; + background: #F0F0F0; +} + +div.body h2 { + text-align: left; + margin-top: 24pt; + margin-bottom: 18pt; + font-size: 12pt; + font-weight: normal; + border-left: 4px solid black; + border-bottom: 1px solid black; + padding: 5px; + background: #F0F0F0; +} + +div.body h3 { + text-align: left; + margin-top: 24pt; + margin-bottom: 16pt; + font-size: 8pt; + border-left: 1px solid black; + border-bottom: 1px solid black; + padding: 5px; + background: #F0F0F0; +} + +div.body h4 { + text-align: left; + margin-top: 24pt; + margin-bottom: 16pt; + font-size: 8pt; + font-weight: normal; + border-left: 1px solid black; + border-bottom: 1px solid black; + padding: 5px; +} + +div.body h5 { + width: 80%; + text-align: left; + margin-top: 6pt; + margin-bottom: 16pt; + font-size: 8pt; + padding: 5px; +} + + +div.body a { + font-family: monospace; + font-size: 10pt; + text-decoration: none; + color: #C00; +} + +div.body a:hover { + text-decoration: underline; +} + +div.body blockquote { + border-top: 2px solid black; + border-bottom: 2px solid black; + background: #FFFFBB; + padding: 15px; +} +div.body blockquote p { + margin-top: 2pt; + margin-bottom: 2pt; +} + +div.body pre { + background: #FFFFBB; + padding: 15px; + border: 1px dashed black; +} + +div.body dt { + background: #BBFFBB; + padding: 3pt; + border-left: 3px solid black; + font-family: Verdana, Arial, Helvetica, Sans-Serif; + font-size: 10pt; + margin-top: 18pt; + margin-bottom: 8pt; +} + diff --git a/samples/css/tech.css b/samples/css/tech.css new file mode 100644 index 0000000..1721e36 --- /dev/null +++ b/samples/css/tech.css @@ -0,0 +1,114 @@ +/* + + tech.css - A technical document CSS sample file + + Author : Osvaldo Santana Neto + Date : June 2004 + License: GPL + + Part of the txt2tags project + +*/ + +div.header h1 { + text-align: center; + font-family: Sans-Serif; + font-size: 18pt; +} + +div.header h2 { + text-align: center; + font-family: Sans-Serif; + font-size: 14pt; +} + +div.header h3 { + text-align: center; + font-family: Sans-Serif; + font-size: 12pt; +} + +div.toc { + margin-top: 24pt; + margin-bottom: 24pt; + padding: 8pt; + border: 1px solid black; +} + +div.toc a { + font-family: Sans-Serif; + font-size: 10pt; + color: black; + text-decoration: none; +} + +div.toc a:hover { + text-decoration: underline; +} + +div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 { + text-align: left; + font-family: Sans-Serif; +} + +div.body h1 { + font-size: 18pt; +} + +div.body h2 { + font-size: 16pt; +} + +div.body h3 { + font-size: 14pt; +} + +div.body h4 { + font-size: 12pt; +} + +div.body h5 { + font-size: 10pt; + font-weight: bold; +} + +div.body h6 { + font-size: 10pt; +} + +div.body a { + font-family: monospace; + font-size: 8pt; + text-decoration: none; + color: black; +} + +div.body a:hover { + text-decoration: underline; +} + +div.body blockquote { + background: #eee; + padding: 18pt; +} +div.body blockquote p { + margin-top: 2pt; + margin-bottom: 2pt; +} + +div.body pre { + background: #eee; + padding: 18pt; + border: 1px dashed black; +} + +div.body dt { + background: #eee; + padding: 3pt; + border: 1px solid black; + font-family: Sans-Serif; + font-size: 10pt; + margin-top: 18pt; + margin-bottom: 8pt; +} + diff --git a/samples/img/madeinbr.png b/samples/img/madeinbr.png new file mode 100644 index 0000000..30e4a75 Binary files /dev/null and b/samples/img/madeinbr.png differ diff --git a/samples/img/old-poweredby-1.png b/samples/img/old-poweredby-1.png new file mode 100644 index 0000000..cb43846 Binary files /dev/null and b/samples/img/old-poweredby-1.png differ diff --git a/samples/img/old-poweredby-2.png b/samples/img/old-poweredby-2.png new file mode 100644 index 0000000..b3760ca Binary files /dev/null and b/samples/img/old-poweredby-2.png differ diff --git a/samples/img/photo.jpg b/samples/img/photo.jpg new file mode 100644 index 0000000..147fa86 Binary files /dev/null and b/samples/img/photo.jpg differ diff --git a/samples/img/t2tbutton.png b/samples/img/t2tbutton.png new file mode 100644 index 0000000..96bccaf Binary files /dev/null and b/samples/img/t2tbutton.png differ diff --git a/samples/img/t2tpowered-black.png b/samples/img/t2tpowered-black.png new file mode 100644 index 0000000..7f001e9 Binary files /dev/null and b/samples/img/t2tpowered-black.png differ diff --git a/samples/img/t2tpowered-white.png b/samples/img/t2tpowered-white.png new file mode 100644 index 0000000..6030c58 Binary files /dev/null and b/samples/img/t2tpowered-white.png differ diff --git a/samples/img/t2tpowered.png b/samples/img/t2tpowered.png new file mode 100644 index 0000000..f63149b Binary files /dev/null and b/samples/img/t2tpowered.png differ diff --git a/samples/img/valid-css.png b/samples/img/valid-css.png new file mode 100644 index 0000000..9b2f596 Binary files /dev/null and b/samples/img/valid-css.png differ diff --git a/samples/img/valid-html.png b/samples/img/valid-html.png new file mode 100644 index 0000000..a6cf106 Binary files /dev/null and b/samples/img/valid-html.png differ diff --git a/samples/img/valid-xhtml.png b/samples/img/valid-xhtml.png new file mode 100644 index 0000000..2275ee6 Binary files /dev/null and b/samples/img/valid-xhtml.png differ diff --git a/samples/module/README b/samples/module/README new file mode 100644 index 0000000..5c7b0ab --- /dev/null +++ b/samples/module/README @@ -0,0 +1,20 @@ +Txt2tags README File for Module Samples +--------------------------------------- +http://txt2tags.org + +The files on this directory are samples of Python scripts +using txt2tags as a module. + +They are useful for Python programmers that want to embed +txt2tags functionality into their own programs. + +The samples show how to prepare the marked text, set some +configurations, perform the conversion and handle +exceptions. Well, the code talks for itself. + +To run this samples you must copy the txt2tags program to +this directory (or make a symlink) named as 'txt2tags.py'. +Then just do "python module-full.py" command or similar. + +The author will be glad to know that you used txt2tags in +your program. Mail him! diff --git a/samples/module/module-body.py b/samples/module/module-body.py new file mode 100755 index 0000000..3ee2fb2 --- /dev/null +++ b/samples/module/module-body.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Sample of txt2tags being used as a module (http://txt2tags.org) +# +# Details: +# The document body is a string. +# Headers and config are set with Python code. +# This way you can fully control txt2tags behavior. +# + +from __future__ import print_function + +# Remember to place the 'txt2tags.py' file on the same dir +import txt2tags + +# Here is the marked body text, it must be a list. +txt = "=Hi!=\nHave a **nice** day.\n\nBye." +txt = txt.split("\n") + +# Set the three header fields +headers = ["Header 1", "Header 2", "Header 3"] + +# Set the configuration on the 'config' dict. +config = txt2tags.ConfigMaster()._get_defaults() +config["outfile"] = txt2tags.MODULEOUT # results as list +config["target"] = "html" # target type: HTML +config["encoding"] = "UTF-8" # document encoding +config["css-sugar"] = 1 # CSS friendly +config["toc"] = 1 # show Table Of Contents + +# The Pre (and Post) processing config is a list of lists: +# [ [this, that], [foo, bar], [pattern, replace] ] +config["preproc"] = [] +config["preproc"].append(["nice", "VERY NICE"]) +config["preproc"].append(["day", "life"]) + +# Let's do the conversion +try: + headers = txt2tags.doHeader(headers, config) + body, toc = txt2tags.convert(txt, config) + footer = txt2tags.doFooter(config) + toc = txt2tags.toc_tagger(toc, config) + toc = txt2tags.toc_formatter(toc, config) + full_doc = headers + toc + body + footer + finished = txt2tags.finish_him(full_doc, config) + print("\n".join(finished)) +except txt2tags.error as err: + # Txt2tags error, show the message to the user + print(err) +except Exception: + # Unknown error, show the traceback to the user + print(txt2tags.getUnknownErrorMessage()) diff --git a/samples/module/module-full.py b/samples/module/module-full.py new file mode 100755 index 0000000..8031029 --- /dev/null +++ b/samples/module/module-full.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# +# Sample of txt2tags being used as a module (http://txt2tags.org) +# +# Details: +# The full marked text is a string with headers, config and body. +# No post config or setting is made. +# + +from __future__ import print_function + +# Remember to place the 'txt2tags.py' file on the same dir +import txt2tags + +# Here is the marked text, it must be a list. +txt = "Header1\nHeader2\nHeader3\n%!target: html\nBody line 1." +txt = txt.split("\n") + +# Let's do the conversion +try: + # First we parse the text, splitting parts and getting config. + data = txt2tags.process_source_file(contents=txt) + # Then we convert it, dumping results to the 'tagged' list. + tagged, config = txt2tags.convert_this_files([data]) + # Show the tagged file on the screen. + print("\n".join(tagged)) +except txt2tags.error as err: + # Txt2tags error, show the message to the user + print(err) +except Exception: + # Unknown error, show the traceback to the user + print(txt2tags.getUnknownErrorMessage()) diff --git a/samples/sample.adoc b/samples/sample.adoc new file mode 100644 index 0000000..3b30125 --- /dev/null +++ b/samples/sample.adoc @@ -0,0 +1,170 @@ += TXT2TAGS SAMPLE +Aurelio Jargas + + +== Introduction + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +---- +line1: document title +line2: author name, email +line3: date, version +---- + +Lines with balanced equal signs = around are titles. + +== Fonts and Beautifiers + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +=== Beautifiers + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent *bold*, +_italic_, strike and underline. + +The *_bold italic_* style is also supported as a +combination. + +=== Pre-Formatted Text + +We can put a code sample or other pre-formatted text: + +---- + here is pre-formatted +//marks// are **not** ``interpreted`` +---- + +And also, it's easy to put a one line pre-formatted +text: + +---- +prompt$ ls /etc +---- + +Or use +pre-formatted+ inside sentences. + +=== More Cosmetics + +Special entities like email (mailto:duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + + + + +You can also specify an http://duh.org[explicit link] +with label. + +And remember, + +A TAB in front of the line does a quotation. +More TABs, more depth (if allowed). + +Nice. + +== Lists + +A list of items is natural, just putting a *dash* or +a *plus* at the beginning of the line. + +=== Plain List + +The dash is the default list identifier. For sublists, +just add *spaces* at the beginning of the line. More +spaces, more sublists. + + - earth + - america + - south america + - brazil + - how deep can i go? + - europe + - lots of countries + - mars + - who knows? + +The list ends with *two* consecutive blank lines. + +=== Numbered List + +The same rules as the plain list, just a different +identifier (plus). + +. one +. two +. three + - mixed lists! + - what a mess + . counting again + . ... +. four + +=== Definition List + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +orange + a yellow fruit +apple + a green or red fruit +other fruits + - wee! + - mixing lists + . again! + . and again! + +== Tables + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +---- + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | +---- + +Without the last pipe, no border: + +---- + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 +---- + +== Special Entities + +Because things were too simple. + +=== Images + +The image mark is as simple as it can be: +[filename]+. + +image::img/photo.jpg[] + + - The filename must end in PNG, JPG, GIF, or similar. + - No spaces inside the brackets! + + + +image::img/t2tpowered.png[] + diff --git a/samples/sample.creole b/samples/sample.creole new file mode 100644 index 0000000..f507290 --- /dev/null +++ b/samples/sample.creole @@ -0,0 +1,169 @@ +TXT2TAGS SAMPLE +Aurelio Jargas + + += Introduction = + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +{{{ +line1: document title +line2: author name, email +line3: date, version +}}} + +Lines with balanced equal signs = around are titles. + += Fonts and Beautifiers = + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +== Beautifiers == + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent **bold**, +//italic//, strike and //underline//. + +The **//bold italic//** style is also supported as a +combination. + +== Pre-Formatted Text == + +We can put a code sample or other pre-formatted text: + +{{{ + here is pre-formatted +//marks// are **not** ``interpreted`` +}}} + +And also, it's easy to put a one line pre-formatted +text: + +{{{ +prompt$ ls /etc +}}} + +Or use pre-formatted inside sentences. + +== More Cosmetics == + +Special entities like email () and +URL ([[http://www.duh.com]]) are detected automagically, +as well as horizontal lines: + +---- + +---- + +You can also specify an [[http://duh.org|explicit link]] +with label. + +And remember, + + A TAB in front of the line does a quotation. + + More TABs, more depth (if allowed). + + +Nice. + += Lists = + +A list of items is natural, just putting a **dash** or +a **plus** at the beginning of the line. + +== Plain List == + +The dash is the default list identifier. For sublists, +just add **spaces** at the beginning of the line. More +spaces, more sublists. + +* earth +** america +*** south america +**** brazil +***** how deep can i go? +** europe +*** lots of countries +* mars +** who knows? + +The list ends with **two** consecutive blank lines. + +== Numbered List == + +The same rules as the plain list, just a different +identifier (plus). + +# one +# two +# three +** mixed lists! +** what a mess +### counting again +### ... +# four + +== Definition List == + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +orange +:a yellow fruit +apple +:a green or red fruit +other fruits +** wee! +** mixing lists +### again! +### and again! + += Tables = + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +|= heading 1 |= heading 2 |= heading 3| +| cell 1.1 | cell 1.2 | cell 1.3 | +| cell 2.1 | cell 2.2 | cell 2.3 | + +Without the last pipe, no border: + +|= heading 1 |= heading 2 |= heading 3| +| cell 1.1 | cell 1.2 | cell 1.3 | +| cell 2.1 | cell 2.2 | cell 2.3 | + += Special Entities = + +Because things were too simple. + +== Images == + +The image mark is as simple as it can be: [filename]. + +{{img/photo.jpg}} + +* The filename must end in PNG, JPG, GIF, or similar. +* No spaces inside the brackets! + +---- + +{{img/t2tpowered.png}} + diff --git a/samples/sample.dbk b/samples/sample.dbk new file mode 100644 index 0000000..1c991e6 --- /dev/null +++ b/samples/sample.dbk @@ -0,0 +1,257 @@ + + +
+ + TXT2TAGS SAMPLE + + Aurelio Jargas + + + +Introduction + +Welcome to the txt2tags sample file. + + +Here you have examples and a brief explanation of all +marks. + + +The first 3 lines of the this file are used as headers, +on the following format: + + +line1: document title +line2: author name, email +line3: date, version + + +Lines with balanced equal signs = around are titles. + + +Fonts and Beautifiers + +We have two sets of fonts: + + +The NORMAL type that can be improved with beautifiers. + + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + + +We will now enter on a subtitle... + + Beautifiers + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + + +We use double *, /, - and _ to represent bold, +italic, strike and underline. + + +The bold italic style is also supported as a +combination. + + + Pre-Formatted Text + +We can put a code sample or other pre-formatted text: + + + here is pre-formatted +//marks// are **not** ``interpreted`` + + +And also, it's easy to put a one line pre-formatted +text: + + +prompt$ ls /etc + + +Or use pre-formatted inside sentences. + + + More Cosmetics + +Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + + + + +You can also specify an explicit link +with label. + + +And remember, + +
+A TAB in front of the line does a quotation. +
+More TABs, more depth (if allowed). +
+
+ +Nice. + +
+
+Lists + +A list of items is natural, just putting a dash or +a plus at the beginning of the line. + + Plain List + +The dash is the default list identifier. For sublists, +just add spaces at the beginning of the line. More +spaces, more sublists. + + +earth + +america + +south america + +brazil + +how deep can i go? + + + + + + + +europe + +lots of countries + + + + + +mars + +who knows? + + + + + +The list ends with two consecutive blank lines. + + + Numbered List + +The same rules as the plain list, just a different +identifier (plus). + + +one + +two + +three + +mixed lists! + +what a mess + +counting again + +... + + + + + +four + + + + Definition List + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + + +orange +a yellow fruit + +apple +a green or red fruit + +other fruits + +wee! + +mixing lists + +again! + +and again! + + + + + + + + +Tables + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + + + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | + + +Without the last pipe, no border: + + + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 + + +Special Entities + +Because things were too simple. + + Images + +The image mark is as simple as it can be: [filename]. + + + + + +The filename must end in PNG, JPG, GIF, or similar. + +No spaces inside the brackets! + + + + + + + + + + + +
diff --git a/samples/sample.doku b/samples/sample.doku new file mode 100644 index 0000000..8a7dd18 --- /dev/null +++ b/samples/sample.doku @@ -0,0 +1,163 @@ +===== TXT2TAGS SAMPLE ===== + +**//Aurelio Jargas//** + + + +===== Introduction ===== + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + + line1: document title + line2: author name, email + line3: date, version + +Lines with balanced equal signs = around are titles. + +===== Fonts and Beautifiers ===== + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +==== Beautifiers ==== + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent **bold**, +//italic//, strike and __underline__. + +The **//bold italic//** style is also supported as a +combination. + +==== Pre-Formatted Text ==== + +We can put a code sample or other pre-formatted text: + + here is pre-formatted + //marks// are **not** ``interpreted`` + +And also, it's easy to put a one line pre-formatted +text: + + prompt$ ls /etc + +Or use ''pre-formatted'' inside sentences. + +==== More Cosmetics ==== + +Special entities like email ([[duh@somewhere.com]]) and +URL ([[http://www.duh.com]]) are detected automagically, +as well as horizontal lines: + +---- + +---- + +You can also specify an [[http://duh.org|explicit link]] +with label. + +And remember, + +>A TAB in front of the line does a quotation. +>>More TABs, more depth (if allowed). + +Nice. + +===== Lists ===== + +A list of items is natural, just putting a **dash** or +a **plus** at the beginning of the line. + +==== Plain List ==== + +The dash is the default list identifier. For sublists, +just add **spaces** at the beginning of the line. More +spaces, more sublists. + + * earth + * america + * south america + * brazil + * how deep can i go? + * europe + * lots of countries + * mars + * who knows? + +The list ends with **two** consecutive blank lines. + +==== Numbered List ==== + +The same rules as the plain list, just a different +identifier (plus). + + - one + - two + - three + * mixed lists! + * what a mess + - counting again + - ... + - four + +==== Definition List ==== + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +orange + a yellow fruit +apple + a green or red fruit +other fruits + * wee! + * mixing lists + - again! + - and again! + +===== Tables ===== + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +^ heading 1 ^ heading 2 ^ heading 3 ^ +| cell 1.1 | cell 1.2 | cell 1.3 | +| cell 2.1 | cell 2.2 | cell 2.3 | + +Without the last pipe, no border: + +^ heading 1 ^ heading 2 ^ heading 3 ^ +| cell 1.1 | cell 1.2 | cell 1.3 | +| cell 2.1 | cell 2.2 | cell 2.3 | + +===== Special Entities ===== + +Because things were too simple. + +==== Images ==== + +The image mark is as simple as it can be: ''[filename]''. + +{{ img/photo.jpg }} + + * The filename must end in PNG, JPG, GIF, or similar. + * No spaces inside the brackets! + +---- + +{{ img/t2tpowered.png }} + diff --git a/samples/sample.gwiki b/samples/sample.gwiki new file mode 100644 index 0000000..33aa686 --- /dev/null +++ b/samples/sample.gwiki @@ -0,0 +1,168 @@ +*TXT2TAGS SAMPLE* + +Aurelio Jargas + + + += Introduction = + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +{{{ +line1: document title +line2: author name, email +line3: date, version +}}} + +Lines with balanced equal signs = around are titles. + += Fonts and Beautifiers = + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +== Beautifiers == + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent *bold*, +_italic_, ~~strike~~ and underline. + +The *_bold italic_* style is also supported as a +combination. + +== Pre-Formatted Text == + +We can put a code sample or other pre-formatted text: + +{{{ + here is pre-formatted +//marks// are **not** ``interpreted`` +}}} + +And also, it's easy to put a one line pre-formatted +text: + +{{{ +prompt$ ls /etc +}}} + +Or use {{{pre-formatted}}} inside sentences. + +== More Cosmetics == + +Special entities like email (mailto:duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + + + + +You can also specify an [http://duh.org explicit link] +with label. + +And remember, + + A TAB in front of the line does a quotation. + More TABs, more depth (if allowed). + +Nice. + += Lists = + +A list of items is natural, just putting a *dash* or +a *plus* at the beginning of the line. + +== Plain List == + +The dash is the default list identifier. For sublists, +just add *spaces* at the beginning of the line. More +spaces, more sublists. + + * earth + * america + * south america + * brazil + * how deep can i go? + * europe + * lots of countries + * mars + * who knows? + +The list ends with *two* consecutive blank lines. + +== Numbered List == + +The same rules as the plain list, just a different +identifier (plus). + + # one + # two + # three + * mixed lists! + * what a mess + # counting again + # ... + # four + +== Definition List == + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +orange + a yellow fruit +apple + a green or red fruit +other fruits + * wee! + * mixing lists + # again! + # and again! + += Tables = + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +|| *heading 1* || *heading 2* || *heading 3* || +|| cell 1.1 || cell 1.2 || cell 1.3 || +|| cell 2.1 || cell 2.2 || cell 2.3 || + +Without the last pipe, no border: + +|| *heading 1* || *heading 2* || *heading 3* || +|| cell 1.1 || cell 1.2 || cell 1.3 || +|| cell 2.1 || cell 2.2 || cell 2.3 || + += Special Entities = + +Because things were too simple. + +== Images == + +The image mark is as simple as it can be: {{{[filename]}}}. + +[img/photo.jpg] + + * The filename must end in PNG, JPG, GIF, or similar. + * No spaces inside the brackets! + + + +[img/t2tpowered.png] + diff --git a/samples/sample.html b/samples/sample.html new file mode 100644 index 0000000..45a2111 --- /dev/null +++ b/samples/sample.html @@ -0,0 +1,358 @@ + + + + +TXT2TAGS SAMPLE + + + + +
+
+

TXT2TAGS SAMPLE

+

Aurelio Jargas

+
+
+
+ +
+ +
+

Introduction

+ +

+Welcome to the txt2tags sample file. +

+

+Here you have examples and a brief explanation of all +marks. +

+

+The first 3 lines of the this file are used as headers, +on the following format: +

+ +
+line1: document title
+line2: author name, email
+line3: date, version
+
+ +

+Lines with balanced equal signs = around are titles. +

+ +
+
+

Fonts and Beautifiers

+ +

+We have two sets of fonts: +

+

+The NORMAL type that can be improved with beautifiers. +

+

+The TYPEWRITER type that uses monospaced font for +pre-formatted text. +

+

+We will now enter on a subtitle... +

+ +
+

Beautifiers

+ +

+The text marks for beautifiers are simple, just as you +type on a plain text email message. +

+

+We use double *, /, - and _ to represent bold, +italic, strike and underline. +

+

+The bold italic style is also supported as a +combination. +

+ +
+
+

Pre-Formatted Text

+ +

+We can put a code sample or other pre-formatted text: +

+ +
+  here    is     pre-formatted
+//marks// are  **not**  ``interpreted``
+
+ +

+And also, it's easy to put a one line pre-formatted +text: +

+ +
+prompt$ ls /etc
+
+ +

+Or use pre-formatted inside sentences. +

+ +
+
+

More Cosmetics

+ +

+Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: +

+ +
+ +
+ +

+You can also specify an explicit link +with label. +

+

+And remember, +

+
+ A TAB in front of the line does a quotation. +
+ More TABs, more depth (if allowed). +
+
+

+Nice. +

+ +
+
+
+

Lists

+ +

+A list of items is natural, just putting a dash or +a plus at the beginning of the line. +

+ +
+

Plain List

+ +

+The dash is the default list identifier. For sublists, +just add spaces at the beginning of the line. More +spaces, more sublists. +

+ +
    +
  • earth +
      +
    • america +
        +
      • south america +
          +
        • brazil +
            +
          • how deep can i go? +
          • +
          +
        • +
        +
      • +
      +
    • +
    • europe +
        +
      • lots of countries +
      • +
      +
    • +
    +
  • +
  • mars +
      +
    • who knows? +
    • +
    +
  • +
+ +

+The list ends with two consecutive blank lines. +

+ +
+
+

Numbered List

+ +

+The same rules as the plain list, just a different +identifier (plus). +

+ +
    +
  1. one +
  2. +
  3. two +
  4. +
  5. three +
      +
    • mixed lists! +
    • +
    • what a mess +
        +
      1. counting again +
      2. +
      3. ... +
      4. +
      +
    • +
    +
  6. +
  7. four +
  8. +
+ +
+
+

Definition List

+ +

+The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. +

+ +
+
orange
+ a yellow fruit +
+
apple
+ a green or red fruit +
+
other fruits
+
    +
  • wee! +
  • +
  • mixing lists +
      +
    1. again! +
    2. +
    3. and again! +
    4. +
    +
  • +
+
+
+ +
+
+
+

Tables

+ +

+Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. +

+ + + + + + + + + + + + + + + + + +
heading 1heading 2heading 3
cell 1.1cell 1.2cell 1.3
cell 2.1cell 2.2cell 2.3
+ +

+Without the last pipe, no border: +

+ + + + + + + + + + + + + + + + + +
heading 1heading 2heading 3
cell 1.1cell 1.2cell 1.3
cell 2.1cell 2.2cell 2.3
+ +
+
+

Special Entities

+ +

+Because things were too simple. +

+ +
+

Images

+ +

+The image mark is as simple as it can be: [filename]. +

+

+ +

+ +
    +
  • The filename must end in PNG, JPG, GIF, or similar. +
  • +
  • No spaces inside the brackets! +
  • +
+ +
+ +

+ +

+
+
+
+ + + +
diff --git a/samples/sample.lout b/samples/sample.lout new file mode 100644 index 0000000..153da0c --- /dev/null +++ b/samples/sample.lout @@ -0,0 +1,292 @@ +@SysInclude { doc } +@Document + @InitialFont { Times Base 12p } # Times, Courier, Helvetica, ... + @PageOrientation { Portrait } # Portrait, Landscape + @ColumnNumber { 1 } # Number of columns (2, 3, ...) + @PageHeaders { Simple } # None, Simple, Titles, NoTitles + @InitialLanguage { English } # German, French, Portuguese, ... + @OptimizePages { Yes } # Yes/No smart page break feature +// +@Text @Begin +@Display @Heading { TXT2TAGS SAMPLE } +@Display @I { Aurelio Jargas } +#@NP # Break page after Headers + + +@BeginSections +@Section @Title { Introduction } @Begin + +@LP +Welcome to the txt2tags sample file. + +@LP +Here you have examples and a brief explanation of all +marks. + +@LP +The first 3 lines of the this file are used as headers, +on the following format: + +@LP @ID @F @RawVerbatim @Begin +line1: document title +line2: author name, email +line3: date, version +@End @RawVerbatim + +@LP +Lines with balanced equal signs = around are titles. + +@End @Section +@Section @Title { Fonts and Beautifiers } @Begin + +@LP +We have two sets of fonts: + +@LP +The NORMAL type that can be improved with beautifiers. + +@LP +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +@LP +We will now enter on a subtitle... + + @BeginSubSections + @SubSection @Title { Beautifiers } @Begin + +@LP +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +@LP +We use double *, "/", - and _ to represent {@B {bold}}, +{@II {italic}}, strike and {@Underline{underline}}. + +@LP +The {@B {{@II {bold italic}}}} style is also supported as a +combination. + + @End @SubSection + @SubSection @Title { Pre-Formatted Text } @Begin + +@LP +We can put a code sample or other pre-formatted text: + +@LP @ID @F @RawVerbatim @Begin + here is pre-formatted +//marks// are **not** ``interpreted`` +@End @RawVerbatim + +@LP +And also, it's easy to put a one line pre-formatted +text: + +@LP @ID @F @RawVerbatim @Begin +prompt$ ls /etc +@End @RawVerbatim + +@LP +Or use {@F {pre-formatted}} inside sentences. + + @End @SubSection + @SubSection @Title { More Cosmetics } @Begin + +@LP +Special entities like email ({blue @Colour { duh"@"somewhere.com }}) and +URL ({blue @Colour { http:"/""/"www.duh.com }}) are detected automagically, +as well as horizontal lines: + +@DP @FullWidthRule + +@NP + +@LP +You can also specify an explicit link ({blue @Colour { http:"/""/"duh.org }}) +with label. + +@LP +And remember, + + @QD { + A TAB in front of the line does a quotation. + @QD { + More TABs, more depth (if allowed). + } + } + +@LP +Nice. + + @End @SubSection + @EndSubSections +@End @Section +@Section @Title { Lists } @Begin + +@LP +A list of items is natural, just putting a {@B {dash}} or +a {@B {plus}} at the beginning of the line. + + @BeginSubSections + @SubSection @Title { Plain List } @Begin + +@LP +The dash is the default list identifier. For sublists, +just add {@B {spaces}} at the beginning of the line. More +spaces, more sublists. + +@BulletList +@ListItem{earth +@BulletList +@ListItem{america +@BulletList +@ListItem{south america +@BulletList +@ListItem{brazil +@BulletList +@ListItem{how deep can i go? +} +@EndList +} +@EndList +} +@EndList +} +@ListItem{europe +@BulletList +@ListItem{lots of countries +} +@EndList +} +@EndList +} +@ListItem{mars +@BulletList +@ListItem{who knows? +} +@EndList +} +@EndList + +@LP +The list ends with {@B {two}} consecutive blank lines. + + @End @SubSection + @SubSection @Title { Numbered List } @Begin + +@LP +The same rules as the plain list, just a different +identifier (plus). + +@NumberedList +@ListItem{one +} +@ListItem{two +} +@ListItem{three +@BulletList +@ListItem{mixed lists! +} +@ListItem{what a mess +@NumberedList +@ListItem{counting again +} +@ListItem{... +} +@EndList +} +@EndList +} +@ListItem{four +} +@EndList + + @End @SubSection + @SubSection @Title { Definition List } @Begin + +@LP +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +@TaggedList +@DropTagItem {orange}{ +a yellow fruit +} +@DropTagItem {apple}{ +a green or red fruit +} +@DropTagItem {other fruits}{ +@BulletList +@ListItem{wee! +} +@ListItem{mixing lists +@NumberedList +@ListItem{again! +} +@ListItem{and again! +} +@EndList +} +@EndList +} +@EndList + + @End @SubSection + @EndSubSections +@End @Section +@Section @Title { Tables } @Begin + +@LP +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +@LP @ID @F @RawVerbatim @Begin + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | +@End @RawVerbatim + +@LP +Without the last pipe, no border: + +@LP @ID @F @RawVerbatim @Begin + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 +@End @RawVerbatim + +@End @Section +@Section @Title { Special Entities } @Begin + +@LP +Because things were too simple. + + @BeginSubSections + @SubSection @Title { Images } @Begin + +@LP +The image mark is as simple as it can be: {@F {[filename]}}. + +@LP +@CentredDisplay @IncludeGraphic { img"/"photo.jpg } + +@BulletList +@ListItem{The filename must end in PNG, JPG, GIF, or similar. +} +@ListItem{No spaces inside the brackets! +} +@EndList + +@DP @FullWidthRule + +@LP +@CentredDisplay @IncludeGraphic { img"/"t2tpowered.png } + + @End @SubSection + @EndSubSections +@End @Section +@EndSections +# lout code generated by txt2tags 3.3 (http://txt2tags.org) +# cmdline: txt2tags -q --no-rc -t lout -o sample.lout /home/jendrik/projects/txt2tags/samples/sample.t2t +@End @Text diff --git a/samples/sample.man b/samples/sample.man new file mode 100644 index 0000000..b985b94 --- /dev/null +++ b/samples/sample.man @@ -0,0 +1,245 @@ +.TH "TXT2TAGS SAMPLE" 1 "" "Aurelio Jargas" + +.SH Introduction +.P +Welcome to the txt2tags sample file. +.P +Here you have examples and a brief explanation of all +marks. +.P +The first 3 lines of the this file are used as headers, +on the following format: + +.nf +line1: document title +line2: author name, email +line3: date, version +.fi + + +.P +Lines with balanced equal signs = around are titles. +.SH Fonts and Beautifiers +.P +We have two sets of fonts: +.P +The NORMAL type that can be improved with beautifiers. +.P +The TYPEWRITER type that uses monospaced font for +pre\-formatted text. +.P +We will now enter on a subtitle... +.SS Beautifiers +.P +The text marks for beautifiers are simple, just as you +type on a plain text email message. +.P +We use double *, /, \- and _ to represent \fBbold\fR, +\fIitalic\fR, strike and underline. +.P +The \fB\fIbold italic\fR\fR style is also supported as a +combination. +.SS Pre-Formatted Text +.P +We can put a code sample or other pre\-formatted text: + +.nf + here is pre-formatted +//marks// are **not** ``interpreted`` +.fi + + +.P +And also, it's easy to put a one line pre\-formatted +text: + +.nf +prompt$ ls /etc +.fi + + +.P +Or use pre\-formatted inside sentences. +.SS More Cosmetics +.P +Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + + + + + + +.P +You can also specify an explicit link (http://duh.org) +with label. +.P +And remember, +.RS +A TAB in front of the line does a quotation. +.RS +More TABs, more depth (if allowed). +.RE +.RE +.P +Nice. +.SH Lists +.P +A list of items is natural, just putting a \fBdash\fR or +a \fBplus\fR at the beginning of the line. +.SS Plain List +.P +The dash is the default list identifier. For sublists, +just add \fBspaces\fR at the beginning of the line. More +spaces, more sublists. + +.RS +.IP \(bu 3 +earth +.RS +.IP \(bu 3 +america +.RS +.IP \(bu 3 +south america +.RS +.IP \(bu 3 +brazil +.RS +.IP \(bu 3 +how deep can i go? +.RE +.IP +.RE +.IP +.RE +.IP +.IP \(bu 3 +europe +.RS +.IP \(bu 3 +lots of countries +.RE +.IP +.RE +.IP +.IP \(bu 3 +mars +.RS +.IP \(bu 3 +who knows? +.RE +.IP +.RE +.IP + +.P +The list ends with \fBtwo\fR consecutive blank lines. +.SS Numbered List +.P +The same rules as the plain list, just a different +identifier (plus). + +.RS +.IP 1. 3 +one +.IP 2. 3 +two +.IP 3. 3 +three +.RS +.IP \(bu 3 +mixed lists! +.IP \(bu 3 +what a mess +.RS +.IP 1. 3 +counting again +.IP 2. 3 +... +.RE +.IP +.RE +.IP +.IP 4. 3 +four +.RE +.IP + +.SS Definition List +.P +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +.TP +orange +a yellow fruit +.TP +apple +a green or red fruit +.TP +other fruits +.RS +.IP \(bu 3 +wee! +.IP \(bu 3 +mixing lists +.RS +.IP 1. 3 +again! +.IP 2. 3 +and again! +.RE +.IP +.RE +.IP + +.SH Tables +.P +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +.TS +center, allbox, tab(^); lcr. + \fBheading 1\fR^\fBheading 2\fR^\fBheading 3\fR + cell 1.1^cell 1.2^cell 1.3 + cell 2.1^cell 2.2^cell 2.3 +.TE + +.P +Without the last pipe, no border: + +.TS +center, tab(^); lcr. + \fBheading 1\fR^\fBheading 2\fR^\fBheading 3\fR + cell 1.1^cell 1.2^cell 1.3 + cell 2.1^cell 2.2^cell 2.3 +.TE + +.SH Special Entities +.P +Because things were too simple. +.SS Images +.P +The image mark is as simple as it can be: [filename]. +.P +img/photo.jpg + +.RS +.IP \(bu 3 +The filename must end in PNG, JPG, GIF, or similar. +.IP \(bu 3 +No spaces inside the brackets! +.RE +.IP + + + + +.P +img/t2tpowered.png + +.\" man code generated by txt2tags 3.3 (http://txt2tags.org) +.\" cmdline: txt2tags -q --no-rc -t man -o sample.man /home/jendrik/projects/txt2tags/samples/sample.t2t diff --git a/samples/sample.mgp b/samples/sample.mgp new file mode 100644 index 0000000..27ec402 --- /dev/null +++ b/samples/sample.mgp @@ -0,0 +1,344 @@ +#!/usr/X11R6/bin/mgp -t 90 +%deffont "normal" xfont "utopia-medium-r", charset "iso8859-1" +%deffont "normal-i" xfont "utopia-medium-i", charset "iso8859-1" +%deffont "normal-b" xfont "utopia-bold-r" , charset "iso8859-1" +%deffont "normal-bi" xfont "utopia-bold-i" , charset "iso8859-1" +%deffont "mono" xfont "courier-medium-r", charset "iso8859-1" +%default 1 size 5 +%default 2 size 8, fore "yellow", font "normal-b", center +%default 3 size 5, fore "white", font "normal", left, prefix " " +%tab 1 size 4, vgap 30, prefix " ", icon arc "red" 40, leftfill +%tab 2 prefix " ", icon arc "orange" 40, leftfill +%tab 3 prefix " ", icon arc "brown" 40, leftfill +%tab 4 prefix " ", icon arc "darkmagenta" 40, leftfill +%tab 5 prefix " ", icon arc "magenta" 40, leftfill +%%------------------------- end of headers ----------------------------- +%page + + + + + +%size 10, center, fore "yellow" +TXT2TAGS SAMPLE + +%font "normal-i", size 6, fore "white", center +Aurelio Jargas + +%font "mono", size 7, center + +%page + +Introduction + + +%font "normal", size 5 +Welcome to the txt2tags sample file. + +%font "normal", size 5 +Here you have examples and a brief explanation of all +marks. + +%font "normal", size 5 +The first 3 lines of the this file are used as headers, +on the following format: + +%font "mono" +line1: document title +line2: author name, email +line3: date, version +%font "normal" + +%font "normal", size 5 +Lines with balanced equal signs = around are titles. + +%page + +Fonts and Beautifiers + + +%font "normal", size 5 +We have two sets of fonts: + +%font "normal", size 5 +The NORMAL type that can be improved with beautifiers. + +%font "normal", size 5 +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +%font "normal", size 5 +We will now enter on a subtitle... + +%page + +Beautifiers + + +%font "normal", size 5 +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +%font "normal", size 5 +We use double *, /, - and _ to represent +%cont, font "normal-b" +bold +%cont, font "normal" +, + +%cont, font "normal-i" +italic +%cont, font "normal" +, strike and +%cont, fore "cyan" +underline +%cont, fore "white" +. + +%font "normal", size 5 +The +%cont, font "normal-b" + +%cont, font "normal-i" +bold italic +%cont, font "normal" + +%cont, font "normal" + style is also supported as a +combination. + +%page + +Pre-Formatted Text + + +%font "normal", size 5 +We can put a code sample or other pre-formatted text: + +%font "mono" + here is pre-formatted +//marks// are **not** ``interpreted`` +%font "normal" + +%font "normal", size 5 +And also, it's easy to put a one line pre-formatted +text: + +%font "mono" +prompt$ ls /etc +%font "normal" + +%font "normal", size 5 +Or use +%cont, font "mono" +pre-formatted +%cont, font "normal" + inside sentences. + +%page + +More Cosmetics + + +%font "normal", size 5 +Special entities like email ( +%cont, fore "cyan" +duh@somewhere.com +%cont, fore "white" +) and +URL ( +%cont, fore "cyan" +http://www.duh.com +%cont, fore "white" +) are detected automagically, +as well as horizontal lines: + +%bar "white" 5 + +%pause + +%font "normal", size 5 +You can also specify an explicit link +%cont, fore "cyan" +http://duh.org +%cont, fore "white" + +with label. + +%font "normal", size 5 +And remember, + +%prefix " " +A TAB in front of the line does a quotation. +%prefix " " +More TABs, more depth (if allowed). +%prefix " " +%prefix " " + +%font "normal", size 5 +Nice. + +%page + +Lists + + +%font "normal", size 5 +A list of items is natural, just putting a +%cont, font "normal-b" +dash +%cont, font "normal" + or +a +%cont, font "normal-b" +plus +%cont, font "normal" + at the beginning of the line. + +%page + +Plain List + + +%font "normal", size 5 +The dash is the default list identifier. For sublists, +just add +%cont, font "normal-b" +spaces +%cont, font "normal" + at the beginning of the line. More +spaces, more sublists. + + earth + america + south america + brazil + how deep can i go? + europe + lots of countries + mars + who knows? + +%font "normal", size 5 +The list ends with +%cont, font "normal-b" +two +%cont, font "normal" + consecutive blank lines. + +%page + +Numbered List + + +%font "normal", size 5 +The same rules as the plain list, just a different +identifier (plus). + + 1. one + 2. two + 3. three + mixed lists! + what a mess + 1. counting again + 2. ... + 4. four + +%page + +Definition List + + +%font "normal", size 5 +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + + +%cont, font "normal-b" +orange +%cont, font "normal" + +a yellow fruit + +%cont, font "normal-b" +apple +%cont, font "normal" + +a green or red fruit + +%cont, font "normal-b" +other fruits +%cont, font "normal" + + wee! + mixing lists + 1. again! + 2. and again! + +%page + +Tables + + +%font "normal", size 5 +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +%font "mono" + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | +%font "normal" + +%font "normal", size 5 +Without the last pipe, no border: + +%font "mono" + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 +%font "normal" + +%page + +Special Entities + + +%font "normal", size 5 +Because things were too simple. + +%page + +Images + + +%font "normal", size 5 +The image mark is as simple as it can be: +%cont, font "mono" +[filename] +%cont, font "normal" +. + +%font "normal", size 5 + +%center +%newimage "img/photo.jpg" +%left + + + The filename must end in PNG, JPG, GIF, or similar. + No spaces inside the brackets! + +%bar "white" 5 + +%font "normal", size 5 + +%center +%newimage "img/t2tpowered.png" +%left + + +%% mgp code generated by txt2tags 3.3 (http://txt2tags.org) +%% cmdline: txt2tags -q --no-rc -t mgp -o sample.mgp /home/jendrik/projects/txt2tags/samples/sample.t2t +%%EOD diff --git a/samples/sample.moin b/samples/sample.moin new file mode 100644 index 0000000..d790a63 --- /dev/null +++ b/samples/sample.moin @@ -0,0 +1,170 @@ +'''TXT2TAGS SAMPLE''' + +''Aurelio Jargas'' + + + += Introduction = + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +{{{ +line1: document title +line2: author name, email +line3: date, version +}}} + +Lines with balanced equal signs = around are titles. + += Fonts and Beautifiers = + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +== Beautifiers == + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent '''bold''', +''italic'', --(strike)-- and __underline__. + +The '''''bold italic''''' style is also supported as a +combination. + +== Pre-Formatted Text == + +We can put a code sample or other pre-formatted text: + +{{{ + here is pre-formatted +//marks// are **not** ``interpreted`` +}}} + +And also, it's easy to put a one line pre-formatted +text: + +{{{ +prompt$ ls /etc +}}} + +Or use {{{pre-formatted}}} inside sentences. + +== More Cosmetics == + +Special entities like email (duh@somewhere.com) and +URL ([[http://www.duh.com]]) are detected automagically, +as well as horizontal lines: + +---- +-------- + +You can also specify an [[http://duh.org|explicit link]] +with label. + +And remember, + + A TAB in front of the line does a quotation. + More TABs, more depth (if allowed). + +Nice. + += Lists = + +A list of items is natural, just putting a '''dash''' or +a '''plus''' at the beginning of the line. + +== Plain List == + +The dash is the default list identifier. For sublists, +just add '''spaces''' at the beginning of the line. More +spaces, more sublists. + + * earth + * america + * south america + * brazil + * how deep can i go? + * europe + * lots of countries + * mars + * who knows? + +The list ends with '''two''' consecutive blank lines. + +== Numbered List == + +The same rules as the plain list, just a different +identifier (plus). + + 1. one + 2. two + 3. three + * mixed lists! + * what a mess + 1. counting again + 2. ... + 4. four + +== Definition List == + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + + orange:: + :: a yellow fruit + apple:: + :: a green or red fruit + other fruits:: + * wee! + * mixing lists + 1. again! + 2. and again! + += Tables = + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +||'''heading 1'''||<:>'''heading 2'''||<)>'''heading 3'''|| +||cell 1.1||<:>cell 1.2||<)>cell 1.3|| +||cell 2.1||<:>cell 2.2||<)>cell 2.3|| + +Without the last pipe, no border: + +||'''heading 1'''||<:>'''heading 2'''||<)>'''heading 3'''|| +||cell 1.1||<:>cell 1.2||<)>cell 1.3|| +||cell 2.1||<:>cell 2.2||<)>cell 2.3|| + += Special Entities = + +Because things were too simple. + +== Images == + +The image mark is as simple as it can be: {{{[filename]}}}. + +[img/photo.jpg] + + * The filename must end in PNG, JPG, GIF, or similar. + * No spaces inside the brackets! + +---- + +[img/t2tpowered.png] + +/* moin code generated by txt2tags 3.3 (http://txt2tags.org) */ +/* cmdline: txt2tags -q --no-rc -t moin -o sample.moin /home/jendrik/projects/txt2tags/samples/sample.t2t */ diff --git a/samples/sample.pmw b/samples/sample.pmw new file mode 100644 index 0000000..4b882a8 --- /dev/null +++ b/samples/sample.pmw @@ -0,0 +1,177 @@ +(:Title TXT2TAGS SAMPLE:) + +(:Description Aurelio Jargas:) + + + +! Introduction + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +[@ + line1: document title + line2: author name, email + line3: date, version +@] + +Lines with balanced equal signs = around are titles. + +! Fonts and Beautifiers + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +!! Beautifiers + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent '''bold''', +''italic'', {-strike-} and {+underline+}. + +The '''''bold italic''''' style is also supported as a +combination. + +!! Pre-Formatted Text + +We can put a code sample or other pre-formatted text: + +[@ + here is pre-formatted + //marks// are **not** ``interpreted`` +@] + +And also, it's easy to put a one line pre-formatted +text: + +[@ + prompt$ ls /etc +@] + +Or use @@pre-formatted@@ inside sentences. + +!! More Cosmetics + +Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + +---- + +---- + +You can also specify an [[explicit link -> http://duh.org]] +with label. + +And remember, + + -> +A TAB in front of the line does a quotation. + + -> +More TABs, more depth (if allowed). + + + + + + +Nice. + +! Lists + +A list of items is natural, just putting a '''dash''' or +a '''plus''' at the beginning of the line. + +!! Plain List + +The dash is the default list identifier. For sublists, +just add '''spaces''' at the beginning of the line. More +spaces, more sublists. + +* earth +** america +*** south america +**** brazil +***** how deep can i go? +** europe +*** lots of countries +* mars +** who knows? + +The list ends with '''two''' consecutive blank lines. + +!! Numbered List + +The same rules as the plain list, just a different +identifier (plus). + +# one +# two +# three +** mixed lists! +** what a mess +### counting again +### ... +# four + +!! Definition List + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +: orange: +a yellow fruit +: apple: +a green or red fruit +: other fruits: +** wee! +** mixing lists +### again! +### and again! + +! Tables + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +||! '''heading 1''' ||!'''heading 2''' ||!'''heading 3'''|| +||cell 1.1 ||cell 1.2 ||cell 1.3|| +||cell 2.1 ||cell 2.2 ||cell 2.3|| + +Without the last pipe, no border: + +||! '''heading 1''' ||!'''heading 2''' ||!'''heading 3'''|| +||cell 1.1 ||cell 1.2 ||cell 1.3|| +||cell 2.1 ||cell 2.2 ||cell 2.3|| + +! Special Entities + +Because things were too simple. + +!! Images + +The image mark is as simple as it can be: @@[filename]@@. + +img/photo.jpg + +* The filename must end in PNG, JPG, GIF, or similar. +* No spaces inside the brackets! + +---- + +img/t2tpowered.png + diff --git a/samples/sample.sgml b/samples/sample.sgml new file mode 100644 index 0000000..eea2706 --- /dev/null +++ b/samples/sample.sgml @@ -0,0 +1,235 @@ + +
+TXT2TAGS SAMPLE +<author>Aurelio Jargas + + +<sect>Introduction<p> + +<p> +Welcome to the txt2tags sample file. + +<p> +Here you have examples and a brief explanation of all +marks. + +<p> +The first 3 lines of the this file are used as headers, +on the following format: + +<tscreen><verb> +line1: document title +line2: author name, email +line3: date, version +</verb></tscreen> + +<p> +Lines with balanced equal signs = around are titles. + +<sect>Fonts and Beautifiers<p> + +<p> +We have two sets of fonts: + +<p> +The NORMAL type that can be improved with beautifiers. + +<p> +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +<p> +We will now enter on a subtitle... + +<sect1>Beautifiers<p> + +<p> +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +<p> +We use double *, /, - and _ to represent <bf>bold</bf>, +<em>italic</em>, strike and <bf><em>underline</em></bf>. + +<p> +The <bf><em>bold italic</em></bf> style is also supported as a +combination. + +<sect1>Pre-Formatted Text<p> + +<p> +We can put a code sample or other pre-formatted text: + +<tscreen><verb> + here is pre-formatted +//marks// are **not** ``interpreted`` +</verb></tscreen> + +<p> +And also, it's easy to put a one line pre-formatted +text: + +<tscreen><verb> +prompt$ ls /etc +</verb></tscreen> + +<p> +Or use <tt>pre-formatted</tt> inside sentences. + +<sect1>More Cosmetics<p> + +<p> +Special entities like email (<htmlurl url="mailto:duh@somewhere.com" name="duh@somewhere.com">) and +URL (<htmlurl url="http://www.duh.com" name="http://www.duh.com">) are detected automagically, +as well as horizontal lines: + +<!-- ________________________________________________________ --> + +<!-- ======================================================== --> + +<p> +You can also specify an <htmlurl url="http://duh.org" name="explicit link"> +with label. + +<p> +And remember, + + <quote> + A TAB in front of the line does a quotation. + More TABs, more depth (if allowed). + </quote> + +<p> +Nice. + +<sect>Lists<p> + +<p> +A list of items is natural, just putting a <bf>dash</bf> or +a <bf>plus</bf> at the beginning of the line. + +<sect1>Plain List<p> + +<p> +The dash is the default list identifier. For sublists, +just add <bf>spaces</bf> at the beginning of the line. More +spaces, more sublists. + +<itemize> +<item>earth + <itemize> + <item>america + <itemize> + <item>south america + <itemize> + <item>brazil + <itemize> + <item>how deep can i go? + </itemize> + </itemize> + </itemize> + <item>europe + <itemize> + <item>lots of countries + </itemize> + </itemize> +<item>mars + <itemize> + <item>who knows? + </itemize> +</itemize> + +<p> +The list ends with <bf>two</bf> consecutive blank lines. + +<sect1>Numbered List<p> + +<p> +The same rules as the plain list, just a different +identifier (plus). + +<enum> +<item>one +<item>two +<item>three + <itemize> + <item>mixed lists! + <item>what a mess + <enum> + <item>counting again + <item>... + </enum> + </itemize> +<item>four +</enum> + +<sect1>Definition List<p> + +<p> +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +<descrip> +<tag>orange</tag> + a yellow fruit +<tag>apple</tag> + a green or red fruit +<tag>other fruits</tag> + <itemize> + <item>wee! + <item>mixing lists + <enum> + <item>again! + <item>and again! + </enum> + </itemize> +</descrip> + +<sect>Tables<p> + +<p> +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +<table><tabular ca="lcr"> +heading 1<colsep>heading 2<colsep>heading 3<rowsep> +cell 1.1<colsep>cell 1.2<colsep>cell 1.3<rowsep> +cell 2.1<colsep>cell 2.2<colsep>cell 2.3 +</tabular></table> + +<p> +Without the last pipe, no border: + +<table><tabular ca="lcr"> +heading 1<colsep>heading 2<colsep>heading 3<rowsep> +cell 1.1<colsep>cell 1.2<colsep>cell 1.3<rowsep> +cell 2.1<colsep>cell 2.2<colsep>cell 2.3 +</tabular></table> + +<sect>Special Entities<p> + +<p> +Because things were too simple. + +<sect1>Images<p> + +<p> +The image mark is as simple as it can be: <tt>[filename]</tt>. + +<p> +<figure><ph vspace=""><img src="img/photo.jpg"></figure> + +<itemize> +<item>The filename must end in PNG, JPG, GIF, or similar. +<item>No spaces inside the brackets! +</itemize> + +<!-- ______________________________________________________- --> + +<p> +<figure><ph vspace=""><img src="img/t2tpowered.png"></figure> + +<!-- sgml code generated by txt2tags 3.3 (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -t sgml -o sample.sgml /home/jendrik/projects/txt2tags/samples/sample.t2t --> +</article> diff --git a/samples/sample.t2t b/samples/sample.t2t new file mode 100644 index 0000000..ea0c542 --- /dev/null +++ b/samples/sample.t2t @@ -0,0 +1,175 @@ +TXT2TAGS SAMPLE +Aurelio Jargas + + +%!encoding: utf-8 + + = Introduction = + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: +``` +line1: document title +line2: author name, email +line3: date, version +``` + +Lines with balanced equal signs = around are titles. + +% a secret comment! +%TODO link to program site http://txt2tags.org + + + = Fonts and Beautifiers = + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + + + == Beautifiers == + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent **bold**, +//italic//, --strike-- and __underline__. + +The **//bold italic//** style is also supported as a +combination. + + + == Pre-Formatted Text == + +We can put a code sample or other pre-formatted text: +``` + here is pre-formatted +//marks// are **not** ``interpreted`` +``` + +And also, it's easy to put a one line pre-formatted +text: +``` prompt$ ls /etc + +Or use ``pre-formatted`` inside sentences. + + + == More Cosmetics == + +Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + +-------------------------------------------------------- +======================================================== + +You can also specify an [explicit link http://duh.org] +with label. + +And remember, + A TAB in front of the line does a quotation. + More TABs, more depth (if allowed). +Nice. + + + = Lists = + +A list of items is natural, just putting a **dash** or +a **plus** at the beginning of the line. + + + == Plain List == + +The dash is the default list identifier. For sublists, +just add **spaces** at the beginning of the line. More +spaces, more sublists. + +- earth + - america + - south america + - brazil + - how deep can i go? + - europe + - lots of countries +- mars + - who knows? + + +The list ends with **two** consecutive blank lines. + + + == Numbered List == + +The same rules as the plain list, just a different +identifier (plus). + ++ one ++ two ++ three + - mixed lists! + - what a mess + + counting again + + ... ++ four + + + == Definition List == + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +: orange + a yellow fruit +: apple + a green or red fruit +: other fruits + - wee! + - mixing lists + + again! + + and again! + + + = Tables = + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | + +Without the last pipe, no border: + + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 + + + = Special Entities = + +Because things were too simple. + + + == Images == + +The image mark is as simple as it can be: ``[filename]``. + +[img/photo.jpg] + +- The filename must end in PNG, JPG, GIF, or similar. +- No spaces inside the brackets! + + +------------------------------------------------------- +[img/t2tpowered.png] diff --git a/samples/sample.tex b/samples/sample.tex new file mode 100644 index 0000000..4aa59e6 --- /dev/null +++ b/samples/sample.tex @@ -0,0 +1,214 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{paralist} % needed for compact lists +\usepackage[normalem]{ulem} % needed by strike +\usepackage[urlcolor=blue,colorlinks=true]{hyperref} +\usepackage[utf8]{inputenc} % char encoding + +\title{TXT2TAGS SAMPLE} +\author{Aurelio Jargas} +\begin{document} +\maketitle +\clearpage + + +\section*{Introduction} + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +\begin{verbatim} +line1: document title +line2: author name, email +line3: date, version +\end{verbatim} + +Lines with balanced equal signs = around are titles. + +\section*{Fonts and Beautifiers} + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +\subsection*{Beautifiers} + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and \_ to represent \textbf{bold}, +\textit{italic}, \sout{strike} and \underline{underline}. + +The \textbf{\textit{bold italic}} style is also supported as a +combination. + +\subsection*{Pre-Formatted Text} + +We can put a code sample or other pre-formatted text: + +\begin{verbatim} + here is pre-formatted +//marks// are **not** ``interpreted`` +\end{verbatim} + +And also, it's easy to put a one line pre-formatted +text: + +\begin{verbatim} +prompt$ ls /etc +\end{verbatim} + +Or use \texttt{pre-formatted} inside sentences. + +\subsection*{More Cosmetics} + +Special entities like email (\htmladdnormallink{duh@somewhere.com}{mailto:duh@somewhere.com}) and +URL (\htmladdnormallink{http://www.duh.com}{http://www.duh.com}) are detected automagically, +as well as horizontal lines: + +\hrulefill{} + +\clearpage + +You can also specify an \htmladdnormallink{explicit link}{http://duh.org} +with label. + +And remember, + + \begin{quotation} +A TAB in front of the line does a quotation. + \begin{quotation} +More TABs, more depth (if allowed). + \end{quotation} + \end{quotation} + +Nice. + +\section*{Lists} + +A list of items is natural, just putting a \textbf{dash} or +a \textbf{plus} at the beginning of the line. + +\subsection*{Plain List} + +The dash is the default list identifier. For sublists, +just add \textbf{spaces} at the beginning of the line. More +spaces, more sublists. + +\begin{compactitem} +\item earth + \begin{compactitem} + \item america + \begin{compactitem} + \item south america + \begin{compactitem} + \item brazil + \item how deep can i go? + \end{compactitem} + \end{compactitem} + \item europe + \begin{compactitem} + \item lots of countries + \end{compactitem} + \end{compactitem} +\item mars + \begin{compactitem} + \item who knows? + \end{compactitem} +\end{compactitem} + +The list ends with \textbf{two} consecutive blank lines. + +\subsection*{Numbered List} + +The same rules as the plain list, just a different +identifier (plus). + +\begin{compactenum} +\item one +\item two +\item three + \begin{compactitem} + \item mixed lists! + \item what a mess + \begin{compactenum} + \item counting again + \item ... + \end{compactenum} + \end{compactitem} +\item four +\end{compactenum} + +\subsection*{Definition List} + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +\begin{compactdesc} +\item[orange] + a yellow fruit +\item[apple] + a green or red fruit +\item[other fruits] + \begin{compactitem} + \item wee! + \item mixing lists + \begin{compactenum} + \item again! + \item and again! + \end{compactenum} + \end{compactitem} +\end{compactdesc} + +\section*{Tables} + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +\begin{center}\begin{tabular}{|l|c|r|} +\hline \textbf{heading 1} & \textbf{heading 2} & \textbf{heading 3} \\ +\hline cell 1.1 & cell 1.2 & cell 1.3 \\ +\hline cell 2.1 & cell 2.2 & cell 2.3 \\ +\hline \end{tabular}\end{center} + +Without the last pipe, no border: + +\begin{center}\begin{tabular}{lcr} +\textbf{heading 1} & \textbf{heading 2} & \textbf{heading 3} \\ +cell 1.1 & cell 1.2 & cell 1.3 \\ +cell 2.1 & cell 2.2 & cell 2.3 \\ +\end{tabular}\end{center} + +\section*{Special Entities} + +Because things were too simple. + +\subsection*{Images} + +The image mark is as simple as it can be: \texttt{[filename]}. + +\includegraphics{img/photo.jpg} + +\begin{compactitem} +\item The filename must end in PNG, JPG, GIF, or similar. +\item No spaces inside the brackets! +\end{compactitem} + +\hrulefill{} + +\includegraphics{img/t2tpowered.png} + +% LaTeX2e code generated by txt2tags 3.3 (http://txt2tags.org) +% cmdline: txt2tags -q --no-rc -t tex -o sample.tex /home/jendrik/projects/txt2tags/samples/sample.t2t +\end{document} diff --git a/samples/sample.txt b/samples/sample.txt new file mode 100644 index 0000000..e120de2 --- /dev/null +++ b/samples/sample.txt @@ -0,0 +1,186 @@ +TXT2TAGS SAMPLE +Aurelio Jargas + + + Introduction + ============ + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + + line1: document title + line2: author name, email + line3: date, version + +Lines with balanced equal signs = around are titles. + + + Fonts and Beautifiers + ===================== + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + + + Beautifiers + =========== + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent bold, +italic, strike and underline. + +The bold italic style is also supported as a +combination. + + + Pre-Formatted Text + ================== + +We can put a code sample or other pre-formatted text: + + here is pre-formatted + //marks// are **not** ``interpreted`` + +And also, it's easy to put a one line pre-formatted +text: + + prompt$ ls /etc + +Or use pre-formatted inside sentences. + + + More Cosmetics + ============== + +Special entities like email (duh@somewhere.com) and +URL (http://www.duh.com) are detected automagically, +as well as horizontal lines: + +-------------------------------------------------------- + +======================================================== + +You can also specify an explicit link (http://duh.org) +with label. + +And remember, + + A TAB in front of the line does a quotation. + + More TABs, more depth (if allowed). + + +Nice. + + + Lists + ===== + +A list of items is natural, just putting a dash or +a plus at the beginning of the line. + + + Plain List + ========== + +The dash is the default list identifier. For sublists, +just add spaces at the beginning of the line. More +spaces, more sublists. + +- earth + - america + - south america + - brazil + - how deep can i go? + - europe + - lots of countries +- mars + - who knows? + +The list ends with two consecutive blank lines. + + + Numbered List + ============= + +The same rules as the plain list, just a different +identifier (plus). + +1. one +2. two +3. three + - mixed lists! + - what a mess + 1. counting again + 2. ... +4. four + + + Definition List + =============== + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +orange + a yellow fruit +apple + a green or red fruit +other fruits + - wee! + - mixing lists + 1. again! + 2. and again! + + + Tables + ====== + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + + || heading 1 | heading 2 | heading 3 | + | cell 1.1 | cell 1.2 | cell 1.3 | + | cell 2.1 | cell 2.2 | cell 2.3 | + +Without the last pipe, no border: + + || heading 1 | heading 2 | heading 3 + | cell 1.1 | cell 1.2 | cell 1.3 + | cell 2.1 | cell 2.2 | cell 2.3 + + + Special Entities + ================ + +Because things were too simple. + + + Images + ====== + +The image mark is as simple as it can be: [filename]. + +[img/photo.jpg] + +- The filename must end in PNG, JPG, GIF, or similar. +- No spaces inside the brackets! + +------------------------------------------------------- + +[img/t2tpowered.png] + diff --git a/samples/sample.wiki b/samples/sample.wiki new file mode 100644 index 0000000..f48e807 --- /dev/null +++ b/samples/sample.wiki @@ -0,0 +1,185 @@ +'''TXT2TAGS SAMPLE''' + +Aurelio Jargas + + + +== Introduction == + +Welcome to the txt2tags sample file. + +Here you have examples and a brief explanation of all +marks. + +The first 3 lines of the this file are used as headers, +on the following format: + +<pre> +line1: document title +line2: author name, email +line3: date, version +</pre> + +Lines with balanced equal signs = around are titles. + +== Fonts and Beautifiers == + +We have two sets of fonts: + +The NORMAL type that can be improved with beautifiers. + +The TYPEWRITER type that uses monospaced font for +pre-formatted text. + +We will now enter on a subtitle... + +=== Beautifiers === + +The text marks for beautifiers are simple, just as you +type on a plain text email message. + +We use double *, /, - and _ to represent '''bold''', +''italic'', <s>strike</s> and <u>underline</u>. + +The '''''bold italic''''' style is also supported as a +combination. + +=== Pre-Formatted Text === + +We can put a code sample or other pre-formatted text: + +<pre> + here is pre-formatted +//marks// are **not** ``interpreted`` +</pre> + +And also, it's easy to put a one line pre-formatted +text: + +<pre> +prompt$ ls /etc +</pre> + +Or use <tt>pre-formatted</tt> inside sentences. + +=== More Cosmetics === + +Special entities like email (mailto:duh@somewhere.com) and +URL ([http://www.duh.com]) are detected automagically, +as well as horizontal lines: + +---- + +---- + +You can also specify an [http://duh.org explicit link] +with label. + +And remember, + + <blockquote> +A TAB in front of the line does a quotation. + <blockquote> +More TABs, more depth (if allowed). + </blockquote> + </blockquote> + +Nice. + +== Lists == + +A list of items is natural, just putting a '''dash''' or +a '''plus''' at the beginning of the line. + +=== Plain List === + +The dash is the default list identifier. For sublists, +just add '''spaces''' at the beginning of the line. More +spaces, more sublists. + +* earth +** america +*** south america +**** brazil +***** how deep can i go? +** europe +*** lots of countries +* mars +** who knows? + +The list ends with '''two''' consecutive blank lines. + +=== Numbered List === + +The same rules as the plain list, just a different +identifier (plus). + +# one +# two +# three +** mixed lists! +** what a mess +### counting again +### ... +# four + +=== Definition List === + +The definition list identifier is a colon, followed by +the term. The term contents is placed on the next line. + +; orange +: a yellow fruit +; apple +: a green or red fruit +; other fruits +** wee! +** mixing lists +### again! +### and again! + +== Tables == + +Use pipes to compose table rows and cells. +Double pipe at the line beginning starts a heading row. +Natural spaces specify each cell alignment. + +{| align="center" border="1" cellpadding="4" +|- +! heading 1 !! heading 2 !! heading 3 +|- +| cell 1.1 || cell 1.2 || cell 1.3 +|- +| cell 2.1 || cell 2.2 || cell 2.3 +|} + +Without the last pipe, no border: + +{| align="center" cellpadding="4" +|- +! heading 1 !! heading 2 !! heading 3 +|- +| cell 1.1 || cell 1.2 || cell 1.3 +|- +| cell 2.1 || cell 2.2 || cell 2.3 +|} + +== Special Entities == + +Because things were too simple. + +=== Images === + +The image mark is as simple as it can be: <tt>[filename]</tt>. + +[[Image:img/photo.jpg|center]] + +* The filename must end in PNG, JPG, GIF, or similar. +* No spaces inside the brackets! + +---- + +[[Image:img/t2tpowered.png|center]] + +<!-- wiki code generated by txt2tags 3.3 (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -t wiki -o sample.wiki /home/jendrik/projects/txt2tags/samples/sample.t2t --> diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..2e5092b --- /dev/null +++ b/setup.py @@ -0,0 +1,58 @@ +import os.path +import re + +import setuptools + + +def read(*parts): + here = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(here, *parts)) as f: + return f.read() + + +def find_version(*file_parts): + version_file = read(*file_parts) + version_match = re.search( + r"^__version__ = ['\"]([^'\"]*)['\"]$", version_file, re.M + ) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + +setuptools.setup( + name="txt2tags", + version=find_version("txt2tags.py"), + description="Convert between markup languages", + long_description=open("README.md").read(), + long_description_content_type="text/markdown", + keywords="markup", + url="https://txt2tags.org", + author="Aurelio Jargas", + author_email="aurelio@aurelio.net", + maintainer="Jendrik Seipp", + maintainer_email="jendrikseipp@gmail.com", + license="GPL2+", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: X11 Applications", + "Intended Audience :: Developers", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Text Processing :: Markup", + ], + py_modules=["txt2tags"], + entry_points={"console_scripts": ["txt2tags=txt2tags:exec_command_line"]}, + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", + tests_require=["tox"], +) diff --git a/test/bugs/run.py b/test/bugs/run.py new file mode 100644 index 0000000..029ac97 --- /dev/null +++ b/test/bugs/run.py @@ -0,0 +1,31 @@ +# +# txt2tags fatal errors tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# +# All these bugs are already fixed on the current version. +# In older releases they dump an ugly Error Traceback. +# + +from __future__ import print_function + +import glob +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + + +def run(): + # test all .t2t files found + for infile in glob.glob("*.t2t"): + basename = infile.replace(".t2t", "") + outfile = basename + ".html" + print(" Testing %s ..." % basename, end=" ") + cmdline = lib.TXT2TAGS + [infile] + output = lib.get_output(cmdline) + if not output: + lib.mark_ok(outfile) + else: + lib.mark_failed(outfile) diff --git a/test/bugs/table-empty.t2t b/test/bugs/table-empty.t2t new file mode 100644 index 0000000..c1979d7 --- /dev/null +++ b/test/bugs/table-empty.t2t @@ -0,0 +1,12 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Bug: Table empty "| |" (until v2.3.1) +% +% The empty table was parsed, but no align or colspan were detected. +% On the table dump, calign.pop() and cspan.pop() were poping empty lists. +% +% Solution: First check if we've got something to pop. +% +| | diff --git a/test/bugs/table-inside-deflist-term.t2t b/test/bugs/table-inside-deflist-term.t2t new file mode 100644 index 0000000..96a5538 --- /dev/null +++ b/test/bugs/table-inside-deflist-term.t2t @@ -0,0 +1,13 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Bug: Table inside Definition List term (until v2.3.1) +% +% After deflist processing, the list id ': ' is removed. +% Then enters table parsing and detects '| ' at line beginning. +% Then we're in trouble. +% +% Solution: Add SEPARATOR at line beginning after deflist processing +% +: | Table diff --git a/test/bugs/test.conf b/test/bugs/test.conf new file mode 100644 index 0000000..6a5b044 --- /dev/null +++ b/test/bugs/test.conf @@ -0,0 +1,9 @@ +%!target: html +%!options: --no-headers + +% Convert comments to titles +%!preproc : '^%%% ([^ \t].*)' '== \1 ==' +% Trick to ensure the body init (don't loose comments) +%!preproc : '^BODYINIT$' '' + +% vim: ft=txt2tags diff --git a/test/bugs/unfixed/blanks-around-nested-blocks-1.t2t b/test/bugs/unfixed/blanks-around-nested-blocks-1.t2t new file mode 100644 index 0000000..44e0918 --- /dev/null +++ b/test/bugs/unfixed/blanks-around-nested-blocks-1.t2t @@ -0,0 +1,38 @@ + +%!target: html +%!options: -H -o- + +%%% +Sample output: +<H2>title</H2> + +<UL> +<LI>Item 1. +<PRE> + Verbatim block +</PRE> + +<LI>Item 2. +</UL> + +There should be a blank line before <PRE>. + +It is not added because PRE is nested inside the list, and _should_add_blank_line() does not handle nested blocks very well. It asks BLOCK.last content to decide if the opening blank line should be added, but it fails because BLOCK.last = title (which is true, because the list is not closed yet). + +It must see if we're dealing with a nested block, and if so, check if we're the first block or which was the last closed block inside the list (in the case there were two consecutive PREs or something). + +This bug affects: +test/crossing/deflist.t2t +test/crossing/list.t2t +test/crossing/numlist.t2t + +2010-06-17 +%%% + +==title== +- Item 1. +``` +Verbatim block +``` +- Item 2. +- diff --git a/test/bugs/unfixed/blanks-around-nested-blocks-2.t2t b/test/bugs/unfixed/blanks-around-nested-blocks-2.t2t new file mode 100644 index 0000000..275b2bc --- /dev/null +++ b/test/bugs/unfixed/blanks-around-nested-blocks-2.t2t @@ -0,0 +1,37 @@ + +%!target: html +%!options: -H -o- + +%%% +Sample output: + <BLOCKQUOTE> + + <HR NOSHADE SIZE=1> + + + <HR NOSHADE SIZE=1> + + </BLOCKQUOTE> + +On the output, there are *two* blank lines between the bars, and it should be only one. The extra line is added because both bars have their own blank lines before and after (respecting blanksaroundbar rule). + +It's _should_add_blank_line() mission to detect this situation and avoid printing the opening blank for the second bar, since the first bar already printed one on closing. + +It fails because the bar are nested, in this case, inside a quote block. + +_should_add_blank_line() doesn't play well with nested blocks. It + +_should_add_blank_line() does not handle nested blocks very well. It asks BLOCK.last content to decide if the opening blank line should be added, but it fails because BLOCK.last is empty. It should be "bar", but BLOCK.last only registers blocks closed at root level (BLOCK.level=1). As these are bars nested inside a quote block (level=2), BLOCK.last is empty until the quote block is closed (which occurs after the two bars are already put on target). + +The solution: it must see if we're dealing with a nested block, and if so, check if we're the first block or which was the last closed block at the same neste level. + +This bug affects: +test/crossing/bar.t2t +test/crossing/bar2.t2t + +2010-06-17 +%%% + + ---------------------------------------------- + ---------------------------------------------- + diff --git a/test/crossing/bar.t2t b/test/crossing/bar.t2t new file mode 100644 index 0000000..279b9c5 --- /dev/null +++ b/test/crossing/bar.t2t @@ -0,0 +1,145 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Bars with blank lines +---------------------------------------------- +---------------------------------------------- + +---------------------------------------------- + + +---------------------------------------------- + +%%% Bars with paragraphs and blank lines +Paragraph 1. +---------------------------------------------- +Paragraph 2. + +---------------------------------------------- + +Paragraph 3. +---------------------------------------------- + +Paragraph 4. + +---------------------------------------------- + + +Paragraph 5. + + +---------------------------------------------- + + +Paragraph 6. + + +%%% Bars with quotes and subquotes (txt: extra blanks) +---------------------------------------------- + Quote 1. +---------------------------------------------- + Quote 2. +---------------------------------------------- + Quote 3. +---------------------------------------------- + Quote 2. +---------------------------------------------- + Quote 1. +---------------------------------------------- + + +%%% Bars with quotes and blank lines +---------------------------------------------- + Quote 1. +---------------------------------------------- + Quote 2. + +---------------------------------------------- + + Quote 3. +---------------------------------------------- + + Quote 4. + +---------------------------------------------- + + + Quote 5. + + +---------------------------------------------- + + + Quote 6. + +%%% Quoted bars with blank lines (txt: extra blanks) + ---------------------------------------------- + ---------------------------------------------- + + ---------------------------------------------- + + + ---------------------------------------------- + + + +%%% Bars with quoted bars (txt: extra blanks) +---------------------------------------------- + ---------------------------------------------- +---------------------------------------------- + + ---------------------------------------------- + ---------------------------------------------- + ---------------------------------------------- + ---------------------------------------------- + +---------------------------------------------- + + + ---------------------------------------------- + + +---------------------------------------------- + +%%% Quoted bars with quotes and blank lines (txt: extra blanks) + Quote 1. + ---------------------------------------------- + Quote 2. + + ---------------------------------------------- + + Quote 3. + ---------------------------------------------- + + Quote 4. + + ---------------------------------------------- + + + Quote 5. + + + ---------------------------------------------- + +%%% Quoted bars inside quote and subquote + Quote 1 - 1 + ---------------------------------------------- + Quote 1 - 2 + Quote 2 - 1 + ---------------------------------------------- + Quote 2 - 2 + Quote 1 - 3 + ---------------------------------------------- + Quote 1 - 4 + +%%% Quoted bars opening and closing quote and subquote (txt: extra blanks) + ---------------------------------------------- + Quote 1 - 1 + ---------------------------------------------- + ---------------------------------------------- + Quote 2 - 1 + ---------------------------------------------- + ---------------------------------------------- + Quote 1 - 2 + ---------------------------------------------- diff --git a/test/crossing/comment.t2t b/test/crossing/comment.t2t new file mode 100644 index 0000000..872fbfc --- /dev/null +++ b/test/crossing/comment.t2t @@ -0,0 +1,88 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title is ignored +%%% += You're not seeing this. = +%%% + +%%% Crossing: Paragraph is ignored +%%% +You're not seeing this. +%%% + +%%% Crossing: Command is ignored +%%% +%!include: ''include.txt'' +%%% + +%%% Crossing: Line is ignored +%%% +---------------------------------------------- +%%% + +%%% Crossing: Verbatim Line is ignored +%%% +``` You're not seeing this. +%%% + +%%% Crossing: Verbatim Block is ignored +%%% +``` +You're not seeing this. +``` +%%% + +%%% Crossing: Raw Line is ignored +%%% +""" You're not seeing this. +%%% + +%%% Crossing: Raw Block is ignored +%%% +""" +You're not seeing this. +""" +%%% + +%%% Crossing: Tagged Line is ignored +%%% +''' You're not seeing this. +%%% + +%%% Crossing: Tagged Block is ignored +%%% +''' +You're not seeing this. +''' +%%% + +%%% Crossing: Quote is ignored +%%% + You're not seeing this. +%%% + +%%% Crossing: List is ignored +%%% +- You're not seeing this. +- +%%% + +%%% Crossing: Numbered List is ignored +%%% ++ You're not seeing this. ++ +%%% + +%%% Crossing: Definition List is ignored +%%% +: You're not seeing this. + You're not seeing this. +: +%%% + +%%% Crossing: Table is ignored +%%% +| You're not seeing this. +%%% diff --git a/test/crossing/include.txt b/test/crossing/include.txt new file mode 100644 index 0000000..201a102 --- /dev/null +++ b/test/crossing/include.txt @@ -0,0 +1 @@ +included diff --git a/test/crossing/list.t2t b/test/crossing/list.t2t new file mode 100644 index 0000000..55bbb76 --- /dev/null +++ b/test/crossing/list.t2t @@ -0,0 +1,82 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title is plain text +- Line 1. += No title tags here. = +- Line 3. +- +%%% Crossing: Paragraph is plain text +- Line 1. +Line 2. +- Line 3. +- +%%% Crossing: Command is parsed inside +- Line 1. +%!include: ''include.txt'' +- Line 3. +- +%%% Crossing: Line closes it (since r42) +- Line 1. +------------------------------------------- +- Line 3. +- +%%% Crossing: Comment Line is ignored +- Line 1. +% You're not seeing this. +- Line 3. +- +%%% Crossing: Comment Block is ignored +- Line 1. +%%% +You're not seeing this. +%%% +- Line 3. +- +%%% Crossing: Raw Line is parsed inside +- Line 1. +""" Raw line +- Line 3. +- +%%% Crossing: Raw Block is parsed inside +- Line 1. +""" +Raw block +""" +- Line 3. +- +%%% Crossing: Tagged Line is parsed inside +- Line 1. +''' Tagged line +- Line 3. +- +%%% Crossing: Tagged Block is parsed inside +- Line 1. +''' +Tagged block +''' +- Line 3. +- +%%% Crossing: Verbatim Line is parsed inside +- Line 1. +``` Verbatim line +- Line 3. +- +%%% Crossing: Verbatim Block is parsed inside +- Line 1. +``` +Verbatim block +``` +- Line 3. +- +%%% Crossing: Quote closes it +- Line 1. + Closed +- Line 3. +- +%%% Crossing: Table closes it +- Line 1. +| Closed +- Line 3. +- diff --git a/test/crossing/ok/bar.html b/test/crossing/ok/bar.html new file mode 100644 index 0000000..c6ff797 --- /dev/null +++ b/test/crossing/ok/bar.html @@ -0,0 +1,298 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Bars with blank lines</h2> + +<hr class="light"> + +<hr class="light"> + +<hr class="light"> + +<hr class="light"> + +</section> +<section> +<h2>Bars with paragraphs and blank lines</h2> + +<p> +Paragraph 1. +</p> + +<hr class="light"> + +<p> +Paragraph 2. +</p> + +<hr class="light"> + +<p> +Paragraph 3. +</p> + +<hr class="light"> + +<p> +Paragraph 4. +</p> + +<hr class="light"> + +<p> +Paragraph 5. +</p> + +<hr class="light"> + +<p> +Paragraph 6. +</p> + +</section> +<section> +<h2>Bars with quotes and subquotes (txt: extra blanks)</h2> + +<hr class="light"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="light"> + + <blockquote> + <blockquote> + Quote 2. + </blockquote> + </blockquote> + +<hr class="light"> + + <blockquote> + <blockquote> + <blockquote> + Quote 3. + </blockquote> + </blockquote> + </blockquote> + +<hr class="light"> + + <blockquote> + <blockquote> + Quote 2. + </blockquote> + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="light"> + +</section> +<section> +<h2>Bars with quotes and blank lines</h2> + +<hr class="light"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 2. + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 3. + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 4. + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 5. + </blockquote> + +<hr class="light"> + + <blockquote> + Quote 6. + </blockquote> + +</section> +<section> +<h2>Quoted bars with blank lines (txt: extra blanks)</h2> + + <blockquote> + + <hr class="light"> + + + <hr class="light"> + + </blockquote> + <blockquote> + + <hr class="light"> + + </blockquote> + <blockquote> + + <hr class="light"> + + </blockquote> + +</section> +<section> +<h2>Bars with quoted bars (txt: extra blanks)</h2> + +<hr class="light"> + + <blockquote> + + <hr class="light"> + + </blockquote> + +<hr class="light"> + + <blockquote> + + <hr class="light"> + + <blockquote> + + <hr class="light"> + + <blockquote> + + <hr class="light"> + + </blockquote> + + <hr class="light"> + + </blockquote> + </blockquote> + +<hr class="light"> + + <blockquote> + + <hr class="light"> + + </blockquote> + +<hr class="light"> + +</section> +<section> +<h2>Quoted bars with quotes and blank lines (txt: extra blanks)</h2> + + <blockquote> + Quote 1. + + <hr class="light"> + + Quote 2. + </blockquote> + <blockquote> + + <hr class="light"> + + </blockquote> + <blockquote> + Quote 3. + + <hr class="light"> + + </blockquote> + <blockquote> + Quote 4. + </blockquote> + <blockquote> + + <hr class="light"> + + </blockquote> + <blockquote> + Quote 5. + </blockquote> + <blockquote> + + <hr class="light"> + + </blockquote> + +</section> +<section> +<h2>Quoted bars inside quote and subquote</h2> + + <blockquote> + Quote 1 - 1 + + <hr class="light"> + + Quote 1 - 2 + <blockquote> + Quote 2 - 1 + + <hr class="light"> + + Quote 2 - 2 + </blockquote> + Quote 1 - 3 + + <hr class="light"> + + Quote 1 - 4 + </blockquote> + +</section> +<section> +<h2>Quoted bars opening and closing quote and subquote (txt: extra blanks)</h2> + + <blockquote> + + <hr class="light"> + + Quote 1 - 1 + + <hr class="light"> + + <blockquote> + + <hr class="light"> + + Quote 2 - 1 + + <hr class="light"> + + </blockquote> + + <hr class="light"> + + Quote 1 - 2 + + <hr class="light"> + + </blockquote> +</section> +</section> +</div> diff --git a/test/crossing/ok/bar.txt b/test/crossing/ok/bar.txt new file mode 100644 index 0000000..39baca7 --- /dev/null +++ b/test/crossing/ok/bar.txt @@ -0,0 +1,237 @@ + + Bars with blank lines + ===================== + +---------------------------------------------- + +---------------------------------------------- + +---------------------------------------------- + +---------------------------------------------- + + + Bars with paragraphs and blank lines + ==================================== + +Paragraph 1. + +---------------------------------------------- + +Paragraph 2. + +---------------------------------------------- + +Paragraph 3. + +---------------------------------------------- + +Paragraph 4. + +---------------------------------------------- + +Paragraph 5. + +---------------------------------------------- + +Paragraph 6. + + + Bars with quotes and subquotes (txt: extra blanks) + ================================================== + +---------------------------------------------- + + Quote 1. + +---------------------------------------------- + + + Quote 2. + + +---------------------------------------------- + + + + Quote 3. + + + +---------------------------------------------- + + + Quote 2. + + +---------------------------------------------- + + Quote 1. + +---------------------------------------------- + + + Bars with quotes and blank lines + ================================ + +---------------------------------------------- + + Quote 1. + +---------------------------------------------- + + Quote 2. + +---------------------------------------------- + + Quote 3. + +---------------------------------------------- + + Quote 4. + +---------------------------------------------- + + Quote 5. + +---------------------------------------------- + + Quote 6. + + + Quoted bars with blank lines (txt: extra blanks) + ================================================ + + + ---------------------------------------------- + + + ---------------------------------------------- + + + + ---------------------------------------------- + + + + ---------------------------------------------- + + + + Bars with quoted bars (txt: extra blanks) + ========================================= + +---------------------------------------------- + + + ---------------------------------------------- + + +---------------------------------------------- + + + ---------------------------------------------- + + + + ---------------------------------------------- + + + + ---------------------------------------------- + + + + ---------------------------------------------- + + + +---------------------------------------------- + + + ---------------------------------------------- + + +---------------------------------------------- + + + Quoted bars with quotes and blank lines (txt: extra blanks) + =========================================================== + + Quote 1. + + ---------------------------------------------- + + Quote 2. + + + ---------------------------------------------- + + + Quote 3. + + ---------------------------------------------- + + + Quote 4. + + + ---------------------------------------------- + + + Quote 5. + + + ---------------------------------------------- + + + + Quoted bars inside quote and subquote + ===================================== + + Quote 1 - 1 + + ---------------------------------------------- + + Quote 1 - 2 + + Quote 2 - 1 + + ---------------------------------------------- + + Quote 2 - 2 + + Quote 1 - 3 + + ---------------------------------------------- + + Quote 1 - 4 + + + Quoted bars opening and closing quote and subquote (txt: extra blanks) + ====================================================================== + + + ---------------------------------------------- + + Quote 1 - 1 + + ---------------------------------------------- + + + + ---------------------------------------------- + + Quote 2 - 1 + + ---------------------------------------------- + + + + ---------------------------------------------- + + Quote 1 - 2 + + ---------------------------------------------- + + diff --git a/test/crossing/ok/bar2.html b/test/crossing/ok/bar2.html new file mode 100644 index 0000000..e695038 --- /dev/null +++ b/test/crossing/ok/bar2.html @@ -0,0 +1,298 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Bars with blank lines</h2> + +<hr class="heavy"> + +<hr class="heavy"> + +<hr class="heavy"> + +<hr class="heavy"> + +</section> +<section> +<h2>Bars with paragraphs and blank lines</h2> + +<p> +Paragraph 1. +</p> + +<hr class="heavy"> + +<p> +Paragraph 2. +</p> + +<hr class="heavy"> + +<p> +Paragraph 3. +</p> + +<hr class="heavy"> + +<p> +Paragraph 4. +</p> + +<hr class="heavy"> + +<p> +Paragraph 5. +</p> + +<hr class="heavy"> + +<p> +Paragraph 6. +</p> + +</section> +<section> +<h2>Bars with quotes and subquotes (txt: extra blanks)</h2> + +<hr class="heavy"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="heavy"> + + <blockquote> + <blockquote> + Quote 2. + </blockquote> + </blockquote> + +<hr class="heavy"> + + <blockquote> + <blockquote> + <blockquote> + Quote 3. + </blockquote> + </blockquote> + </blockquote> + +<hr class="heavy"> + + <blockquote> + <blockquote> + Quote 2. + </blockquote> + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="heavy"> + +</section> +<section> +<h2>Bars with quotes and blank lines</h2> + +<hr class="heavy"> + + <blockquote> + Quote 1. + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 2. + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 3. + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 4. + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 5. + </blockquote> + +<hr class="heavy"> + + <blockquote> + Quote 6. + </blockquote> + +</section> +<section> +<h2>Quoted bars with blank lines (txt: extra blanks)</h2> + + <blockquote> + + <hr class="heavy"> + + + <hr class="heavy"> + + </blockquote> + <blockquote> + + <hr class="heavy"> + + </blockquote> + <blockquote> + + <hr class="heavy"> + + </blockquote> + +</section> +<section> +<h2>Bars with quoted bars (txt: extra blanks)</h2> + +<hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + </blockquote> + +<hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + </blockquote> + + <hr class="heavy"> + + </blockquote> + </blockquote> + +<hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + </blockquote> + +<hr class="heavy"> + +</section> +<section> +<h2>Quoted bars with quotes and blank lines (txt: extra blanks)</h2> + + <blockquote> + Quote 1. + + <hr class="heavy"> + + Quote 2. + </blockquote> + <blockquote> + + <hr class="heavy"> + + </blockquote> + <blockquote> + Quote 3. + + <hr class="heavy"> + + </blockquote> + <blockquote> + Quote 4. + </blockquote> + <blockquote> + + <hr class="heavy"> + + </blockquote> + <blockquote> + Quote 5. + </blockquote> + <blockquote> + + <hr class="heavy"> + + </blockquote> + +</section> +<section> +<h2>Quoted bars inside quote and subquote</h2> + + <blockquote> + Quote 1 - 1 + + <hr class="heavy"> + + Quote 1 - 2 + <blockquote> + Quote 2 - 1 + + <hr class="heavy"> + + Quote 2 - 2 + </blockquote> + Quote 1 - 3 + + <hr class="heavy"> + + Quote 1 - 4 + </blockquote> + +</section> +<section> +<h2>Quoted bars opening and closing quote and subquote (txt: extra blanks)</h2> + + <blockquote> + + <hr class="heavy"> + + Quote 1 - 1 + + <hr class="heavy"> + + <blockquote> + + <hr class="heavy"> + + Quote 2 - 1 + + <hr class="heavy"> + + </blockquote> + + <hr class="heavy"> + + Quote 1 - 2 + + <hr class="heavy"> + + </blockquote> +</section> +</section> +</div> diff --git a/test/crossing/ok/bar2.txt b/test/crossing/ok/bar2.txt new file mode 100644 index 0000000..fd9df05 --- /dev/null +++ b/test/crossing/ok/bar2.txt @@ -0,0 +1,237 @@ + + Bars with blank lines + ===================== + +============================================== + +============================================== + +============================================== + +============================================== + + + Bars with paragraphs and blank lines + ==================================== + +Paragraph 1. + +============================================== + +Paragraph 2. + +============================================== + +Paragraph 3. + +============================================== + +Paragraph 4. + +============================================== + +Paragraph 5. + +============================================== + +Paragraph 6. + + + Bars with quotes and subquotes (txt: extra blanks) + ================================================== + +============================================== + + Quote 1. + +============================================== + + + Quote 2. + + +============================================== + + + + Quote 3. + + + +============================================== + + + Quote 2. + + +============================================== + + Quote 1. + +============================================== + + + Bars with quotes and blank lines + ================================ + +============================================== + + Quote 1. + +============================================== + + Quote 2. + +============================================== + + Quote 3. + +============================================== + + Quote 4. + +============================================== + + Quote 5. + +============================================== + + Quote 6. + + + Quoted bars with blank lines (txt: extra blanks) + ================================================ + + + ============================================== + + + ============================================== + + + + ============================================== + + + + ============================================== + + + + Bars with quoted bars (txt: extra blanks) + ========================================= + +============================================== + + + ============================================== + + +============================================== + + + ============================================== + + + + ============================================== + + + + ============================================== + + + + ============================================== + + + +============================================== + + + ============================================== + + +============================================== + + + Quoted bars with quotes and blank lines (txt: extra blanks) + =========================================================== + + Quote 1. + + ============================================== + + Quote 2. + + + ============================================== + + + Quote 3. + + ============================================== + + + Quote 4. + + + ============================================== + + + Quote 5. + + + ============================================== + + + + Quoted bars inside quote and subquote + ===================================== + + Quote 1 - 1 + + ============================================== + + Quote 1 - 2 + + Quote 2 - 1 + + ============================================== + + Quote 2 - 2 + + Quote 1 - 3 + + ============================================== + + Quote 1 - 4 + + + Quoted bars opening and closing quote and subquote (txt: extra blanks) + ====================================================================== + + + ============================================== + + Quote 1 - 1 + + ============================================== + + + + ============================================== + + Quote 2 - 1 + + ============================================== + + + + ============================================== + + Quote 1 - 2 + + ============================================== + + diff --git a/test/crossing/ok/comment.html b/test/crossing/ok/comment.html new file mode 100644 index 0000000..55c8abd --- /dev/null +++ b/test/crossing/ok/comment.html @@ -0,0 +1,66 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is ignored</h2> + +</section> +<section> +<h2>Crossing: Paragraph is ignored</h2> + +</section> +<section> +<h2>Crossing: Command is ignored</h2> + +</section> +<section> +<h2>Crossing: Line is ignored</h2> + +</section> +<section> +<h2>Crossing: Verbatim Line is ignored</h2> + +</section> +<section> +<h2>Crossing: Verbatim Block is ignored</h2> + +</section> +<section> +<h2>Crossing: Raw Line is ignored</h2> + +</section> +<section> +<h2>Crossing: Raw Block is ignored</h2> + +</section> +<section> +<h2>Crossing: Tagged Line is ignored</h2> + +</section> +<section> +<h2>Crossing: Tagged Block is ignored</h2> + +</section> +<section> +<h2>Crossing: Quote is ignored</h2> + +</section> +<section> +<h2>Crossing: List is ignored</h2> + +</section> +<section> +<h2>Crossing: Numbered List is ignored</h2> + +</section> +<section> +<h2>Crossing: Definition List is ignored</h2> + +</section> +<section> +<h2>Crossing: Table is ignored</h2> + +</section> +</section> +</div> diff --git a/test/crossing/ok/deflist.html b/test/crossing/ok/deflist.html new file mode 100644 index 0000000..7495b73 --- /dev/null +++ b/test/crossing/ok/deflist.html @@ -0,0 +1,196 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is plain text</h2> + +<dl> +<dt>Line 1.</dt><dd> += No title tags here. = +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Paragraph is plain text</h2> + +<dl> +<dt>Line 1.</dt><dd> +Line 2. +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Command is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +included +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Line closes it (since r42)</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +</dl> + +<hr class="light"> + +<dl> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Raw Line is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +Raw line +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Raw Block is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +Raw block +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Tagged Line is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +Tagged line +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Tagged Block is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +Tagged block +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Verbatim Line is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +<pre> +Verbatim line +</pre> + +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Verbatim Block is parsed inside</h2> + +<dl> +<dt>Line 1.</dt><dd> +<pre> +Verbatim block +</pre> + +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Quote closes it</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +</dl> + + <blockquote> + Closed + </blockquote> + +<dl> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Crossing: Table closes it</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +</dl> + +<table> +<tr> +<td>Closed</td> +</tr> +</table> + +<dl> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +</section> +</div> diff --git a/test/crossing/ok/list.html b/test/crossing/ok/list.html new file mode 100644 index 0000000..fed1869 --- /dev/null +++ b/test/crossing/ok/list.html @@ -0,0 +1,196 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is plain text</h2> + +<ul> +<li>Line 1. += No title tags here. = +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Paragraph is plain text</h2> + +<ul> +<li>Line 1. +Line 2. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Command is parsed inside</h2> + +<ul> +<li>Line 1. +included +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Line closes it (since r42)</h2> + +<ul> +<li>Line 1. +</li> +</ul> + +<hr class="light"> + +<ul> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Raw Line is parsed inside</h2> + +<ul> +<li>Line 1. +Raw line +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Raw Block is parsed inside</h2> + +<ul> +<li>Line 1. +Raw block +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Tagged Line is parsed inside</h2> + +<ul> +<li>Line 1. +Tagged line +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Tagged Block is parsed inside</h2> + +<ul> +<li>Line 1. +Tagged block +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Verbatim Line is parsed inside</h2> + +<ul> +<li>Line 1. +<pre> +Verbatim line +</pre> + +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Verbatim Block is parsed inside</h2> + +<ul> +<li>Line 1. +<pre> +Verbatim block +</pre> + +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Quote closes it</h2> + +<ul> +<li>Line 1. +</li> +</ul> + + <blockquote> + Closed + </blockquote> + +<ul> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Crossing: Table closes it</h2> + +<ul> +<li>Line 1. +</li> +</ul> + +<table> +<tr> +<td>Closed</td> +</tr> +</table> + +<ul> +<li>Line 3. +</li> +</ul> + +</section> +</section> +</div> diff --git a/test/crossing/ok/numlist.html b/test/crossing/ok/numlist.html new file mode 100644 index 0000000..d34aa58 --- /dev/null +++ b/test/crossing/ok/numlist.html @@ -0,0 +1,196 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is plain text</h2> + +<ol> +<li>Line 1. += No title tags here. = +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Paragraph is plain text</h2> + +<ol> +<li>Line 1. +Line 2. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Command is parsed inside</h2> + +<ol> +<li>Line 1. +included +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Line closes it (since r42)</h2> + +<ol> +<li>Line 1. +</li> +</ol> + +<hr class="light"> + +<ol> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Raw Line is parsed inside</h2> + +<ol> +<li>Line 1. +Raw line +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Raw Block is parsed inside</h2> + +<ol> +<li>Line 1. +Raw block +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Tagged Line is parsed inside</h2> + +<ol> +<li>Line 1. +Tagged line +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Tagged Block is parsed inside</h2> + +<ol> +<li>Line 1. +Tagged block +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Verbatim Line is parsed inside</h2> + +<ol> +<li>Line 1. +<pre> +Verbatim line +</pre> + +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Verbatim Block is parsed inside</h2> + +<ol> +<li>Line 1. +<pre> +Verbatim block +</pre> + +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Quote closes it</h2> + +<ol> +<li>Line 1. +</li> +</ol> + + <blockquote> + Closed + </blockquote> + +<ol> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Crossing: Table closes it</h2> + +<ol> +<li>Line 1. +</li> +</ol> + +<table> +<tr> +<td>Closed</td> +</tr> +</table> + +<ol> +<li>Line 3. +</li> +</ol> + +</section> +</section> +</div> diff --git a/test/crossing/ok/paragraph.html b/test/crossing/ok/paragraph.html new file mode 100644 index 0000000..6195228 --- /dev/null +++ b/test/crossing/ok/paragraph.html @@ -0,0 +1,273 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title closes it</h2> + +<p> +Line 1. +</p> + +</section> +</section> +<section> +<h1>Closed</h1> + +<p> +Line 3. +</p> + +<section> +<h2>Crossing: Command is parsed</h2> + +<p> +Line 1. +included +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Line closes it</h2> + +<p> +Line 1. +</p> + +<hr class="light"> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<p> +Line 1. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<p> +Line 1. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Verbatim Line closes it</h2> + +<p> +Line 1. +</p> + +<pre> +Closed +</pre> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Verbatim Block closes it</h2> + +<p> +Line 1. +</p> + +<pre> +Closed +</pre> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Raw Line is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Raw Block is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Raw Line at end is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Raw Line at start doesn't open new para</h2> + +Line 1. +<p> +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Raw Line alone doesn't open new para</h2> + +Line 1. +Line 2. + +</section> +<section> +<h2>Crossing: Tagged Line is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Tagged Block is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Tagged Line at end is parsed inside</h2> + +<p> +Line 1. +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Tagged Line at start doesn't open new para</h2> + +Line 1. +<p> +Line 2. +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Tagged Line alone doesn't open new para</h2> + +Line 1. +Line 2. + +</section> +<section> +<h2>Crossing: Quote closes it</h2> + +<p> +Line 1. +</p> + <blockquote> + Closed + </blockquote> +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: List closes it</h2> + +<p> +Line 1. +</p> + +<ul> +<li>Closed +</li> +</ul> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Numbered List closes it</h2> + +<p> +Line 1. +</p> + +<ol> +<li>Closed +</li> +</ol> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Definition List closes it</h2> + +<p> +Line 1. +</p> + +<dl> +<dt>Closed</dt><dd> + Closed +</dd> +</dl> + +<p> +Line 3. +</p> + +</section> +<section> +<h2>Crossing: Table closes it</h2> + +<p> +Line 1. +</p> + +<table> +<tr> +<td>Closed</td> +</tr> +</table> + +<p> +Line 3. +</p> +</section> +</section> +</div> diff --git a/test/crossing/ok/quote.html b/test/crossing/ok/quote.html new file mode 100644 index 0000000..190d8ad --- /dev/null +++ b/test/crossing/ok/quote.html @@ -0,0 +1,249 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +</section> +</section> +<section> +<h1>Closed</h1> + + <blockquote> + Line 3. + </blockquote> + +<section> +<h2>Crossing: Paragraph closes it</h2> + + <blockquote> + Line 1. + </blockquote> +<p> +Closed +</p> + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Command is parsed</h2> + + <blockquote> + Line 1. +included + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Command at end is parsed inside</h2> + + <blockquote> + Line 1. + Line 3. +included + </blockquote> + +</section> +<section> +<h2>Crossing: Line closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<hr class="light"> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + + <blockquote> + Line 1. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + + <blockquote> + Line 1. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Raw Line is parsed</h2> + + <blockquote> + Line 1. +Line 2. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Raw Block is parsed</h2> + + <blockquote> + Line 1. +Line 2. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Raw Line at end is parsed inside</h2> + + <blockquote> + Line 1. + Line 2. +Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Tagged Line is parsed</h2> + + <blockquote> + Line 1. +Line 2. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Tagged Block is parsed</h2> + + <blockquote> + Line 1. +Line 2. + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Tagged Line at end is parsed inside</h2> + + <blockquote> + Line 1. + Line 2. +Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Verbatim Line closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<pre> +Closed +</pre> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Verbatim Block closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<pre> +Closed +</pre> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: List closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<ul> +<li>Closed +</li> +</ul> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Numbered List closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<ol> +<li>Closed +</li> +</ol> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Definition List closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<dl> +<dt>Closed</dt><dd> + Closed +</dd> +</dl> + + <blockquote> + Line 3. + </blockquote> + +</section> +<section> +<h2>Crossing: Table closes it</h2> + + <blockquote> + Line 1. + </blockquote> + +<table> +<tr> +<td>Closed</td> +</tr> +</table> + + <blockquote> + Line 3. + </blockquote> +</section> +</section> +</div> diff --git a/test/crossing/ok/raw.html b/test/crossing/ok/raw.html new file mode 100644 index 0000000..0e1704e --- /dev/null +++ b/test/crossing/ok/raw.html @@ -0,0 +1,111 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is ignored</h2> + += No title tags here. = + +</section> +<section> +<h2>Crossing: Paragraph is ignored</h2> + +No paragraph tags here. + +</section> +<section> +<h2>Crossing: Command is ignored</h2> + +%!include: ''include.txt'' + +</section> +<section> +<h2>Crossing: Line is ignored</h2> + +------------------------------------------- + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +% You're seeing this. + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +%%% +You're seeing this. +%%% + +</section> +<section> +<h2>Crossing: Tagged Line is ignored</h2> + +''' No Tagged here. + +</section> +<section> +<h2>Crossing: Tagged Block is ignored</h2> + +''' +No Tagged here. +''' + +</section> +<section> +<h2>Crossing: Verbatim Line is ignored</h2> + +``` No verbatim here. + +</section> +<section> +<h2>Crossing: Verbatim Block is ignored</h2> + +``` +No verbatim here. +``` + +</section> +<section> +<h2>Crossing: Raw Line is ignored</h2> + +""" No raw line here. + +</section> +<section> +<h2>Crossing: Quote is ignored</h2> + + No quote tags here. + +</section> +<section> +<h2>Crossing: List is ignored</h2> + +- No list tags here. +- + +</section> +<section> +<h2>Crossing: Numbered List is ignored</h2> + ++ No numbered list tags here. ++ + +</section> +<section> +<h2>Crossing: Definition List is ignored</h2> + +: No definition term tags here. + No definition definition tags here. +: + +</section> +<section> +<h2>Crossing: Table is ignored</h2> + +| No table here. +</section> +</section> +</div> diff --git a/test/crossing/ok/table.html b/test/crossing/ok/table.html new file mode 100644 index 0000000..2014bb1 --- /dev/null +++ b/test/crossing/ok/table.html @@ -0,0 +1,304 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +</section> +</section> +<section> +<h1>Closed</h1> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +<section> +<h2>Crossing: Paragraph closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<p> +Closed +</p> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Command closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +included + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Line closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<hr class="light"> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Raw Line closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +Closed + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Raw Block closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +Closed + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Tagged Line closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +Closed + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Tagged Block closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +Closed + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Verbatim Line closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<pre> +Closed +</pre> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Verbatim Block closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<pre> +Closed +</pre> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Quote closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + + <blockquote> + Closed + </blockquote> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: List closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<ul> +<li>Closed +</li> +</ul> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Numbered List closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<ol> +<li>Closed +</li> +</ol> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Crossing: Definition List closes it</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +</table> + +<dl> +<dt>Closed</dt><dd> + Closed +</dd> +</dl> + +<table class="tableborder"> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +</section> +</div> diff --git a/test/crossing/ok/tagged.html b/test/crossing/ok/tagged.html new file mode 100644 index 0000000..8384e10 --- /dev/null +++ b/test/crossing/ok/tagged.html @@ -0,0 +1,97 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is ignored</h2> + += No title tags here. = + +</section> +<section> +<h2>Crossing: Paragraph is ignored</h2> + +No paragraph tags here. + +</section> +<section> +<h2>Crossing: Command is ignored</h2> + +%!include: ''include.txt'' + +</section> +<section> +<h2>Crossing: Line is ignored</h2> + +------------------------------------------- + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +% You're seeing this. + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +%%% +You're seeing this. +%%% + +</section> +<section> +<h2>Crossing: Verbatim Line is ignored</h2> + +``` No verbatim here. + +</section> +<section> +<h2>Crossing: Verbatim Block is ignored</h2> + +``` +No verbatim here. +``` + +</section> +<section> +<h2>Crossing: Tagged Line is ignored</h2> + +''' No tagged line here. + +</section> +<section> +<h2>Crossing: Quote is ignored</h2> + + No quote tags here. + +</section> +<section> +<h2>Crossing: List is ignored</h2> + +- No list tags here. +- + +</section> +<section> +<h2>Crossing: Numbered List is ignored</h2> + ++ No numbered list tags here. ++ + +</section> +<section> +<h2>Crossing: Definition List is ignored</h2> + +: No definition term tags here. + No definition definition tags here. +: + +</section> +<section> +<h2>Crossing: Table is ignored</h2> + +| No table here. +</section> +</section> +</div> diff --git a/test/crossing/ok/verbatim.html b/test/crossing/ok/verbatim.html new file mode 100644 index 0000000..b85ec91 --- /dev/null +++ b/test/crossing/ok/verbatim.html @@ -0,0 +1,144 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Crossing: Title is ignored</h2> + +<pre> += No title tags here. = +</pre> + +</section> +<section> +<h2>Crossing: Paragraph is ignored</h2> + +<pre> +No paragraph tags here. +</pre> + +</section> +<section> +<h2>Crossing: Command is ignored</h2> + +<pre> +%!include: ''include.txt'' +</pre> + +</section> +<section> +<h2>Crossing: Line is ignored</h2> + +<pre> +------------------------------------------- +</pre> + +</section> +<section> +<h2>Crossing: Comment Line is ignored</h2> + +<pre> +% You're seeing this. +</pre> + +</section> +<section> +<h2>Crossing: Comment Block is ignored</h2> + +<pre> +%%% +You're seeing this. +%%% +</pre> + +</section> +<section> +<h2>Crossing: Raw Line is ignored</h2> + +<pre> +""" No raw here. +</pre> + +</section> +<section> +<h2>Crossing: Raw Block is ignored</h2> + +<pre> +""" +No raw here. +""" +</pre> + +</section> +<section> +<h2>Crossing: Tagged Line is ignored</h2> + +<pre> +''' No Tagged here. +</pre> + +</section> +<section> +<h2>Crossing: Tagged Block is ignored</h2> + +<pre> +''' +No Tagged here. +''' +</pre> + +</section> +<section> +<h2>Crossing: Verbatim Line is ignored</h2> + +<pre> +``` No verbatim line here. +</pre> + +</section> +<section> +<h2>Crossing: Quote is ignored</h2> + +<pre> + No quote tags here. +</pre> + +</section> +<section> +<h2>Crossing: List is ignored</h2> + +<pre> +- No list tags here. +- +</pre> + +</section> +<section> +<h2>Crossing: Numbered List is ignored</h2> + +<pre> ++ No numbered list tags here. ++ +</pre> + +</section> +<section> +<h2>Crossing: Definition List is ignored</h2> + +<pre> +: No definition term tags here. + No definition definition tags here. +: +</pre> + +</section> +<section> +<h2>Crossing: Table is ignored</h2> + +<pre> +| No table here. +</pre> + +</section> +</section> +</div> diff --git a/test/crossing/paragraph.t2t b/test/crossing/paragraph.t2t new file mode 100644 index 0000000..4f83d6f --- /dev/null +++ b/test/crossing/paragraph.t2t @@ -0,0 +1,125 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title closes it +Line 1. += Closed = +Line 3. + +%%% Crossing: Command is parsed +Line 1. +%!include: ''include.txt'' +Line 3. + +%%% Crossing: Line closes it +Line 1. +---------------------------------------------- +Line 3. + +%%% Crossing: Comment Line is ignored +Line 1. +% You're not seeing this +Line 3. + +%%% Crossing: Comment Block is ignored +Line 1. +%%% +You're not seeing this +%%% +Line 3. + +%%% Crossing: Verbatim Line closes it +Line 1. +``` Closed +Line 3. + +%%% Crossing: Verbatim Block closes it +Line 1. +``` +Closed +``` +Line 3. + +%%% Crossing: Raw Line is parsed inside +Line 1. +""" Line 2. +Line 3. + +%%% Crossing: Raw Block is parsed inside +Line 1. +""" +Line 2. +""" +Line 3. + +%%% Crossing: Raw Line at end is parsed inside +Line 1. +Line 2. +""" Line 3. + +%%% Crossing: Raw Line at start doesn't open new para +""" Line 1. +Line 2. +Line 3. + +%%% Crossing: Raw Line alone doesn't open new para +""" Line 1. + +""" Line 2. + +%%% Crossing: Tagged Line is parsed inside +Line 1. +''' Line 2. +Line 3. + +%%% Crossing: Tagged Block is parsed inside +Line 1. +''' +Line 2. +''' +Line 3. + +%%% Crossing: Tagged Line at end is parsed inside +Line 1. +Line 2. +''' Line 3. + +%%% Crossing: Tagged Line at start doesn't open new para +''' Line 1. +Line 2. +Line 3. + +%%% Crossing: Tagged Line alone doesn't open new para +''' Line 1. + +''' Line 2. + +%%% Crossing: Quote closes it +Line 1. + Closed +Line 3. + +%%% Crossing: List closes it +Line 1. +- Closed +- +Line 3. + +%%% Crossing: Numbered List closes it +Line 1. ++ Closed ++ +Line 3. + +%%% Crossing: Definition List closes it +Line 1. +: Closed + Closed +: +Line 3. + +%%% Crossing: Table closes it +Line 1. +| Closed +Line 3. diff --git a/test/crossing/quote.t2t b/test/crossing/quote.t2t new file mode 100644 index 0000000..4ee4111 --- /dev/null +++ b/test/crossing/quote.t2t @@ -0,0 +1,92 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title closes it + Line 1. += Closed = + Line 3. +%%% Crossing: Paragraph closes it + Line 1. +Closed + Line 3. +%%% Crossing: Command is parsed + Line 1. +%!include: ''include.txt'' + Line 3. +%%% Crossing: Command at end is parsed inside + Line 1. + Line 3. +%!include: ''include.txt'' +%%% Crossing: Line closes it + Line 1. +------------------------------------------- + Line 3. +%%% Crossing: Comment Line is ignored + Line 1. +% You're not seeing this. + Line 3. +%%% Crossing: Comment Block is ignored + Line 1. +%%% +You're not seeing this. +%%% + Line 3. +%%% Crossing: Raw Line is parsed + Line 1. +""" Line 2. + Line 3. +%%% Crossing: Raw Block is parsed + Line 1. +""" +Line 2. +""" + Line 3. +%%% Crossing: Raw Line at end is parsed inside + Line 1. + Line 2. +""" Line 3. +%%% Crossing: Tagged Line is parsed + Line 1. +''' Line 2. + Line 3. +%%% Crossing: Tagged Block is parsed + Line 1. +''' +Line 2. +''' + Line 3. +%%% Crossing: Tagged Line at end is parsed inside + Line 1. + Line 2. +''' Line 3. +%%% Crossing: Verbatim Line closes it + Line 1. +``` Closed + Line 3. +%%% Crossing: Verbatim Block closes it + Line 1. +``` +Closed +``` + Line 3. +%%% Crossing: List closes it + Line 1. +- Closed +- + Line 3. +%%% Crossing: Numbered List closes it + Line 1. ++ Closed ++ + Line 3. +%%% Crossing: Definition List closes it + Line 1. +: Closed + Closed +: + Line 3. +%%% Crossing: Table closes it + Line 1. +| Closed + Line 3. diff --git a/test/crossing/raw.t2t b/test/crossing/raw.t2t new file mode 100644 index 0000000..b88c4ca --- /dev/null +++ b/test/crossing/raw.t2t @@ -0,0 +1,78 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title is ignored +""" += No title tags here. = +""" +%%% Crossing: Paragraph is ignored +""" +No paragraph tags here. +""" +%%% Crossing: Command is ignored +""" +%!include: ''include.txt'' +""" +%%% Crossing: Line is ignored +""" +------------------------------------------- +""" +%%% Crossing: Comment Line is ignored +""" +% You're seeing this. +""" +%%% Crossing: Comment Block is ignored +""" +%%% +You're seeing this. +%%% +""" +%%% Crossing: Tagged Line is ignored +""" +''' No Tagged here. +""" +%%% Crossing: Tagged Block is ignored +""" +''' +No Tagged here. +''' +""" +%%% Crossing: Verbatim Line is ignored +""" +``` No verbatim here. +""" +%%% Crossing: Verbatim Block is ignored +""" +``` +No verbatim here. +``` +""" +%%% Crossing: Raw Line is ignored +""" +""" No raw line here. +""" +%%% Crossing: Quote is ignored +""" + No quote tags here. +""" +%%% Crossing: List is ignored +""" +- No list tags here. +- +""" +%%% Crossing: Numbered List is ignored +""" ++ No numbered list tags here. ++ +""" +%%% Crossing: Definition List is ignored +""" +: No definition term tags here. + No definition definition tags here. +: +""" +%%% Crossing: Table is ignored +""" +| No table here. +""" diff --git a/test/crossing/run.py b/test/crossing/run.py new file mode 100644 index 0000000..9fff041 --- /dev/null +++ b/test/crossing/run.py @@ -0,0 +1,81 @@ +# +# txt2tags crossing marks tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +from __future__ import print_function + +import glob +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# left files are generated from right ones (using smart filters) +ALIASES = {"numlist": "list", "deflist": "list", "bar2": "bar"} + +# smart filters to allow source inheritance +FILTERS = { + "deflist": [("pre", "^-( |$)", r":\1")], + "numlist": [("pre", "^-( |$)", r"+\1")], + "bar2": [("pre", "--", r"==")], +} + + +# convert FILTERS tuples to txt2tags pre/postproc rules +def addFilters(filters): + if not filters: + return [] + config = [] + cmdline = [] + for filter in filters: + config.append("%%!%sproc: '%s' '%s'" % filter) + if config: + lib.WriteFile(lib.CONFIG_FILE, "\n".join(config)) + cmdline = ["-C", lib.CONFIG_FILE] + return cmdline + + +def run(): + # test all .t2t files found + for infile in glob.glob("*.t2t"): + basename = infile.replace(".t2t", "") + outfile = basename + ".html" + if lib.initTest(basename, infile, outfile): + cmdline = [infile] + lib.test(cmdline, outfile) + + # extra: bar.t2t as TXT + infile = "bar.t2t" + basename = "bar" + outfile = basename + ".txt" + if lib.initTest(basename, infile, outfile): + cmdline = ["-t", "txt", "-i", infile] + lib.test(cmdline, outfile) + + # using smart filters, same files generate more than one output + for alias in ALIASES: + infile = ALIASES[alias] + ".t2t" + outfile = alias + ".html" + if lib.initTest(alias, infile, outfile): + cmdline = addFilters(FILTERS.get(alias)) + cmdline.append("-H") + cmdline.extend(["-o", outfile, infile]) + lib.test(cmdline, outfile) + + # extra: bar2.t2t as TXT + alias = "bar2" + infile = ALIASES[alias] + ".t2t" + outfile = alias + ".txt" + if lib.initTest(alias, infile, outfile): + cmdline = addFilters(FILTERS.get(alias)) + cmdline.append("-H") + cmdline.extend(["-t", "txt", "-o", outfile, infile]) + lib.test(cmdline, outfile) + + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/crossing/table.t2t b/test/crossing/table.t2t new file mode 100644 index 0000000..6a59e6f --- /dev/null +++ b/test/crossing/table.t2t @@ -0,0 +1,80 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title closes it +| Line 1. | += Closed = +| Line 3. | +%%% Crossing: Paragraph closes it +| Line 1. | +Closed +| Line 3. | +%%% Crossing: Command closes it +| Line 1. | +%!include: ''include.txt'' +| Line 3. | +%%% Crossing: Line closes it +| Line 1. | +------------------------------------------- +| Line 3. | +%%% Crossing: Comment Line is ignored +| Line 1. | +% Don't close +| Line 3. | +%%% Crossing: Comment Block is ignored +| Line 1. | +%%% +Don't close +%%% +| Line 3. | +%%% Crossing: Raw Line closes it +| Line 1. | +""" Closed +| Line 3. | +%%% Crossing: Raw Block closes it +| Line 1. | +""" +Closed +""" +| Line 3. | +%%% Crossing: Tagged Line closes it +| Line 1. | +''' Closed +| Line 3. | +%%% Crossing: Tagged Block closes it +| Line 1. | +''' +Closed +''' +| Line 3. | +%%% Crossing: Verbatim Line closes it +| Line 1. | +``` Closed +| Line 3. | +%%% Crossing: Verbatim Block closes it +| Line 1. | +``` +Closed +``` +| Line 3. | +%%% Crossing: Quote closes it +| Line 1. | + Closed +| Line 3. | +%%% Crossing: List closes it +| Line 1. | +- Closed +- +| Line 3. | +%%% Crossing: Numbered List closes it +| Line 1. | ++ Closed ++ +| Line 3. | +%%% Crossing: Definition List closes it +| Line 1. | +: Closed + Closed +: +| Line 3. | diff --git a/test/crossing/tagged.t2t b/test/crossing/tagged.t2t new file mode 100644 index 0000000..215d243 --- /dev/null +++ b/test/crossing/tagged.t2t @@ -0,0 +1,68 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title is ignored +''' += No title tags here. = +''' +%%% Crossing: Paragraph is ignored +''' +No paragraph tags here. +''' +%%% Crossing: Command is ignored +''' +%!include: ''include.txt'' +''' +%%% Crossing: Line is ignored +''' +------------------------------------------- +''' +%%% Crossing: Comment Line is ignored +''' +% You're seeing this. +''' +%%% Crossing: Comment Block is ignored +''' +%%% +You're seeing this. +%%% +''' +%%% Crossing: Verbatim Line is ignored +''' +``` No verbatim here. +''' +%%% Crossing: Verbatim Block is ignored +''' +``` +No verbatim here. +``` +''' +%%% Crossing: Tagged Line is ignored +''' +''' No tagged line here. +''' +%%% Crossing: Quote is ignored +''' + No quote tags here. +''' +%%% Crossing: List is ignored +''' +- No list tags here. +- +''' +%%% Crossing: Numbered List is ignored +''' ++ No numbered list tags here. ++ +''' +%%% Crossing: Definition List is ignored +''' +: No definition term tags here. + No definition definition tags here. +: +''' +%%% Crossing: Table is ignored +''' +| No table here. +''' diff --git a/test/crossing/test.conf b/test/crossing/test.conf new file mode 100644 index 0000000..6e66f88 --- /dev/null +++ b/test/crossing/test.conf @@ -0,0 +1,10 @@ + +%!target: html +%!options: --no-headers + +% Convert comments to titles +%!preproc : '^%%% ([^ \t].*)' '== \1 ==' +% Trick to ensure the body init (don't loose comments) +%!preproc : '^BODYINIT$' '' + +% vim: ft=txt2tags diff --git a/test/crossing/verbatim.t2t b/test/crossing/verbatim.t2t new file mode 100644 index 0000000..154d147 --- /dev/null +++ b/test/crossing/verbatim.t2t @@ -0,0 +1,78 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Crossing: Title is ignored +``` += No title tags here. = +``` +%%% Crossing: Paragraph is ignored +``` +No paragraph tags here. +``` +%%% Crossing: Command is ignored +``` +%!include: ''include.txt'' +``` +%%% Crossing: Line is ignored +``` +------------------------------------------- +``` +%%% Crossing: Comment Line is ignored +``` +% You're seeing this. +``` +%%% Crossing: Comment Block is ignored +``` +%%% +You're seeing this. +%%% +``` +%%% Crossing: Raw Line is ignored +``` +""" No raw here. +``` +%%% Crossing: Raw Block is ignored +``` +""" +No raw here. +""" +``` +%%% Crossing: Tagged Line is ignored +``` +''' No Tagged here. +``` +%%% Crossing: Tagged Block is ignored +``` +''' +No Tagged here. +''' +``` +%%% Crossing: Verbatim Line is ignored +``` +``` No verbatim line here. +``` +%%% Crossing: Quote is ignored +``` + No quote tags here. +``` +%%% Crossing: List is ignored +``` +- No list tags here. +- +``` +%%% Crossing: Numbered List is ignored +``` ++ No numbered list tags here. ++ +``` +%%% Crossing: Definition List is ignored +``` +: No definition term tags here. + No definition definition tags here. +: +``` +%%% Crossing: Table is ignored +``` +| No table here. +``` diff --git a/test/gotchas/inline-interpolation.t2t b/test/gotchas/inline-interpolation.t2t new file mode 100644 index 0000000..275b05e --- /dev/null +++ b/test/gotchas/inline-interpolation.t2t @@ -0,0 +1,39 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Raw: No marks are parsed inside +""**bold**"" +""//italic//"" +""__under__"" +""--stroke--"" +""``verb``"" +""''tagged''"" +""``verb1`` ``verb2`` ``verb3``"" +""''tagged1'' ''tagged2'' ''tagged3''"" +""``verb1`` ''tagged1'' ``verb2`` ''tagged2'' ``verb3``"" +""``verb1 ''tagged1'' verb2``"" + +%%% Tagged: No marks are parsed inside +''**bold**'' +''//italic//'' +''__under__'' +''--stroke--'' +''``verb``'' +''""raw""'' +''``verb1`` ``verb2`` ``verb3``'' +''""raw1"" ""raw2"" ""raw3""'' +''``verb1`` ""raw1"" ``verb2`` ""raw2"" ``verb3``'' +''``verb1 ""raw1"" verb2``'' + +%%% Verbatim: No marks are parsed inside +``**bold**`` +``//italic//`` +``__under__`` +``--stroke--`` +``""raw""`` +``''tagged''`` +``""raw1"" ""raw2"" ""raw3""`` +``''tagged1'' ''tagged2'' ''tagged3''`` +``""raw1"" ''tagged1'' ""raw2"" ''tagged2'' ""raw3""`` +``""raw1 ''tagged1'' raw2""`` diff --git a/test/gotchas/list-bumping.t2t b/test/gotchas/list-bumping.t2t new file mode 100644 index 0000000..620df78 --- /dev/null +++ b/test/gotchas/list-bumping.t2t @@ -0,0 +1,28 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Different lists on the same indent cause the open list to close +- list ++ numbered +: definition + + ++ numbered +- list +: definition + + +: definition +- list ++ numbered + + +%%% The same for sublist bumping, closing just one level +- list + - sublist + + numbered + : definition +- list + + diff --git a/test/gotchas/list-max-depth.t2t b/test/gotchas/list-max-depth.t2t new file mode 100644 index 0000000..fd95401 --- /dev/null +++ b/test/gotchas/list-max-depth.t2t @@ -0,0 +1,14 @@ + +%!includeconf: test.conf +%!target: tex +%!options: -H +BODYINIT + +%%% TeX has depth limit for lists +- Level 1 + - Level 2 + - Level 3 + - Level 4 + - Level 5 + - Level 6 + - Level 7 diff --git a/test/gotchas/ok/inline-interpolation.txt b/test/gotchas/ok/inline-interpolation.txt new file mode 100644 index 0000000..394d088 --- /dev/null +++ b/test/gotchas/ok/inline-interpolation.txt @@ -0,0 +1,45 @@ + + Raw: No marks are parsed inside + =============================== + +**bold** +//italic// +__under__ +--stroke-- +``verb`` +''tagged'' +``verb1`` ``verb2`` ``verb3`` +''tagged1'' ''tagged2'' ''tagged3'' +``verb1`` ''tagged1'' ``verb2`` ''tagged2'' ``verb3`` +``verb1 ''tagged1'' verb2`` + + + Tagged: No marks are parsed inside + ================================== + +**bold** +//italic// +__under__ +--stroke-- +``verb`` +""raw"" +``verb1`` ``verb2`` ``verb3`` +""raw1"" ""raw2"" ""raw3"" +``verb1`` ""raw1"" ``verb2`` ""raw2"" ``verb3`` +``verb1 ""raw1"" verb2`` + + + Verbatim: No marks are parsed inside + ==================================== + +**bold** +//italic// +__under__ +--stroke-- +""raw"" +''tagged'' +""raw1"" ""raw2"" ""raw3"" +''tagged1'' ''tagged2'' ''tagged3'' +""raw1"" ''tagged1'' ""raw2"" ''tagged2'' ""raw3"" +""raw1 ''tagged1'' raw2"" + diff --git a/test/gotchas/ok/list-bumping.html b/test/gotchas/ok/list-bumping.html new file mode 100644 index 0000000..44882d6 --- /dev/null +++ b/test/gotchas/ok/list-bumping.html @@ -0,0 +1,78 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Different lists on the same indent cause the open list to close</h2> + +<ul> +<li>list +</li> +</ul> + +<ol> +<li>numbered +</li> +</ol> + +<dl> +<dt>definition</dt><dd> +</dd> +</dl> + +<ol> +<li>numbered +</li> +</ol> + +<ul> +<li>list +</li> +</ul> + +<dl> +<dt>definition</dt><dd> +</dd> +</dl> + +<dl> +<dt>definition</dt><dd> +</dd> +</dl> + +<ul> +<li>list +</li> +</ul> + +<ol> +<li>numbered +</li> +</ol> + +</section> +<section> +<h2>The same for sublist bumping, closing just one level</h2> + +<ul> +<li>list + <ul> + <li>sublist + </li> + </ul> + <ol> + <li>numbered + </li> + </ol> + <dl> + <dt>definition</dt><dd> + </dd> + </dl> +</li> +<li>list +</li> +</ul> + +</section> +</section> +</div> diff --git a/test/gotchas/ok/list-max-depth.tex b/test/gotchas/ok/list-max-depth.tex new file mode 100644 index 0000000..ccc2708 --- /dev/null +++ b/test/gotchas/ok/list-max-depth.tex @@ -0,0 +1,19 @@ + +\subsection*{TeX has depth limit for lists} + +\begin{compactitem} +\item Level 1 + \begin{compactitem} + \item Level 2 + \begin{compactitem} + \item Level 3 + \begin{compactitem} + \item Level 4 + \item Level 5 + \item Level 6 + \item Level 7 + \end{compactitem} + \end{compactitem} + \end{compactitem} +\end{compactitem} + diff --git a/test/gotchas/ok/paragraph-on-textual-target.txt b/test/gotchas/ok/paragraph-on-textual-target.txt new file mode 100644 index 0000000..fd55c7f --- /dev/null +++ b/test/gotchas/ok/paragraph-on-textual-target.txt @@ -0,0 +1,340 @@ + + Paragraph: Title between + ======================== + +Paragraph 1. + + + Title + ===== + +Paragraph 2. + + + Paragraph: Line between + ======================= + +Paragraph 1. + +---------------------------------------------- + +Paragraph 2. + + + Paragraph: Comment Line between + =============================== + +Paragraph 1. +Still paragraph 1. + + + Paragraph: Comment Block between + ================================ + +Paragraph 1. +Still paragraph 1. + + + Paragraph: Verbatim Line between + ================================ + +Paragraph 1. + + Verbatim Line + +Paragraph 2. + + + Paragraph: Verbatim Block between + ================================= + +Paragraph 1. + + Verbatim Block + +Paragraph 2. + + + Paragraph: Raw Line between + =========================== + +Paragraph 1. +Raw Line +Still paragraph 1. + + + Paragraph: Raw Block between + ============================ + +Paragraph 1. +Raw Block +Still paragraph 1. + + + Paragraph: Tagged Line between + ============================== + +Paragraph 1. +Tagged Line +Still paragraph 1. + + + Paragraph: Tagged Block between + =============================== + +Paragraph 1. +Tagged Block +Still paragraph 1. + + + Paragraph: Quote between + ======================== + +Paragraph 1. + + Quote + +Paragraph 2. + + + Paragraph: List between + ======================= + +Paragraph 1. + +- List + +Paragraph 2. + + + Paragraph: Numbered List between + ================================ + +Paragraph 1. + +1. Numbered List + +Paragraph 2. + + + Paragraph: Definition List between + ================================== + +Paragraph 1. + +Definition List term + Definition List definition + +Paragraph 2. + + + Paragraph: Table between + ======================== + +Paragraph 1. + + | Table + +Paragraph 2. + + + Paragraph: Title between (spaced) + ================================= + +Paragraph 1. + + + Title + ===== + +Paragraph 2. + + + Paragraph: Line between (spaced) + ================================ + +Paragraph 1. + +---------------------------------------------- + +Paragraph 2. + + + Paragraph: Comment Line between (spaced) + ======================================== + +Paragraph 1. + +Paragraph 2. + + + Paragraph: Comment Block between (spaced) + ========================================= + +Paragraph 1. + +Paragraph 2. + + + Paragraph: Verbatim Line between (spaced) + ========================================= + +Paragraph 1. + + Verbatim Line + +Paragraph 2. + + + Paragraph: Verbatim Block between (spaced) + ========================================== + +Paragraph 1. + + Verbatim Block + +Paragraph 2. + + + Paragraph: Raw Line between (spaced) + ==================================== + +Paragraph 1. + +Raw Line + +Paragraph 2. + + + Paragraph: Raw Block between (spaced) + ===================================== + +Paragraph 1. + +Raw Block + +Paragraph 2. + + + Paragraph: Tagged Line between (spaced) + ======================================= + +Paragraph 1. + +Tagged Line + +Paragraph 2. + + + Paragraph: Tagged Block between (spaced) + ======================================== + +Paragraph 1. + +Tagged Block + +Paragraph 2. + + + Paragraph: Quote between (spaced) + ================================= + +Paragraph 1. + + Quote + +Paragraph 2. + + + Paragraph: List between (spaced) + ================================ + +Paragraph 1. + +- List + +Paragraph 2. + + + Paragraph: Numbered List between (spaced) + ========================================= + +Paragraph 1. + +1. Numbered List + +Paragraph 2. + + + Paragraph: Definition List between (spaced) + =========================================== + +Paragraph 1. + +Definition List term + Definition List definition + +Paragraph 2. + + + Paragraph: Table between (spaced) + ================================= + +Paragraph 1. + + | Table + +Paragraph 2. + + + Paragraph: Comment Line after second + ==================================== + +Paragraph 1. + +Paragraph 2. + + + Paragraph: Comment Block after second + ===================================== + +Paragraph 1. + +Paragraph 2. + + + Paragraph: Raw Line after second + ================================ + +Paragraph 1. + +Paragraph 2. +Raw Line + + + Paragraph: Raw Block after second + ================================= + +Paragraph 1. + +Paragraph 2. +Raw Block + + + Paragraph: Tagged Line after second + =================================== + +Paragraph 1. + +Paragraph 2. +Tagged Line + + + Paragraph: Tagged Block after second + ==================================== + +Paragraph 1. + +Paragraph 2. +Tagged Block + diff --git a/test/gotchas/ok/quote-max-depth.tex b/test/gotchas/ok/quote-max-depth.tex new file mode 100644 index 0000000..27fc8a4 --- /dev/null +++ b/test/gotchas/ok/quote-max-depth.tex @@ -0,0 +1,22 @@ + +\subsection*{TeX has depth limit for quote} + + \begin{quotation} +Level 1 + \begin{quotation} +Level 2 + \begin{quotation} +Level 3 + \begin{quotation} +Level 4 + \begin{quotation} +Level 5 + \begin{quotation} +Level 6 +Level 7 + \end{quotation} + \end{quotation} + \end{quotation} + \end{quotation} + \end{quotation} + \end{quotation} diff --git a/test/gotchas/ok/sublist-before-list.html b/test/gotchas/ok/sublist-before-list.html new file mode 100644 index 0000000..e8b7d73 --- /dev/null +++ b/test/gotchas/ok/sublist-before-list.html @@ -0,0 +1,35 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Sublist before mother list</h2> + + <ul> + <li>Before, level 3 + </li> + </ul> + + <ul> + <li>Before, level 2 + </li> + </ul> + +<ul> +<li>Mother list + <ul> + <li>After, level 2 + <ul> + <li>After, level 3 + </li> + </ul> + </li> + </ul> +</li> +<li>Mother list again +</li> +</ul> + +</section> +</section> +</div> diff --git a/test/gotchas/ok/subtitle-before-title-toc.html b/test/gotchas/ok/subtitle-before-title-toc.html new file mode 100644 index 0000000..dc47237 --- /dev/null +++ b/test/gotchas/ok/subtitle-before-title-toc.html @@ -0,0 +1,27 @@ +<div class="body" id="body"> + + <ul> + <li><a href="#toc1">0.1. Subtitle before title</a> + <ul> + <li><a href="#toc2">0.1.1. Before, level 3</a> + </li> + </ul> + </li> + <li><a href="#toc3">0.2. Before, level 2</a> + </li> + </ul> + + <ol> + <li><a href="#toc4">Heading 1</a> + <ul> + <li><a href="#toc5">1.1. After, level 2</a> + <ul> + <li><a href="#toc6">1.1.1. After, level 3</a> + </li> + </ul> + </li> + </ul> + </li> + </ol> + +</div> diff --git a/test/gotchas/ok/subtitle-before-title.html b/test/gotchas/ok/subtitle-before-title.html new file mode 100644 index 0000000..8bd629e --- /dev/null +++ b/test/gotchas/ok/subtitle-before-title.html @@ -0,0 +1,30 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>0.1. Subtitle before title</h2> + +<section> +<h3>0.1.1. Before, level 3</h3> + +</section> +</section> +<section> +<h2>0.2. Before, level 2</h2> + +</section> +</section> +<section> +<h1>1. Heading 1</h1> + +<section> +<h2>1.1. After, level 2</h2> + +<section> +<h3>1.1.1. After, level 3</h3> + +</section> +</section> +</section> +</div> diff --git a/test/gotchas/paragraph-on-textual-target.t2t b/test/gotchas/paragraph-on-textual-target.t2t new file mode 100644 index 0000000..74d9dc6 --- /dev/null +++ b/test/gotchas/paragraph-on-textual-target.t2t @@ -0,0 +1,249 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Paragraph: Title between +Paragraph 1. += Title = +Paragraph 2. + +%%% Paragraph: Line between +Paragraph 1. +---------------------------------------------- +Paragraph 2. + +%%% Paragraph: Comment Line between +Paragraph 1. +% You're not seeing this +Still paragraph 1. + +%%% Paragraph: Comment Block between +Paragraph 1. +%%% +You're not seeing this +%%% +Still paragraph 1. + +%%% Paragraph: Verbatim Line between +Paragraph 1. +``` Verbatim Line +Paragraph 2. + +%%% Paragraph: Verbatim Block between +Paragraph 1. +``` +Verbatim Block +``` +Paragraph 2. + +%%% Paragraph: Raw Line between +Paragraph 1. +""" Raw Line +Still paragraph 1. + +%%% Paragraph: Raw Block between +Paragraph 1. +""" +Raw Block +""" +Still paragraph 1. + +%%% Paragraph: Tagged Line between +Paragraph 1. +''' Tagged Line +Still paragraph 1. + +%%% Paragraph: Tagged Block between +Paragraph 1. +''' +Tagged Block +''' +Still paragraph 1. + +%%% Paragraph: Quote between +Paragraph 1. + Quote +Paragraph 2. + +%%% Paragraph: List between +Paragraph 1. +- List +- +Paragraph 2. + +%%% Paragraph: Numbered List between +Paragraph 1. ++ Numbered List ++ +Paragraph 2. + +%%% Paragraph: Definition List between +Paragraph 1. +: Definition List term + Definition List definition +: +Paragraph 2. + +%%% Paragraph: Table between +Paragraph 1. +| Table +Paragraph 2. + +%%% Paragraph: Title between (spaced) +Paragraph 1. + += Title = + +Paragraph 2. + +%%% Paragraph: Line between (spaced) +Paragraph 1. + +---------------------------------------------- + +Paragraph 2. + +%%% Paragraph: Comment Line between (spaced) +Paragraph 1. + +% You're not seeing this + +Paragraph 2. + +%%% Paragraph: Comment Block between (spaced) +Paragraph 1. + +%%% +You're not seeing this +%%% + +Paragraph 2. + +%%% Paragraph: Verbatim Line between (spaced) +Paragraph 1. + +``` Verbatim Line + +Paragraph 2. + +%%% Paragraph: Verbatim Block between (spaced) +Paragraph 1. + +``` +Verbatim Block +``` + +Paragraph 2. + +%%% Paragraph: Raw Line between (spaced) +Paragraph 1. + +""" Raw Line + +Paragraph 2. + +%%% Paragraph: Raw Block between (spaced) +Paragraph 1. + +""" +Raw Block +""" + +Paragraph 2. + +%%% Paragraph: Tagged Line between (spaced) +Paragraph 1. + +''' Tagged Line + +Paragraph 2. + +%%% Paragraph: Tagged Block between (spaced) +Paragraph 1. + +''' +Tagged Block +''' + +Paragraph 2. + +%%% Paragraph: Quote between (spaced) +Paragraph 1. + + Quote + +Paragraph 2. + +%%% Paragraph: List between (spaced) +Paragraph 1. + +- List +- + +Paragraph 2. + +%%% Paragraph: Numbered List between (spaced) +Paragraph 1. + ++ Numbered List ++ + +Paragraph 2. + +%%% Paragraph: Definition List between (spaced) +Paragraph 1. + +: Definition List term + Definition List definition +: + +Paragraph 2. + +%%% Paragraph: Table between (spaced) +Paragraph 1. + +| Table + +Paragraph 2. + +%%% Paragraph: Comment Line after second +Paragraph 1. + +Paragraph 2. +% You're not seeing this + +%%% Paragraph: Comment Block after second +Paragraph 1. + +Paragraph 2. +%%% +You're not seeing this +%%% + +%%% Paragraph: Raw Line after second +Paragraph 1. + +Paragraph 2. +""" Raw Line + +%%% Paragraph: Raw Block after second +Paragraph 1. + +Paragraph 2. +""" +Raw Block +""" + +%%% Paragraph: Tagged Line after second +Paragraph 1. + +Paragraph 2. +''' Tagged Line + +%%% Paragraph: Tagged Block after second +Paragraph 1. + +Paragraph 2. +''' +Tagged Block +''' diff --git a/test/gotchas/quote-max-depth.t2t b/test/gotchas/quote-max-depth.t2t new file mode 100644 index 0000000..8e68f69 --- /dev/null +++ b/test/gotchas/quote-max-depth.t2t @@ -0,0 +1,14 @@ + +%!includeconf: test.conf +%!target: tex +%!options: -H +BODYINIT + +%%% TeX has depth limit for quote + Level 1 + Level 2 + Level 3 + Level 4 + Level 5 + Level 6 + Level 7 diff --git a/test/gotchas/run.py b/test/gotchas/run.py new file mode 100644 index 0000000..1705fb8 --- /dev/null +++ b/test/gotchas/run.py @@ -0,0 +1,31 @@ +# +# txt2tags marks gotchas tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +import glob +import os +import re +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + + +def run(): + # test all OK files found + for outfile in glob.glob("ok/*"): + basename = re.sub(r"\..*?$", "", outfile.replace("ok/", "")) + target = re.sub(r".*\.", "", outfile) + infile = basename + ".t2t" + outfile = outfile.replace("ok/", "") + if lib.initTest(basename, infile, outfile): + cmdline = ["-H"] + cmdline.extend(["-t", target]) + cmdline.append(infile) + lib.test(cmdline, outfile) + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/gotchas/sublist-before-list.t2t b/test/gotchas/sublist-before-list.t2t new file mode 100644 index 0000000..2c78a2c --- /dev/null +++ b/test/gotchas/sublist-before-list.t2t @@ -0,0 +1,11 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Sublist before mother list + - Before, level 3 + - Before, level 2 +- Mother list + - After, level 2 + - After, level 3 +- Mother list again diff --git a/test/gotchas/subtitle-before-title-toc.t2t b/test/gotchas/subtitle-before-title-toc.t2t new file mode 100644 index 0000000..fc6fae6 --- /dev/null +++ b/test/gotchas/subtitle-before-title-toc.t2t @@ -0,0 +1,9 @@ + +%!includeconf: test.conf +%!options: -n --toc-only -o subtitle-before-title-toc.html + +%!postproc: title$ title on TOC + +BODYINIT + +%!include: subtitle-before-title.t2t diff --git a/test/gotchas/subtitle-before-title.t2t b/test/gotchas/subtitle-before-title.t2t new file mode 100644 index 0000000..8737b81 --- /dev/null +++ b/test/gotchas/subtitle-before-title.t2t @@ -0,0 +1,11 @@ + +%!includeconf: test.conf +%!options: -n +BODYINIT + +%%% Subtitle before title +=== Before, level 3=== +== Before, level 2== += Heading 1 = +== After, level 2 == +=== After, level 3 === diff --git a/test/gotchas/test.conf b/test/gotchas/test.conf new file mode 100644 index 0000000..0a4be0a --- /dev/null +++ b/test/gotchas/test.conf @@ -0,0 +1,8 @@ + +%!target: html +% Convert comments to titles +%!preproc : '^%%% ([^ \t].*)' '== \1 ==' +% Trick to ensure the body init (don't loose comments) +%!preproc : '^BODYINIT$' '' + +% vim: ft=txt2tags diff --git a/test/headers/ok/1.html b/test/headers/ok/1.html new file mode 100644 index 0000000..4af5a72 --- /dev/null +++ b/test/headers/ok/1.html @@ -0,0 +1,36 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/12.html b/test/headers/ok/12.html new file mode 100644 index 0000000..603a466 --- /dev/null +++ b/test/headers/ok/12.html @@ -0,0 +1,37 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/123.html b/test/headers/ok/123.html new file mode 100644 index 0000000..8fca556 --- /dev/null +++ b/test/headers/ok/123.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/123b.html b/test/headers/ok/123b.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/123b.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/123cf.html b/test/headers/ok/123cf.html new file mode 100644 index 0000000..a3ac133 --- /dev/null +++ b/test/headers/ok/123cf.html @@ -0,0 +1,39 @@ + + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/123cfb.html b/test/headers/ok/123cfb.html new file mode 100644 index 0000000..7be8e89 --- /dev/null +++ b/test/headers/ok/123cfb.html @@ -0,0 +1,42 @@ + + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/123eb.html b/test/headers/ok/123eb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/123eb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/123ecefeb.html b/test/headers/ok/123ecefeb.html new file mode 100644 index 0000000..7be8e89 --- /dev/null +++ b/test/headers/ok/123ecefeb.html @@ -0,0 +1,42 @@ + + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/123fb.html b/test/headers/ok/123fb.html new file mode 100644 index 0000000..7be8e89 --- /dev/null +++ b/test/headers/ok/123fb.html @@ -0,0 +1,42 @@ + + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/123k.html b/test/headers/ok/123k.html new file mode 100644 index 0000000..8fca556 --- /dev/null +++ b/test/headers/ok/123k.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/123kb.html b/test/headers/ok/123kb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/123kb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/12cb.html b/test/headers/ok/12cb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/12cb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/12e.html b/test/headers/ok/12e.html new file mode 100644 index 0000000..603a466 --- /dev/null +++ b/test/headers/ok/12e.html @@ -0,0 +1,37 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/12eb.html b/test/headers/ok/12eb.html new file mode 100644 index 0000000..53894a2 --- /dev/null +++ b/test/headers/ok/12eb.html @@ -0,0 +1,40 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/12fb.html b/test/headers/ok/12fb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/12fb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/12m.html b/test/headers/ok/12m.html new file mode 100644 index 0000000..8fca556 --- /dev/null +++ b/test/headers/ok/12m.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/1c3b.html b/test/headers/ok/1c3b.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/1c3b.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/1ccb.html b/test/headers/ok/1ccb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/1ccb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/1e.html b/test/headers/ok/1e.html new file mode 100644 index 0000000..4af5a72 --- /dev/null +++ b/test/headers/ok/1e.html @@ -0,0 +1,36 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/1e3b.html b/test/headers/ok/1e3b.html new file mode 100644 index 0000000..53894a2 --- /dev/null +++ b/test/headers/ok/1e3b.html @@ -0,0 +1,40 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/1ec.html b/test/headers/ok/1ec.html new file mode 100644 index 0000000..603a466 --- /dev/null +++ b/test/headers/ok/1ec.html @@ -0,0 +1,37 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/1ee.html b/test/headers/ok/1ee.html new file mode 100644 index 0000000..4af5a72 --- /dev/null +++ b/test/headers/ok/1ee.html @@ -0,0 +1,36 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/1eeb.html b/test/headers/ok/1eeb.html new file mode 100644 index 0000000..9f8c59d --- /dev/null +++ b/test/headers/ok/1eeb.html @@ -0,0 +1,39 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/1ef.html b/test/headers/ok/1ef.html new file mode 100644 index 0000000..603a466 --- /dev/null +++ b/test/headers/ok/1ef.html @@ -0,0 +1,37 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/1mm.html b/test/headers/ok/1mm.html new file mode 100644 index 0000000..8fca556 --- /dev/null +++ b/test/headers/ok/1mm.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/c.html b/test/headers/ok/c.html new file mode 100644 index 0000000..4af5a72 --- /dev/null +++ b/test/headers/ok/c.html @@ -0,0 +1,36 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/c23b.html b/test/headers/ok/c23b.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/c23b.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/c2cb.html b/test/headers/ok/c2cb.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/c2cb.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/c2eb.html b/test/headers/ok/c2eb.html new file mode 100644 index 0000000..53894a2 --- /dev/null +++ b/test/headers/ok/c2eb.html @@ -0,0 +1,40 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/cc3b.html b/test/headers/ok/cc3b.html new file mode 100644 index 0000000..5c9aeab --- /dev/null +++ b/test/headers/ok/cc3b.html @@ -0,0 +1,41 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/ce3b.html b/test/headers/ok/ce3b.html new file mode 100644 index 0000000..53894a2 --- /dev/null +++ b/test/headers/ok/ce3b.html @@ -0,0 +1,40 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/eb.html b/test/headers/ok/eb.html new file mode 100644 index 0000000..75c7350 --- /dev/null +++ b/test/headers/ok/eb.html @@ -0,0 +1,37 @@ + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/ecb.html b/test/headers/ok/ecb.html new file mode 100644 index 0000000..75c7350 --- /dev/null +++ b/test/headers/ok/ecb.html @@ -0,0 +1,37 @@ + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/efb.html b/test/headers/ok/efb.html new file mode 100644 index 0000000..acd90cd --- /dev/null +++ b/test/headers/ok/efb.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/ek.html b/test/headers/ok/ek.html new file mode 100644 index 0000000..fbbcf61 --- /dev/null +++ b/test/headers/ok/ek.html @@ -0,0 +1,34 @@ + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + diff --git a/test/headers/ok/ekb.html b/test/headers/ok/ekb.html new file mode 100644 index 0000000..75c7350 --- /dev/null +++ b/test/headers/ok/ekb.html @@ -0,0 +1,37 @@ + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/ekkkb.html b/test/headers/ok/ekkkb.html new file mode 100644 index 0000000..75c7350 --- /dev/null +++ b/test/headers/ok/ekkkb.html @@ -0,0 +1,37 @@ + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + +body: Text. + + + + + + diff --git a/test/headers/ok/m.html b/test/headers/ok/m.html new file mode 100644 index 0000000..4af5a72 --- /dev/null +++ b/test/headers/ok/m.html @@ -0,0 +1,36 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/mm.html b/test/headers/ok/mm.html new file mode 100644 index 0000000..603a466 --- /dev/null +++ b/test/headers/ok/mm.html @@ -0,0 +1,37 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + diff --git a/test/headers/ok/mmm.html b/test/headers/ok/mmm.html new file mode 100644 index 0000000..8fca556 --- /dev/null +++ b/test/headers/ok/mmm.html @@ -0,0 +1,38 @@ + + + + + + +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} + + + + + + + + + + + + + + + + + + diff --git a/test/headers/run.py b/test/headers/run.py new file mode 100644 index 0000000..a2ca169 --- /dev/null +++ b/test/headers/run.py @@ -0,0 +1,57 @@ +# +# txt2tags headers tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# +# Note: The .t2t files are generated dynamicaly, based on 'tests' data. +# Each character is expanded to a 'txt' dict text. +# + +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# text patterns to compose source files +txt = { + "e": "", # Empty line + "1": "Header 1", # Header line 1 + "2": "Header 2", # Header line 2 + "3": "Header 3", # Header line 3 + "c": "% comment", # Comment line + "k": "%%%\ncomment\n%%%", # Comment block + "b": "Text.", # Body line + "f": "%!encoding: enc", # Config line +} + +# the registered tests +tests = """ +eb efb ecb +1ee 1ef 1ec 1eeb 1e3b 1c3b 1ccb +12e 12eb 12fb 12cb +123 123b 123eb 123fb 123cf 123cfb 123ecefeb +1 c 1e 12 +ce3b cc3b c2eb c2cb c23b +ekb 123kb ek 123k ekkkb +""" + + +def run(): + for testid in tests.split(): + infile = testid + ".t2t" + outfile = testid + ".html" + cmdline = ["-t html -C test.conf", infile] + if lib.initTest(testid, infile, outfile): + # compose source file contents + infile_txt = [] + for letter in testid: + infile_txt.append(txt[letter]) + infile_txt = "\n".join(infile_txt) + # create the source file + lib.WriteFile(infile, infile_txt) + # convert and check results + lib.test(cmdline, outfile) + # remove the trash + os.remove(infile) diff --git a/test/headers/test.conf b/test/headers/test.conf new file mode 100644 index 0000000..bc1d8da --- /dev/null +++ b/test/headers/test.conf @@ -0,0 +1,8 @@ +% Filters to identify and reformat the desired data +%!postproc(html): '^<META.*charset=([^"]*)">' 'conf: \1' +%!postproc(html): '^<H1>(.*)</H1>' 'h1: \1' +%!postproc(html): '^<H2>(.*)</H2>' 'h2: \1' +%!postproc(html): '^<H3>(.*)</H3>' 'h3: \1' +%!postproc(html): '^(Text\.)' 'body: \1' +% Clear all the irrelevant lines +%!postproc(html): '^<.*' '' diff --git a/test/include/_empty.inc b/test/include/_empty.inc new file mode 100644 index 0000000..e69de29 diff --git a/test/include/_folder-back.inc b/test/include/_folder-back.inc new file mode 100644 index 0000000..fd6b5c8 --- /dev/null +++ b/test/include/_folder-back.inc @@ -0,0 +1,2 @@ + +Folder - Level 0. diff --git a/test/include/_parsed.inc b/test/include/_parsed.inc new file mode 100644 index 0000000..b59e616 --- /dev/null +++ b/test/include/_parsed.inc @@ -0,0 +1 @@ +<b>parsed</b> diff --git a/test/include/_raw.inc b/test/include/_raw.inc new file mode 100644 index 0000000..d52b887 --- /dev/null +++ b/test/include/_raw.inc @@ -0,0 +1 @@ +**raw** diff --git a/test/include/_sub_include.inc b/test/include/_sub_include.inc new file mode 100644 index 0000000..90d589a --- /dev/null +++ b/test/include/_sub_include.inc @@ -0,0 +1,3 @@ + +Level 1. +%!include: _sub_sub_include.inc diff --git a/test/include/_sub_sub_include.inc b/test/include/_sub_sub_include.inc new file mode 100644 index 0000000..c043289 --- /dev/null +++ b/test/include/_sub_sub_include.inc @@ -0,0 +1,2 @@ + +Level 2. \ No newline at end of file diff --git a/test/include/_t2t.inc b/test/include/_t2t.inc new file mode 100644 index 0000000..cfa49a0 --- /dev/null +++ b/test/include/_t2t.inc @@ -0,0 +1,2 @@ + +**bold** diff --git a/test/include/_verb.inc b/test/include/_verb.inc new file mode 100644 index 0000000..0165937 --- /dev/null +++ b/test/include/_verb.inc @@ -0,0 +1 @@ +**verb** diff --git a/test/include/folder/_folder-back.inc b/test/include/folder/_folder-back.inc new file mode 100644 index 0000000..2f7efb4 --- /dev/null +++ b/test/include/folder/_folder-back.inc @@ -0,0 +1,2 @@ + +Folder - Level 1. diff --git a/test/include/folder/_folder.inc b/test/include/folder/_folder.inc new file mode 100644 index 0000000..ce14d8f --- /dev/null +++ b/test/include/folder/_folder.inc @@ -0,0 +1,13 @@ + +Folder - Level 1. +%!include: folder/subfolder/_folder.inc +%%% +This is WRONG! It should be: + +%!include: subfolder/_folder.inc + +But txt2tags considers "current path" the path for the mother .t2t file +(../include-nesting-folder.t2t) + +Funny thing is that %!includeconf do not suffer from this bug. See ConfigLines.include_config_file() +%%% diff --git a/test/include/folder/subfolder/_folder-back.inc b/test/include/folder/subfolder/_folder-back.inc new file mode 100644 index 0000000..e5ddedc --- /dev/null +++ b/test/include/folder/subfolder/_folder-back.inc @@ -0,0 +1,15 @@ + +Folder - Level 2. +%!include: folder/_folder-back.inc +%%% +This is WRONG! It should be: + +%!include: ../_folder-back.inc + +But txt2tags considers "current path" the path for the mother .t2t file +(../../include-nesting-folder-back.t2t) + +Another problem is that the "include itself" check fails in this situation. + +Funny thing is that %!includeconf do not suffer from this bug. See ConfigLines.include_config_file() +%%% diff --git a/test/include/folder/subfolder/_folder.inc b/test/include/folder/subfolder/_folder.inc new file mode 100644 index 0000000..13ed162 --- /dev/null +++ b/test/include/folder/subfolder/_folder.inc @@ -0,0 +1,2 @@ + +Folder - Level 2. diff --git a/test/include/include-empty-other.t2t b/test/include/include-empty-other.t2t new file mode 100644 index 0000000..cc59eec --- /dev/null +++ b/test/include/include-empty-other.t2t @@ -0,0 +1,6 @@ + +%!include: ``_empty.inc`` + +%!include: ""_empty.inc"" + +%!include: ''_empty.inc'' diff --git a/test/include/include-empty-t2t.t2t b/test/include/include-empty-t2t.t2t new file mode 100644 index 0000000..649a9d6 --- /dev/null +++ b/test/include/include-empty-t2t.t2t @@ -0,0 +1,2 @@ + +%!include: _empty.inc diff --git a/test/include/include-itself.t2t b/test/include/include-itself.t2t new file mode 100644 index 0000000..28b0ce9 --- /dev/null +++ b/test/include/include-itself.t2t @@ -0,0 +1,3 @@ + +%!include: include-itself.t2t +I will never get here. diff --git a/test/include/include-nesting-folder-back.t2t b/test/include/include-nesting-folder-back.t2t new file mode 100644 index 0000000..380034d --- /dev/null +++ b/test/include/include-nesting-folder-back.t2t @@ -0,0 +1,6 @@ + +%!include: folder/subfolder/_folder-back.inc +Folder - Level 0. + +% This test is OK, but the txt2tags behavior is WRONG +% See folder/_foder.inc for details diff --git a/test/include/include-nesting-folder.t2t b/test/include/include-nesting-folder.t2t new file mode 100644 index 0000000..9f32748 --- /dev/null +++ b/test/include/include-nesting-folder.t2t @@ -0,0 +1,6 @@ + +Folder - Level 0. +%!include: folder/_folder.inc + +% This test is OK, but the txt2tags behavior is WRONG +% See folder/_foder.inc for details diff --git a/test/include/include-nesting.t2t b/test/include/include-nesting.t2t new file mode 100644 index 0000000..f51d735 --- /dev/null +++ b/test/include/include-nesting.t2t @@ -0,0 +1,3 @@ + +Level 0. +%!include: _sub_include.inc diff --git a/test/include/include-types.t2t b/test/include/include-types.t2t new file mode 100644 index 0000000..57377db --- /dev/null +++ b/test/include/include-types.t2t @@ -0,0 +1,8 @@ + +%!include: _t2t.inc + +%!include: ``_verb.inc`` + +%!include: ""_raw.inc"" + +%!include: ''_parsed.inc'' diff --git a/test/include/ok/include-empty-other.html b/test/include/ok/include-empty-other.html new file mode 100644 index 0000000..1c4ba4a --- /dev/null +++ b/test/include/ok/include-empty-other.html @@ -0,0 +1,6 @@ +<div class="body" id="body"> + +<pre> +</pre> + +</div> diff --git a/test/include/ok/include-empty-t2t.out b/test/include/ok/include-empty-t2t.out new file mode 100644 index 0000000..6df5716 --- /dev/null +++ b/test/include/ok/include-empty-t2t.out @@ -0,0 +1 @@ +txt2tags: Error: The input file is empty: _empty.inc diff --git a/test/include/ok/include-itself.out b/test/include/ok/include-itself.out new file mode 100644 index 0000000..3ddbe22 --- /dev/null +++ b/test/include/ok/include-itself.out @@ -0,0 +1 @@ +txt2tags: Error: A file cannot include itself (loop!): include-itself.t2t diff --git a/test/include/ok/include-nesting-folder-back.html b/test/include/ok/include-nesting-folder-back.html new file mode 100644 index 0000000..3cb4091 --- /dev/null +++ b/test/include/ok/include-nesting-folder-back.html @@ -0,0 +1,7 @@ +<div class="body" id="body"> +<p> +Folder - Level 2. +Folder - Level 1. +Folder - Level 0. +</p> +</div> diff --git a/test/include/ok/include-nesting-folder.html b/test/include/ok/include-nesting-folder.html new file mode 100644 index 0000000..4f2f999 --- /dev/null +++ b/test/include/ok/include-nesting-folder.html @@ -0,0 +1,7 @@ +<div class="body" id="body"> +<p> +Folder - Level 0. +Folder - Level 1. +Folder - Level 2. +</p> +</div> diff --git a/test/include/ok/include-nesting.html b/test/include/ok/include-nesting.html new file mode 100644 index 0000000..87f3325 --- /dev/null +++ b/test/include/ok/include-nesting.html @@ -0,0 +1,7 @@ +<div class="body" id="body"> +<p> +Level 0. +Level 1. +Level 2. +</p> +</div> diff --git a/test/include/ok/include-types.html b/test/include/ok/include-types.html new file mode 100644 index 0000000..15e37e2 --- /dev/null +++ b/test/include/ok/include-types.html @@ -0,0 +1,12 @@ +<div class="body" id="body"> +<p> +<strong>bold</strong> +</p> + +<pre> +**verb** +</pre> + +**raw** +<b>parsed</b> +</div> diff --git a/test/include/run.py b/test/include/run.py new file mode 100644 index 0000000..92f5bb0 --- /dev/null +++ b/test/include/run.py @@ -0,0 +1,39 @@ +# +# txt2tags %!include command tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +import glob +import os +import re +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + + +def run(): + # test all OK files found + for outfile in glob.glob("ok/*"): + stderr = 0 + basename = re.sub(r"\..*?$", "", outfile.replace("ok/", "")) + target = re.sub(r".*\.", "", outfile) + if target == "out": + target = "txt" + stderr = 1 + infile = basename + ".t2t" + outfile = outfile.replace("ok/", "") + if lib.initTest(basename, infile, outfile): + cmdline = ["-H"] + cmdline.extend(["-t", target]) + cmdline.extend(["-i", infile]) + if stderr: + cmdline.extend(["-o", "-"]) + cmdline.append(">" + outfile) + cmdline.append("2>&1") + lib.test(cmdline, outfile) + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/includeconf/_config.inc b/test/includeconf/_config.inc new file mode 100644 index 0000000..31a275a --- /dev/null +++ b/test/includeconf/_config.inc @@ -0,0 +1,2 @@ + +%!target: html diff --git a/test/includeconf/_config2.inc b/test/includeconf/_config2.inc new file mode 100644 index 0000000..b307599 --- /dev/null +++ b/test/includeconf/_config2.inc @@ -0,0 +1,2 @@ + +%!options: --enum-title diff --git a/test/includeconf/_empty.inc b/test/includeconf/_empty.inc new file mode 100644 index 0000000..e69de29 diff --git a/test/includeconf/_failed.inc b/test/includeconf/_failed.inc new file mode 100644 index 0000000..8d1c919 --- /dev/null +++ b/test/includeconf/_failed.inc @@ -0,0 +1,2 @@ + +%!postproc: .* FAILED diff --git a/test/includeconf/_sub_include.inc b/test/includeconf/_sub_include.inc new file mode 100644 index 0000000..dc2ce01 --- /dev/null +++ b/test/includeconf/_sub_include.inc @@ -0,0 +1,3 @@ + +%!includeconf: _sub_sub_include.inc +%!target: html diff --git a/test/includeconf/_sub_sub_include.inc b/test/includeconf/_sub_sub_include.inc new file mode 100644 index 0000000..b307599 --- /dev/null +++ b/test/includeconf/_sub_sub_include.inc @@ -0,0 +1,2 @@ + +%!options: --enum-title diff --git a/test/includeconf/_targeted.inc b/test/includeconf/_targeted.inc new file mode 100644 index 0000000..c8e541a --- /dev/null +++ b/test/includeconf/_targeted.inc @@ -0,0 +1,3 @@ + +%!options(html): --enum-title +%!options(txt): --no-enum-title diff --git a/test/includeconf/_text.inc b/test/includeconf/_text.inc new file mode 100644 index 0000000..134f11e --- /dev/null +++ b/test/includeconf/_text.inc @@ -0,0 +1 @@ +Text. diff --git a/test/includeconf/body-only.t2t b/test/includeconf/body-only.t2t new file mode 100644 index 0000000..a2abfa8 --- /dev/null +++ b/test/includeconf/body-only.t2t @@ -0,0 +1,2 @@ + += title = diff --git a/test/includeconf/folder/_folder-back.inc b/test/includeconf/folder/_folder-back.inc new file mode 100644 index 0000000..d645739 --- /dev/null +++ b/test/includeconf/folder/_folder-back.inc @@ -0,0 +1,2 @@ + +%!includeconf: ../_config.inc diff --git a/test/includeconf/folder/_folder.inc b/test/includeconf/folder/_folder.inc new file mode 100644 index 0000000..c5c4f48 --- /dev/null +++ b/test/includeconf/folder/_folder.inc @@ -0,0 +1,3 @@ + +%!includeconf: subfolder/_folder.inc +%!target: html diff --git a/test/includeconf/folder/subfolder/_folder-back.inc b/test/includeconf/folder/subfolder/_folder-back.inc new file mode 100644 index 0000000..2e2658c --- /dev/null +++ b/test/includeconf/folder/subfolder/_folder-back.inc @@ -0,0 +1,4 @@ + +%!includeconf: ../_folder-back.inc +%!includeconf: ../../_config2.inc + diff --git a/test/includeconf/folder/subfolder/_folder.inc b/test/includeconf/folder/subfolder/_folder.inc new file mode 100644 index 0000000..b307599 --- /dev/null +++ b/test/includeconf/folder/subfolder/_folder.inc @@ -0,0 +1,2 @@ + +%!options: --enum-title diff --git a/test/includeconf/includeconf-body.t2t b/test/includeconf/includeconf-body.t2t new file mode 100644 index 0000000..7a1acd4 --- /dev/null +++ b/test/includeconf/includeconf-body.t2t @@ -0,0 +1,7 @@ + +%!includeconf: _config.inc +%!includeconf: _config2.inc + += title = + +%!includeconf: _failed.inc diff --git a/test/includeconf/includeconf-default.t2t b/test/includeconf/includeconf-default.t2t new file mode 100644 index 0000000..acc00d0 --- /dev/null +++ b/test/includeconf/includeconf-default.t2t @@ -0,0 +1,5 @@ + +%!target: html +%!includeconf: _config2.inc + += title = diff --git a/test/includeconf/includeconf-empty.t2t b/test/includeconf/includeconf-empty.t2t new file mode 100644 index 0000000..34d02d5 --- /dev/null +++ b/test/includeconf/includeconf-empty.t2t @@ -0,0 +1,5 @@ + +%!target: html +%!includeconf: _empty.inc + += title = diff --git a/test/includeconf/includeconf-itself.t2t b/test/includeconf/includeconf-itself.t2t new file mode 100644 index 0000000..2192a43 --- /dev/null +++ b/test/includeconf/includeconf-itself.t2t @@ -0,0 +1,4 @@ + +%!includeconf: includeconf-itself.t2t + +I will never get here. diff --git a/test/includeconf/includeconf-multi.t2t b/test/includeconf/includeconf-multi.t2t new file mode 100644 index 0000000..bbd6aa2 --- /dev/null +++ b/test/includeconf/includeconf-multi.t2t @@ -0,0 +1,7 @@ + +%!target: txt +%!options: --no-enum-title +%!includeconf: _config.inc +%!includeconf: _config2.inc + += title = diff --git a/test/includeconf/includeconf-nesting-folder-back.t2t b/test/includeconf/includeconf-nesting-folder-back.t2t new file mode 100644 index 0000000..50d0d6e --- /dev/null +++ b/test/includeconf/includeconf-nesting-folder-back.t2t @@ -0,0 +1,4 @@ + +%!includeconf: folder/subfolder/_folder-back.inc + += title = diff --git a/test/includeconf/includeconf-nesting-folder.t2t b/test/includeconf/includeconf-nesting-folder.t2t new file mode 100644 index 0000000..7efbbc1 --- /dev/null +++ b/test/includeconf/includeconf-nesting-folder.t2t @@ -0,0 +1,4 @@ + +%!includeconf: folder/_folder.inc + += title = diff --git a/test/includeconf/includeconf-nesting.t2t b/test/includeconf/includeconf-nesting.t2t new file mode 100644 index 0000000..69ec9a8 --- /dev/null +++ b/test/includeconf/includeconf-nesting.t2t @@ -0,0 +1,4 @@ + +%!includeconf: _sub_include.inc + += title = diff --git a/test/includeconf/includeconf-not-found.t2t b/test/includeconf/includeconf-not-found.t2t new file mode 100644 index 0000000..6a3a509 --- /dev/null +++ b/test/includeconf/includeconf-not-found.t2t @@ -0,0 +1,4 @@ + +%!includeconf: XXX.inc + +I will never get here. diff --git a/test/includeconf/includeconf-targeted-inside.t2t b/test/includeconf/includeconf-targeted-inside.t2t new file mode 100644 index 0000000..fedbd42 --- /dev/null +++ b/test/includeconf/includeconf-targeted-inside.t2t @@ -0,0 +1,5 @@ + +%!target: html +%!includeconf: _targeted.inc + += title = diff --git a/test/includeconf/includeconf-targeted.t2t b/test/includeconf/includeconf-targeted.t2t new file mode 100644 index 0000000..88a2c1e --- /dev/null +++ b/test/includeconf/includeconf-targeted.t2t @@ -0,0 +1,5 @@ + +%!target: html +%!includeconf(html): _failed.inc + += title = diff --git a/test/includeconf/includeconf-text.t2t b/test/includeconf/includeconf-text.t2t new file mode 100644 index 0000000..0f314ce --- /dev/null +++ b/test/includeconf/includeconf-text.t2t @@ -0,0 +1,5 @@ + +%!target: html +%!includeconf: _text.inc + += title = diff --git a/test/includeconf/ok/C-not-found.out b/test/includeconf/ok/C-not-found.out new file mode 100644 index 0000000..bb89f38 --- /dev/null +++ b/test/includeconf/ok/C-not-found.out @@ -0,0 +1 @@ +txt2tags: Error: Cannot read file: XXX.inc diff --git a/test/includeconf/ok/C-text.out b/test/includeconf/ok/C-text.out new file mode 100644 index 0000000..a562af2 --- /dev/null +++ b/test/includeconf/ok/C-text.out @@ -0,0 +1,2 @@ +txt2tags: Error: Invalid CONFIG line on _text.inc +001:Text. diff --git a/test/includeconf/ok/config-file-not-found.out b/test/includeconf/ok/config-file-not-found.out new file mode 100644 index 0000000..bb89f38 --- /dev/null +++ b/test/includeconf/ok/config-file-not-found.out @@ -0,0 +1 @@ +txt2tags: Error: Cannot read file: XXX.inc diff --git a/test/includeconf/ok/config-file-text.out b/test/includeconf/ok/config-file-text.out new file mode 100644 index 0000000..a562af2 --- /dev/null +++ b/test/includeconf/ok/config-file-text.out @@ -0,0 +1,2 @@ +txt2tags: Error: Invalid CONFIG line on _text.inc +001:Text. diff --git a/test/includeconf/ok/includeconf-itself.out b/test/includeconf/ok/includeconf-itself.out new file mode 100644 index 0000000..681f4cb --- /dev/null +++ b/test/includeconf/ok/includeconf-itself.out @@ -0,0 +1 @@ +txt2tags: Error: A file cannot include itself (loop!): %!includeconf: includeconf-itself.t2t diff --git a/test/includeconf/ok/includeconf-not-found.out b/test/includeconf/ok/includeconf-not-found.out new file mode 100644 index 0000000..bb89f38 --- /dev/null +++ b/test/includeconf/ok/includeconf-not-found.out @@ -0,0 +1 @@ +txt2tags: Error: Cannot read file: XXX.inc diff --git a/test/includeconf/ok/includeconf-targeted.out b/test/includeconf/ok/includeconf-targeted.out new file mode 100644 index 0000000..674f239 --- /dev/null +++ b/test/includeconf/ok/includeconf-targeted.out @@ -0,0 +1,2 @@ +txt2tags: Error: You can't use (target) with %!includeconf +%!includeconf(html): _failed.inc diff --git a/test/includeconf/ok/includeconf-text.out b/test/includeconf/ok/includeconf-text.out new file mode 100644 index 0000000..a562af2 --- /dev/null +++ b/test/includeconf/ok/includeconf-text.out @@ -0,0 +1,2 @@ +txt2tags: Error: Invalid CONFIG line on _text.inc +001:Text. diff --git a/test/includeconf/ok/not-numbered.html b/test/includeconf/ok/not-numbered.html new file mode 100644 index 0000000..f21fe6c --- /dev/null +++ b/test/includeconf/ok/not-numbered.html @@ -0,0 +1,7 @@ +<div class="body" id="body"> + +<section> +<h1>title</h1> + +</section> +</div> diff --git a/test/includeconf/ok/numbered.html b/test/includeconf/ok/numbered.html new file mode 100644 index 0000000..914ebe7 --- /dev/null +++ b/test/includeconf/ok/numbered.html @@ -0,0 +1,7 @@ +<div class="body" id="body"> + +<section> +<h1>1. title</h1> + +</section> +</div> diff --git a/test/includeconf/run.py b/test/includeconf/run.py new file mode 100644 index 0000000..7798d00 --- /dev/null +++ b/test/includeconf/run.py @@ -0,0 +1,112 @@ +# +# txt2tags %!includeconf command tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +import glob +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# Tests for the command line option -C +# Note: --config-file is also tested automatically from these tests +tests = [ + {"name": "C", "cmdline": ["-C _config.inc"], "not-numbered": True}, + {"name": "C-C", "cmdline": ["-C _config.inc -C _config.inc"], "not-numbered": True}, + {"name": "C-C2", "cmdline": ["-C _config.inc -C _config2.inc"]}, + {"name": "C-default", "cmdline": ["-t html -C _config2.inc"]}, + {"name": "C-empty", "cmdline": ["-t html -C _empty.inc"], "not-numbered": True}, + {"name": "C-not-found", "cmdline": ["-t html -C XXX.inc"], "not-numbered": True}, + {"name": "C-text", "cmdline": ["-t html -C _text.inc"], "not-numbered": True}, + {"name": "C-targeted-inside", "cmdline": ["-t html -C _targeted.inc"]}, + {"name": "C-nesting", "cmdline": ["-C _sub_include.inc"]}, + {"name": "C-nesting-folder", "cmdline": ["-C folder/_folder.inc"]}, + { + "name": "C-nesting-folder-back", + "cmdline": ["-C folder/subfolder/_folder-back.inc"], + # This checking is never made because the infile may not be known without + # reading the config file. In other words, you can set %!options: -i foo.t2t + # inside the config file and just call: txt2tags -C config.t2t + # Because of this feature, we can't compare config file and infile names + # before reading the full config. But it will not loop, since the first body + # line of the infile will raise a config error. + # }, { + # 'name' : 'C-itself', # t2t -C foo.t2t -i foo.t2t + # 'cmdline': ["-C body-only"], + }, +] + + +def run(): + + # First test the %!includeconf command. + errors = [ + "includeconf-itself", + "includeconf-not-found", + "includeconf-targeted", + "includeconf-text", + ] + unnumbered = ["includeconf-empty"] + + # Test all t2t files found. + for infile in glob.glob("includeconf-*.t2t"): + basename = infile.replace(".t2t", "") + outfile = basename + ".html" + + if basename in unnumbered: + okfile = "ok/not-numbered.html" + else: + okfile = "ok/numbered.html" + + if basename in errors: + outfile = basename + ".out" + okfile = "ok/" + outfile + cmdline = ["-H", "-i", infile, "-o- >", outfile, "2>&1"] + else: + cmdline = ["-H", "-i", infile, "-o", outfile] + + if lib.initTest(basename, infile, outfile, okfile): + lib.test(cmdline, outfile, okfile) + + # Now test -C and --config-file command line options. + errors = ["C-not-found", "C-text"] + default_cmdline = ["-H -i body-only.t2t"] + infile = "body-only.t2t" + for test in tests: + + # --enum-title is used by this test? + if test.get("not-numbered"): + okfile = "ok/not-numbered.html" + else: + okfile = "ok/numbered.html" + + # 1st turn (-C), 2nd turn (--config-file) + for i in (1, 2): + + if i == 1: + name = test["name"] + cmdline = test["cmdline"] + else: + name = test["name"].replace("C", "config-file") + cmdline = [x.replace("-C", "--config-file") for x in test["cmdline"]] + + outfile = name + ".html" + + if test["name"] in errors: + outfile = name + ".out" + okfile = "ok/" + outfile + cmdline = default_cmdline + cmdline + ["-o- >", outfile, "2>&1"] + else: + cmdline = default_cmdline + cmdline + ["-o", outfile] + + # convert and check results + if lib.initTest(name, infile, outfile, okfile): + lib.test(cmdline, outfile, okfile=okfile) + + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/lib.py b/test/lib.py new file mode 100644 index 0000000..2b549ce --- /dev/null +++ b/test/lib.py @@ -0,0 +1,156 @@ +# +# txt2tags test-suite library (http://txt2tags.org) +# See also: run.py, */run.py +# + +from __future__ import print_function + +import difflib +import os +import platform +import re +import subprocess +import sys +import time + +PYTHON = sys.executable +TEST_DIR = os.path.dirname(os.path.abspath(__file__)) + +print("Testing txt2tags on Python", platform.python_version()) + +# Path for txt2tags (change here if your txt2tags is in a different location) +TXT2TAGS = "../txt2tags.py" + +CONFIG_FILE = "config" +CSS_FILE = "css" +DIR_OK = "ok" +DIR_ERROR = "error" + +OK = FAILED = 0 +ERROR_FILES = [] + +OVERRIDE = False + +# force absolute path to avoid problems, set default options +TXT2TAGS = [os.path.abspath(TXT2TAGS), "-q", "--no-rc"] + + +def get_output(cmd): + return subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() + + +# +# file tools +# +def ReadFile(filename): + with open(filename, "r") as f: + return f.read() + + +def WriteFile(filename, content=""): + with open(filename, "w") as f: + f.write(content) + + +def MoveFile(orig, target): + if os.path.isfile(target): + os.remove(target) + os.link(orig, target) + os.remove(orig) + + +def initTest(name, infile, outfile, okfile=None): + if not okfile: + okfile = os.path.join(DIR_OK, outfile) + print(" %s" % name, end=" ") + if not os.path.isfile(okfile): + print("Skipping test (missing %s)" % okfile) + return False + return True + + +def getFileMtime(file): + ret = "-NO-MTIME-" + if os.path.isfile(file): + ret = time.strftime("%Y%m%d", time.localtime(os.path.getmtime(file))) + return ret + + +def getCurrentDate(): + return time.strftime("%Y%m%d", time.localtime(time.time())) + + +def _convert(options): + cmdline = " ".join([PYTHON] + TXT2TAGS + options) + return subprocess.call(cmdline, shell=True) + + +def remove_version_and_dates(text): + version_re = r"\d+\.\d+(\.\d+)?" + for regex in [ + r"Txt2tags {version_re}", + r"txt2tags {version_re}", + r"txt2tags version {version_re}", + # Remove date from header. + r"\d{{2}}/\d{{2}}/\d{{4}}", + # lout escapes / with "/" in headers + r'\d{{2}}"/"\d{{2}}"/"\d{{4}}', + # Remove dates. + r"today is \d{{8}}", + r"which gives: \d{{2}}-\d{{2}}-\d{{4}}", + # man escapes - with \- + r"which gives: \d{{2}}\\-\d{{2}}\\-\d{{4}}", + r"cmdline: txt2tags .*\n", + ]: + text = re.sub(regex.format(**locals()), "", text) + return text + + +def mark_ok(outfile): + global OK + print("OK") + OK += 1 + os.remove(outfile) + + +def mark_failed(outfile, okfile=None): + global FAILED + print("FAILED") + FAILED += 1 + if not os.path.isdir(DIR_ERROR): + os.mkdir(DIR_ERROR) + module = os.path.basename(os.getcwd()) + errfile = os.path.join(TEST_DIR, module, DIR_ERROR, outfile) + MoveFile(outfile, errfile) + ERROR_FILES.append(errfile) + print("meld {okfile} {errfile}".format(**locals())) + + +def override(okfile, outfile): + global FAILED + print("OVERRIDE") + FAILED += 1 + if os.path.exists(outfile): + MoveFile(outfile, okfile) + + +def _diff(outfile, okfile): + out = ReadFile(outfile) + out = remove_version_and_dates(out) + ok = ReadFile(okfile) + ok = remove_version_and_dates(ok) + if out != ok: + if OVERRIDE: + override(okfile, outfile) + else: + mark_failed(outfile, okfile=okfile) + for line in difflib.unified_diff(ok.splitlines(), out.splitlines()): + print(line) + else: + mark_ok(outfile) + + +def test(cmdline, outfile, okfile=None): + okfile = okfile or os.path.join(DIR_OK, outfile) + _convert(cmdline) + _diff(outfile, okfile) diff --git a/test/marks/comment.t2t b/test/marks/comment.t2t new file mode 100644 index 0000000..a10425d --- /dev/null +++ b/test/marks/comment.t2t @@ -0,0 +1,29 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: The % character at the line beginning (column 1) +%glued with the % mark +% separated from the % mark +% very distant from the % mark +%%%%%%% lots of % marks +% a blank comment, used for vertical spacing: +% +% NOTE: what matters is the first % being at the line beginning, +% the rest of the line is just ignored. + +%%% Syntax: Area (block) +%%% +You're not seeing this. +%%% + +%%% Syntax: Area (block) with trailing spaces +%%% +You're not seeing this. +%%% + +%%% Invalid: The % in any other position + % not on the line beginning (at column 2) + +some text % half line comments are not allowed + diff --git a/test/marks/image.t2t b/test/marks/image.t2t new file mode 100644 index 0000000..3253598 --- /dev/null +++ b/test/marks/image.t2t @@ -0,0 +1,37 @@ + +%!preproc: img\.png ../../samples/img/t2tbutton.png +%!includeconf: test.conf +BODYINIT + +%%% Syntax: Image name inside brackets: [img] +[img.png] + +%%% Syntax: Image pointing to a link: [[img] link] +[[img.png] http://txt2tags.org] + +%%% Align: Image position is preserved when inside paragraph +[img.png] Image at the line beginning. + +Image in the middle [img.png] of the line. + +Image at the line end. [img.png] + +%%% Align: Image alone with spaces around is aligned +[img.png] + [img.png] + [img.png] + +%%% Test: Two glued images with no spaces (left & right) +[img.png][img.png] + +%%% Test: Various per line +Images [img.png] mixed [img.png] with [img.png] text. + +Images glued together: [img.png][img.png][img.png]. + +%%% Invalid: Spaces inside are not allowed +[img.png ] + +[ img.png] + +[ img.png ] diff --git a/test/marks/inline.t2t b/test/marks/inline.t2t new file mode 100644 index 0000000..7209035 --- /dev/null +++ b/test/marks/inline.t2t @@ -0,0 +1,48 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: Marks are greedy and must be "glued" with contents +%% GLUED: The contents must be glued with the marks, no spaces +%% between them. Right after the opening mark there must be a +%% non-blank character, as well as right before the closing mark. +%% +%% GREEDY: If the contents boundary character is the same as +%% the mark character, it is considered contents, not mark. +%% So ""****bold****"" turns to ""<B>**bold**</B>"" in HTML. + +i) **b** //i// __u__ --s-- ``m`` ""r"" ''t'' +i) **bo** //it// __un__ --st-- ``mo`` ""ra"" ''tg'' +i) **bold** //ital// __undr__ --strk-- ``mono`` ""raw"" ''tggd'' +i) **bo ld** //it al// __un dr__ --st rk-- ``mo no`` ""r aw"" ''tg gd'' +i) **bo * ld** //it / al// __un _ dr__ --st - rk-- ``mo ` no`` ""r " aw"" ''tg ' gd'' +i) **bo **ld** //it //al// __un __dr__ --st --rk-- ``mo ``no`` ""r ""aw"" ''tg ''gd'' +i) **bo ** ld** //it // al// __un __ dr__ --st -- rk-- ``mo `` no`` ""r "" aw"" ''tg '' gd'' +i) ****bold**** ////ital//// ____undr____ ----strk---- ````mono```` """"raw"""" ''''tggd'''' +i) ***bold*** ///ital/// ___undr___ ---strk--- ```mono``` """raw""" '''tggd''' + +%%% Syntax: Repetition is greedy +%% When the mark character is repeated many times, +%% the contents are expanded to the largest possible. +%% Thats why they are greedy, the outer marks are +%% the ones used. + +i) ***** ///// _____ ----- ````` """"" ''''' +i) ****** ////// ______ ------ `````` """""" '''''' +i) ******* /////// _______ ------- ``````` """"""" ''''''' +i) ******** //////// ________ -------- ```````` """""""" '''''''' +i) ********* ///////// _________ --------- ````````` """"""""" ''''''''' +i) ********** ////////// __________ ---------- `````````` """""""""" '''''''''' + +%%% Invalid: No contents + +i) **** //// ____ ---- ```` """" '''' +i) ** ** // // __ __ -- -- `` `` "" "" '' '' + +%%% Invalid: Contents not "glued" with marks +%% Spaces between the marks and the contents in any side +%% invalidate the mark. + +i) ** bold** // ital// __ undr__ -- strk-- `` mono`` "" raw"" '' tggd'' +i) **bold ** //ital // __undr __ --strk -- ``mono `` ""raw "" ''tggd '' +i) ** bold ** // ital // __ undr __ -- strk -- `` mono `` "" raw "" '' tggd '' diff --git a/test/marks/line.t2t b/test/marks/line.t2t new file mode 100644 index 0000000..b61ebf6 --- /dev/null +++ b/test/marks/line.t2t @@ -0,0 +1,30 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: At least 20 chars of - = _ +-------------------- +==================== +____________________ +%%% Syntax: Any kind of mixing is allowed +%% Free mixing is allowed to make the line, +%% but the first char is the identifier for +%% the difference between separator ( - _ ) +%% and strong ( = ) lines. +=========----------- +-_-_-_-_-_-_-_-_-_-_ +=-=-=-=-=-=-=-=-=-=- +=------------------= +--------====-------- +%%% Syntax: Leading and/or trailing spaces are allowed + -------------------- +-------------------- + -------------------- +%%% Invalid: Less than 20 chars (but strike matches) +--------- +%%% Invalid: Strange chars (but strike matches) +--------- ---------- + +---------+---------- + +( -------------------- ) diff --git a/test/marks/link.t2t b/test/marks/link.t2t new file mode 100644 index 0000000..00fb118 --- /dev/null +++ b/test/marks/link.t2t @@ -0,0 +1,100 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: E-mail +user@domain.com +user@domain.com. +user@domain.com. any text. +any text: user@domain.com. any text. +[label user@domain.com] +%%% Syntax: E-mail with form data +user@domain.com?subject=bla +user@domain.com?subject=bla. +user@domain.com?subject=bla, +user@domain.com?subject=bla&cc=otheruser@domain.com +user@domain.com?subject=bla&cc=otheruser@domain.com. +user@domain.com?subject=bla&cc=otheruser@domain.com, +[label user@domain.com?subject=bla&cc=otheruser@domain.com]. +[label user@domain.com?subject=bla&cc=otheruser@domain.com.]. +%%% Syntax: URL +http://www.domain.com +http://www.domain.com/dir/ +http://www.domain.com/dir/// +http://www.domain.com. +http://www.domain.com, +http://www.domain.com. any text. +http://www.domain.com, any text. +http://www.domain.com/dir/. any text. +any text: http://www.domain.com. any text. +any text: http://www.domain.com/dir/. any text. +any text: http://www.domain.com/dir/index.html. any text. +any text: http://www.domain.com/dir/index.html, any text. +%%% Syntax: URL with anchor +http://www.domain.com/dir/#anchor +http://www.domain.com/dir/index.html#anchor +http://www.domain.com/dir/index.html#anchor. +http://www.domain.com/dir/#anchor. any text. +http://www.domain.com/dir/index.html#anchor. any text. +any text: http://www.domain.com/dir/#anchor. any text. +any text: http://www.domain.com/dir/index.html#anchor. any text. +%%% Syntax: URL with form data +http://domain.com?a=a@a.a&b=a+b+c. +http://domain.com?a=a@a.a&b=a+b+c, +http://domain.com/bla.cgi?a=a@a.a&b=a+b+c. +http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@. +%%% Syntax: URL with form data and anchor +http://domain.com?a=a@a.a&b=a+b+c.#anchor +http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor +http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor +%%% Syntax: URL with login data +http://user:password@domain.com/bla.html. +http://user:password@domain.com/dir/. +http://user:password@domain.com. +http://user:@domain.com. +http://user@domain.com. +%%% Syntax: URL with login, form and anchor +http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor +http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor +%%% Syntax: URL with label +[label www.domain.com] +%%% Syntax: URL with label (trailing spaces are discarded, leading are maintained) +%TODO normalize this behavior +[ label www.domain.com] +[label www.domain.com] +%%% Syntax: URL with label, stressing +[anchor http://www.domain.com/dir/index.html#anchor.] +[login http://user:password@domain.com/bla.html] +[form http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.] +[form & anchor http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor] +[login & form http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.] +%%% Syntax: Link with label for local files +[local link up ..] +[local link file bla.html] +[local link anchor #anchor] +[local link file/anchor bla.html#anchor] +[local link file/anchor bla.html#anchor.] +[local link img abc.gif] +%%% Syntax: Another link as a label +[www.fake.com www.domain.com] +%%% Syntax: URL with funny chars +http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm +http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_- +http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%. +http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%. +%%% Test: Various per line +http://L1.com ! L2@www.com ! [L3 www.com] ! [L4 w@ww.com] ! www.L5.com +%%% Feature: Guessed link, adding protocol automatically +www.domain.com +www2.domain.com +ftp.domain.com +WWW.DOMAIN.COM +FTP.DOMAIN.COM +[label www.domain.com] +[label ftp.domain.com] +[label WWW.DOMAIN.COM] +[label FTP.DOMAIN.COM] +%%% Invalid: Trailing space on link +[label www.domain.com ] +%%% Invalid: Label with ] char (use postproc) +[label] www.domain.com] diff --git a/test/marks/list.t2t b/test/marks/list.t2t new file mode 100644 index 0000000..d0fd810 --- /dev/null +++ b/test/marks/list.t2t @@ -0,0 +1,178 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Items: Prefixed by hyphen +- Use the hyphen to prefix list items. +- There must be one space after the hyphen. +- The list is closed by two consecutive blank lines. + + +%%% Items: Free leading spacing (indentation) + - The list can be indented on the source document. + - You can use any number of spaces. + - The result will be the same. + + +%%% Items: Vertical spacing between items +- Let one blank line between the list items. + +- It will be maintained on the conversion. + +- Some targets don't support this behavior. + +- This one was separated by a line with blanks. + You can also put a blank line inside + + the item contents and it will be preserved. + + +%%% Items: Exactly ONE space after the hyphen +-This is not a list (no space) + +- This is not a list (more than one space) + +- This is not a list (a TAB instead the space) + + +%%% Items: Catchy cases +- - This is a list +- + This is a list +- : This is a list + + +%%% Nesting: Creating sublists +- This is the "mother" list first item. +- Here is the second, but inside this item, + - there is a sublist, with its own items. + - Note that the items of the same sublist + - must have the same indentation. + - And this can go on, opening sublists. + - Just add leading spaces before the + - hyphen and sublists will be opened. + - The two blank lines closes them all. + + +%%% Nesting: Free leading spacing (indentation) +- When nesting lists, the additional spaces are free. + - You can add just one, + - or many. + - What matters is to put more than the previous. + - But remember that the other items of the same list + - must use the same indentation. + + +%%% Nesting: Maximum depth +- There is not a depth limit, + - you can go deeper and deeper. + - But some targets may have restrictions. + - The LaTeX maximum is here, 4 levels. + - This one and the following sublists + - are moved up to the level 4 + - when converting to LaTeX. + - On the other targets, + - it is just fine + - to have a very deep list. + + +%%% Nesting: Reverse doesn't work + - Reverse nesting doesn't work. + - Because a sublist *must* have a mother list. + - It's the list concept, not a txt2tags limitation. + - All this sublists will be bumped to mother lists. +- At level 1, like this one. + + +%%% Nesting: Going deeper and back + +%% When nesting back to an upper level, the previous sublist +%% is automatically closed. +- Level 1 + - Level 2 + - Level 3 + - Level 4 + - Level 3 -- (closed Level 4) + - Level 2 -- (closed Level 3) +- Level 1 -- (closed Level 2) + + +%% More than one list can be closed when nesting back. +- Level 1 + - Level 2 + - Level 3 + - Level 4 +- Level 1 -- (closed Level 4, Level 3 and Level 2) + + +%%% Nesting: Vertical spacing between lists +- Level 1 + + - Level 2 -- blank BEFORE and AFTER (in) + + - Level 3 +% comment lines are NOT considered blank lines + - Level 4 +% comment lines are NOT considered blank lines + - Level 3 + + - Level 2 -- blank BEFORE and AFTER (out) + +- Level 1 + + - Level 2 -- blank BEFORE (spaces) and AFTER (TAB) + + - Level 3 + + +%%% Nesting: Messing up +%% Be careful when going back on the nesting, +%% it must be on a valid level! If not, it will +%% be bumped up to the previous valid level. +- Level 1 + - Level 2 + - Level 3 + - Level 4 + - Level 3.5 ??? + - Level 3 + - Level 2.5 ??? + - Level 2 + - Level 1.5 ??? +- Level 1 + + +%%% Closing: Two (not so) empty lines +- This list is closed by a line with spaces and other with TABs + + +- This list is NOT closed by two comment lines +% comment lines are NOT considered blank lines +% comment lines are NOT considered blank lines +- This list is closed by a line with spaces and TAB, +- then a comment line, then an empty line. + +% comment lines are NOT considered blank lines + +%%% Closing: Empty item closes current (sub)list + +%% The two blank lines closes ALL the lists. +%% To close just the current, use an empty item. +- Level 1 + - Level 2 + - Level 3 + - + Level 2 + - + Level 1 +- + +%% The empty item can have trailing blanks. +- Empty item with trailing spaces. +- + +- Empty item with trailing TAB. +- + +%%% Closing: EOF closes the lists +- If the end of the file (EOF) is hit, + - all the currently opened list are closed, + - just like when using the two blank lines. diff --git a/test/marks/ok/comment.html b/test/marks/ok/comment.html new file mode 100644 index 0000000..38e4077 --- /dev/null +++ b/test/marks/ok/comment.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: The % character at the line beginning (column 1)</h2> + +</section> +<section> +<h2>Syntax: Area (block)</h2> + +</section> +<section> +<h2>Syntax: Area (block) with trailing spaces</h2> + +</section> +<section> +<h2>Invalid: The % in any other position</h2> + +<p> + % not on the line beginning (at column 2) +</p> +<p> +some text % half line comments are not allowed +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc comment.t2t --> +</article></body></html> diff --git a/test/marks/ok/deflist.html b/test/marks/ok/deflist.html new file mode 100644 index 0000000..ddf9592 --- /dev/null +++ b/test/marks/ok/deflist.html @@ -0,0 +1,426 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Items: Prefixed by colon</h2> + +<dl> +<dt>Use the colon to prefix list items.</dt><dd> +</dd> +<dt>There must be one space after the colon.</dt><dd> +</dd> +<dt>The list is closed by two consecutive blank lines.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Items: Free leading spacing (indentation)</h2> + + <dl> + <dt>The list can be indented on the source document.</dt><dd> + </dd> + <dt>You can use any number of spaces.</dt><dd> + </dd> + <dt>The result will be the same.</dt><dd> + </dd> + </dl> + +</section> +<section> +<h2>Items: Vertical spacing between items</h2> + +<dl> +<dt>Let one blank line between the list items.</dt><dd> +<p></p> +</dd> +<dt>It will be maintained on the conversion.</dt><dd> +<p></p> +</dd> +<dt>Some targets don't support this behavior.</dt><dd> +<p></p> +</dd> +<dt>This one was separated by a line with blanks.</dt><dd> + You can also put a blank line inside +<p></p> + the item contents and it will be preserved. +</dd> +</dl> + +</section> +<section> +<h2>Items: Exactly ONE space after the colon</h2> + +<p> +:This is not a list (no space) +</p> + +<dl> +<dt> This is not a list (more than one space)</dt><dd> +<p></p> +: This is not a list (a TAB instead the space) +</dd> +</dl> + +</section> +<section> +<h2>Items: Catchy cases</h2> + +<dl> +<dt>- This is a list</dt><dd> +</dd> +<dt>+ This is a list</dt><dd> +</dd> +<dt>: This is a list</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Creating sublists</h2> + +<dl> +<dt>This is the "mother" list first item.</dt><dd> +</dd> +<dt>Here is the second, but inside this item,</dt><dd> + <dl> + <dt>there is a sublist, with its own items.</dt><dd> + </dd> + <dt>Note that the items of the same sublist</dt><dd> + </dd> + <dt>must have the same indentation.</dt><dd> + <dl> + <dt>And this can go on, opening sublists.</dt><dd> + <dl> + <dt>Just add leading spaces before the</dt><dd> + </dd> + <dt>colon and sublists will be opened.</dt><dd> + </dd> + <dt>The two blank lines closes them all.</dt><dd> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Free leading spacing (indentation)</h2> + +<dl> +<dt>When nesting lists, the additional spaces are free.</dt><dd> + <dl> + <dt>You can add just one,</dt><dd> + <dl> + <dt>or many.</dt><dd> + <dl> + <dt>What matters is to put more than the previous.</dt><dd> + </dd> + <dt>But remember that the other items of the same list</dt><dd> + </dd> + <dt>must use the same indentation.</dt><dd> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Maximum depth</h2> + +<dl> +<dt>There is not a depth limit,</dt><dd> + <dl> + <dt>you can go deeper and deeper.</dt><dd> + <dl> + <dt>But some targets may have restrictions.</dt><dd> + <dl> + <dt>The LaTeX maximum is here, 4 levels.</dt><dd> + <dl> + <dt>This one and the following sublists</dt><dd> + <dl> + <dt>are moved up to the level 4</dt><dd> + <dl> + <dt>when converting to LaTeX.</dt><dd> + <dl> + <dt>On the other targets,</dt><dd> + <dl> + <dt>it is just fine</dt><dd> + <dl> + <dt>to have a very deep list.</dt><dd> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Reverse doesn't work</h2> + + <dl> + <dt>Reverse nesting doesn't work.</dt><dd> + </dd> + </dl> + + <dl> + <dt>Because a sublist *must* have a mother list.</dt><dd> + </dd> + </dl> + + <dl> + <dt>It's the list concept, not a txt2tags limitation.</dt><dd> + </dd> + </dl> + + <dl> + <dt>All this sublists will be bumped to mother lists.</dt><dd> + </dd> + </dl> + +<dl> +<dt>At level 1, like this one.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Going deeper and back</h2> + +<dl> +<dt>Level 1</dt><dd> + <dl> + <dt>Level 2</dt><dd> + <dl> + <dt>Level 3</dt><dd> + <dl> + <dt>Level 4</dt><dd> + </dd> + </dl> + </dd> + <dt>Level 3 -- (closed Level 4)</dt><dd> + </dd> + </dl> + </dd> + <dt>Level 2 -- (closed Level 3)</dt><dd> + </dd> + </dl> +</dd> +<dt>Level 1 -- (closed Level 2)</dt><dd> +</dd> +</dl> + +<dl> +<dt>Level 1</dt><dd> + <dl> + <dt>Level 2</dt><dd> + <dl> + <dt>Level 3</dt><dd> + <dl> + <dt>Level 4</dt><dd> + </dd> + </dl> + </dd> + </dl> + </dd> + </dl> +</dd> +<dt>Level 1 -- (closed Level 4, Level 3 and Level 2)</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Vertical spacing between lists</h2> + +<dl> +<dt>Level 1</dt><dd> +<p></p> + <dl> + <dt>Level 2 -- blank BEFORE and AFTER (in)</dt><dd> + <p></p> + <dl> + <dt>Level 3</dt><dd> + <dl> + <dt>Level 4</dt><dd> + </dd> + </dl> + </dd> + <dt>Level 3</dt><dd> + <p></p> + </dd> + </dl> + </dd> + <dt>Level 2 -- blank BEFORE and AFTER (out)</dt><dd> + <p></p> + </dd> + </dl> +</dd> +<dt>Level 1</dt><dd> +<p></p> + <dl> + <dt>Level 2 -- blank BEFORE (spaces) and AFTER (TAB)</dt><dd> + <p></p> + <dl> + <dt>Level 3</dt><dd> + </dd> + </dl> + </dd> + </dl> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Messing up</h2> + +<dl> +<dt>Level 1</dt><dd> + <dl> + <dt>Level 2</dt><dd> + <dl> + <dt>Level 3</dt><dd> + <dl> + <dt>Level 4</dt><dd> + </dd> + </dl> + </dd> + <dt>Level 3.5 ???</dt><dd> + </dd> + <dt>Level 3</dt><dd> + </dd> + </dl> + </dd> + <dt>Level 2.5 ???</dt><dd> + </dd> + <dt>Level 2</dt><dd> + </dd> + </dl> +</dd> +<dt>Level 1.5 ???</dt><dd> +</dd> +<dt>Level 1</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Closing: Two (not so) empty lines</h2> + +<dl> +<dt>This list is closed by a line with spaces and other with TABs</dt><dd> +</dd> +</dl> + +<dl> +<dt>This list is NOT closed by two comment lines</dt><dd> +</dd> +<dt>This list is closed by a line with spaces and TAB,</dt><dd> +</dd> +<dt>then a comment line, then an empty line.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Closing: Empty item closes current (sub)list</h2> + +<dl> +<dt>Level 1</dt><dd> + <dl> + <dt>Level 2</dt><dd> + <dl> + <dt>Level 3</dt><dd> + </dd> + </dl> + Level 2 + </dd> + </dl> + Level 1 +</dd> +</dl> + +<dl> +<dt>Empty item with trailing spaces.</dt><dd> +</dd> +</dl> + +<dl> +<dt>Empty item with trailing TAB.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Closing: EOF closes the lists</h2> + +<dl> +<dt>If the end of the file (EOF) is hit,</dt><dd> + <dl> + <dt>all the currently opened list are closed,</dt><dd> + <dl> + <dt>just like when using the two blank lines.</dt><dd> + </dd> + </dl> + </dd> + </dl> +</dd> +</dl> + +</section> +</section> +</div> +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -C config -o deflist.html list.t2t --> +</article></body></html> diff --git a/test/marks/ok/image.html b/test/marks/ok/image.html new file mode 100644 index 0000000..988aefb --- /dev/null +++ b/test/marks/ok/image.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: Image name inside brackets: [img]</h2> + +<p> +<img class="center" src="../../samples/img/t2tbutton.png" alt=""> +</p> + +</section> +<section> +<h2>Syntax: Image pointing to a link: [[img] link]</h2> + +<p> +<a href="http://txt2tags.org"><img class="center" src="../../samples/img/t2tbutton.png" alt=""></a> +</p> + +</section> +<section> +<h2>Align: Image position is preserved when inside paragraph</h2> + +<p> +<img class="left" src="../../samples/img/t2tbutton.png" alt=""> Image at the line beginning. +</p> +<p> +Image in the middle <img class="center" src="../../samples/img/t2tbutton.png" alt=""> of the line. +</p> +<p> +Image at the line end. <img class="right" src="../../samples/img/t2tbutton.png" alt=""> +</p> + +</section> +<section> +<h2>Align: Image alone with spaces around is aligned</h2> + +<p> +<img class="left" src="../../samples/img/t2tbutton.png" alt=""> + <img class="center" src="../../samples/img/t2tbutton.png" alt=""> + <img class="right" src="../../samples/img/t2tbutton.png" alt=""> +</p> + +</section> +<section> +<h2>Test: Two glued images with no spaces (left & right)</h2> + +<p> +<img class="left" src="../../samples/img/t2tbutton.png" alt=""><img class="right" src="../../samples/img/t2tbutton.png" alt=""> +</p> + +</section> +<section> +<h2>Test: Various per line</h2> + +<p> +Images <img class="center" src="../../samples/img/t2tbutton.png" alt=""> mixed <img class="center" src="../../samples/img/t2tbutton.png" alt=""> with <img class="center" src="../../samples/img/t2tbutton.png" alt=""> text. +</p> +<p> +Images glued together: <img class="center" src="../../samples/img/t2tbutton.png" alt=""><img class="center" src="../../samples/img/t2tbutton.png" alt=""><img class="center" src="../../samples/img/t2tbutton.png" alt="">. +</p> + +</section> +<section> +<h2>Invalid: Spaces inside are not allowed</h2> + +<p> +[../../samples/img/t2tbutton.png ] +</p> +<p> +[ ../../samples/img/t2tbutton.png] +</p> +<p> +[ ../../samples/img/t2tbutton.png ] +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc image.t2t --> +</article></body></html> diff --git a/test/marks/ok/inline.html b/test/marks/ok/inline.html new file mode 100644 index 0000000..23c4b8c --- /dev/null +++ b/test/marks/ok/inline.html @@ -0,0 +1,85 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: Marks are greedy and must be "glued" with contents</h2> + +<p> +<br> <strong>b</strong> <em>i</em> <span class="underline">u</span> <del>s</del> <code>m</code> r t +<br> <strong>bo</strong> <em>it</em> <span class="underline">un</span> <del>st</del> <code>mo</code> ra tg +<br> <strong>bold</strong> <em>ital</em> <span class="underline">undr</span> <del>strk</del> <code>mono</code> raw tggd +<br> <strong>bo ld</strong> <em>it al</em> <span class="underline">un dr</span> <del>st rk</del> <code>mo no</code> r aw tg gd +<br> <strong>bo * ld</strong> <em>it / al</em> <span class="underline">un _ dr</span> <del>st - rk</del> <code>mo ` no</code> r " aw tg ' gd +<br> <strong>bo **ld</strong> <em>it //al</em> <span class="underline">un __dr</span> <del>st --rk</del> <code>mo ``no</code> r ""aw tg ''gd +<br> <strong>bo ** ld</strong> <em>it // al</em> <span class="underline">un __ dr</span> <del>st -- rk</del> <code>mo `` no</code> r "" aw tg '' gd +<br> <strong>**bold**</strong> <em>//ital//</em> <span class="underline">__undr__</span> <del>--strk--</del> <code>``mono``</code> ""raw"" ''tggd'' +<br> <strong>*bold*</strong> <em>/ital/</em> <span class="underline">_undr_</span> <del>-strk-</del> <code>`mono`</code> "raw" 'tggd' +</p> + +</section> +<section> +<h2>Syntax: Repetition is greedy</h2> + +<p> +<br> <strong>*</strong> <em>/</em> <span class="underline">_</span> <del>-</del> <code>`</code> " ' +<br> <strong>**</strong> <em>//</em> <span class="underline">__</span> <del>--</del> <code>``</code> "" '' +<br> <strong>***</strong> <em>///</em> <span class="underline">___</span> <del>---</del> <code>```</code> """ ''' +<br> <strong>****</strong> <em>////</em> <span class="underline">____</span> <del>----</del> <code>````</code> """" '''' +<br> <strong>*****</strong> <em>/////</em> <span class="underline">_____</span> <del>-----</del> <code>`````</code> """"" ''''' +<br> <strong>******</strong> <em>//////</em> <span class="underline">______</span> <del>------</del> <code>``````</code> """""" '''''' +</p> + +</section> +<section> +<h2>Invalid: No contents</h2> + +<p> +<br> **** //// ____ ---- ```` """" '''' +<br> ** ** // // __ __ -- -- `` `` "" "" '' '' +</p> + +</section> +<section> +<h2>Invalid: Contents not "glued" with marks</h2> + +<p> +<br> ** bold** // ital// __ undr__ -- strk-- `` mono`` "" raw"" '' tggd'' +<br> **bold ** //ital // __undr __ --strk -- ``mono `` ""raw "" ''tggd '' +<br> ** bold ** // ital // __ undr __ -- strk -- `` mono `` "" raw "" '' tggd '' +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc inline.t2t --> +</article></body></html> diff --git a/test/marks/ok/line.html b/test/marks/ok/line.html new file mode 100644 index 0000000..b2642a5 --- /dev/null +++ b/test/marks/ok/line.html @@ -0,0 +1,93 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: At least 20 chars of - = _</h2> + +<hr class="light"> + +<hr class="heavy"> + +<hr class="light"> + +</section> +<section> +<h2>Syntax: Any kind of mixing is allowed</h2> + +<hr class="heavy"> + +<hr class="light"> + +<hr class="heavy"> + +<hr class="heavy"> + +<hr class="light"> + +</section> +<section> +<h2>Syntax: Leading and/or trailing spaces are allowed</h2> + +<hr class="light"> + +<hr class="light"> + +<hr class="light"> + +</section> +<section> +<h2>Invalid: Less than 20 chars (but strike matches)</h2> + +<p> +<del>-----</del> +</p> + +</section> +<section> +<h2>Invalid: Strange chars (but strike matches)</h2> + +<p> +<del>-----</del> <del>------</del> +</p> +<p> +<del>-----</del>+<del>------</del> +</p> +<p> +( <del>----------------</del> ) +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc line.t2t --> +</article></body></html> diff --git a/test/marks/ok/link.html b/test/marks/ok/link.html new file mode 100644 index 0000000..13456ed --- /dev/null +++ b/test/marks/ok/link.html @@ -0,0 +1,240 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: E-mail</h2> + +<p> +<a href="mailto:user@domain.com">user@domain.com</a> +<a href="mailto:user@domain.com">user@domain.com</a>. +<a href="mailto:user@domain.com">user@domain.com</a>. any text. +any text: <a href="mailto:user@domain.com">user@domain.com</a>. any text. +<a href="mailto:user@domain.com">label</a> +</p> + +</section> +<section> +<h2>Syntax: E-mail with form data</h2> + +<p> +<a href="mailto:user@domain.com?subject=bla">user@domain.com?subject=bla</a> +<a href="mailto:user@domain.com?subject=bla.">user@domain.com?subject=bla.</a> +<a href="mailto:user@domain.com?subject=bla,">user@domain.com?subject=bla,</a> +<a href="mailto:user@domain.com?subject=bla&cc=otheruser@domain.com">user@domain.com?subject=bla&cc=otheruser@domain.com</a> +<a href="mailto:user@domain.com?subject=bla&cc=otheruser@domain.com.">user@domain.com?subject=bla&cc=otheruser@domain.com.</a> +<a href="mailto:user@domain.com?subject=bla&cc=otheruser@domain.com,">user@domain.com?subject=bla&cc=otheruser@domain.com,</a> +<a href="mailto:user@domain.com?subject=bla&cc=otheruser@domain.com">label</a>. +<a href="mailto:user@domain.com?subject=bla&cc=otheruser@domain.com.">label</a>. +</p> + +</section> +<section> +<h2>Syntax: URL</h2> + +<p> +<a href="http://www.domain.com">http://www.domain.com</a> +<a href="http://www.domain.com/dir/">http://www.domain.com/dir/</a> +<a href="http://www.domain.com/dir///">http://www.domain.com/dir///</a> +<a href="http://www.domain.com">http://www.domain.com</a>. +<a href="http://www.domain.com">http://www.domain.com</a>, +<a href="http://www.domain.com">http://www.domain.com</a>. any text. +<a href="http://www.domain.com">http://www.domain.com</a>, any text. +<a href="http://www.domain.com/dir/">http://www.domain.com/dir/</a>. any text. +any text: <a href="http://www.domain.com">http://www.domain.com</a>. any text. +any text: <a href="http://www.domain.com/dir/">http://www.domain.com/dir/</a>. any text. +any text: <a href="http://www.domain.com/dir/index.html">http://www.domain.com/dir/index.html</a>. any text. +any text: <a href="http://www.domain.com/dir/index.html">http://www.domain.com/dir/index.html</a>, any text. +</p> + +</section> +<section> +<h2>Syntax: URL with anchor</h2> + +<p> +<a href="http://www.domain.com/dir/#anchor">http://www.domain.com/dir/#anchor</a> +<a href="http://www.domain.com/dir/index.html#anchor">http://www.domain.com/dir/index.html#anchor</a> +<a href="http://www.domain.com/dir/index.html#anchor.">http://www.domain.com/dir/index.html#anchor.</a> +<a href="http://www.domain.com/dir/#anchor.">http://www.domain.com/dir/#anchor.</a> any text. +<a href="http://www.domain.com/dir/index.html#anchor.">http://www.domain.com/dir/index.html#anchor.</a> any text. +any text: <a href="http://www.domain.com/dir/#anchor.">http://www.domain.com/dir/#anchor.</a> any text. +any text: <a href="http://www.domain.com/dir/index.html#anchor.">http://www.domain.com/dir/index.html#anchor.</a> any text. +</p> + +</section> +<section> +<h2>Syntax: URL with form data</h2> + +<p> +<a href="http://domain.com?a=a@a.a&b=a+b+c.">http://domain.com?a=a@a.a&b=a+b+c.</a> +<a href="http://domain.com?a=a@a.a&b=a+b+c,">http://domain.com?a=a@a.a&b=a+b+c,</a> +<a href="http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.">http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.</a> +<a href="http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.">http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.</a> +</p> + +</section> +<section> +<h2>Syntax: URL with form data and anchor</h2> + +<p> +<a href="http://domain.com?a=a@a.a&b=a+b+c.#anchor">http://domain.com?a=a@a.a&b=a+b+c.#anchor</a> +<a href="http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor">http://domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor</a> +<a href="http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor">http://domain.com/bla.cgi?a=a@a.a&b=a+b+c@.#anchor</a> +</p> + +</section> +<section> +<h2>Syntax: URL with login data</h2> + +<p> +<a href="http://user:password@domain.com/bla.html">http://user:password@domain.com/bla.html</a>. +<a href="http://user:password@domain.com/dir/">http://user:password@domain.com/dir/</a>. +<a href="http://user:password@domain.com">http://user:password@domain.com</a>. +<a href="http://user:@domain.com">http://user:@domain.com</a>. +<a href="http://user@domain.com">http://user@domain.com</a>. +</p> + +</section> +<section> +<h2>Syntax: URL with login, form and anchor</h2> + +<p> +<a href="http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor">http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor</a> +<a href="http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor">http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c@#anchor</a> +</p> + +</section> +<section> +<h2>Syntax: URL with label</h2> + +<p> +<a href="http://www.domain.com">label</a> +</p> + +</section> +<section> +<h2>Syntax: URL with label (trailing spaces are discarded, leading are maintained)</h2> + +<p> +<a href="http://www.domain.com"> label</a> +<a href="http://www.domain.com">label</a> +</p> + +</section> +<section> +<h2>Syntax: URL with label, stressing</h2> + +<p> +<a href="http://www.domain.com/dir/index.html#anchor.">anchor</a> +<a href="http://user:password@domain.com/bla.html">login</a> +<a href="http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.">form</a> +<a href="http://www.domain.com/bla.cgi?a=a@a.a&b=a+b+c.#anchor">form & anchor</a> +<a href="http://user:password@domain.com/bla.cgi?a=a@a.a&b=a+b+c.">login & form</a> +</p> + +</section> +<section> +<h2>Syntax: Link with label for local files</h2> + +<p> +<a href="..">local link up</a> +<a href="bla.html">local link file</a> +<a href="#anchor">local link anchor</a> +<a href="bla.html#anchor">local link file/anchor</a> +<a href="bla.html#anchor.">local link file/anchor</a> +<a href="abc.gif">local link img</a> +</p> + +</section> +<section> +<h2>Syntax: Another link as a label</h2> + +<p> +<a href="http://www.domain.com">www.fake.com</a> +</p> + +</section> +<section> +<h2>Syntax: URL with funny chars</h2> + +<p> +<a href="http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm">http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm</a> +<a href="http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-">http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-</a> +<a href="http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.">http://domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.</a> +<a href="http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.">http://foo._user-9:pass!#$%&*()+word@domain.com:8080/~user/_st-r@a=n$g,e/index%20new.htm?a=/%22&b=+.@*_-#anchor_-1%.</a> +</p> + +</section> +<section> +<h2>Test: Various per line</h2> + +<p> +<a href="http://L1.com">http://L1.com</a> ! <a href="mailto:L2@www.com">L2@www.com</a> ! <a href="http://www.com">L3</a> ! <a href="mailto:w@ww.com">L4</a> ! <a href="http://www.L5.com">www.L5.com</a> +</p> + +</section> +<section> +<h2>Feature: Guessed link, adding protocol automatically</h2> + +<p> +<a href="http://www.domain.com">www.domain.com</a> +<a href="http://www2.domain.com">www2.domain.com</a> +<a href="ftp://ftp.domain.com">ftp.domain.com</a> +<a href="http://WWW.DOMAIN.COM">WWW.DOMAIN.COM</a> +<a href="ftp://FTP.DOMAIN.COM">FTP.DOMAIN.COM</a> +<a href="http://www.domain.com">label</a> +<a href="ftp://ftp.domain.com">label</a> +<a href="http://WWW.DOMAIN.COM">label</a> +<a href="ftp://FTP.DOMAIN.COM">label</a> +</p> + +</section> +<section> +<h2>Invalid: Trailing space on link</h2> + +<p> +[label <a href="http://www.domain.com">www.domain.com</a> ] +</p> + +</section> +<section> +<h2>Invalid: Label with ] char (use postproc)</h2> + +<p> +[label] <a href="http://www.domain.com">www.domain.com</a>] +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc link.t2t --> +</article></body></html> diff --git a/test/marks/ok/list.html b/test/marks/ok/list.html new file mode 100644 index 0000000..2b4dad7 --- /dev/null +++ b/test/marks/ok/list.html @@ -0,0 +1,425 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Items: Prefixed by hyphen</h2> + +<ul> +<li>Use the hyphen to prefix list items. +</li> +<li>There must be one space after the hyphen. +</li> +<li>The list is closed by two consecutive blank lines. +</li> +</ul> + +</section> +<section> +<h2>Items: Free leading spacing (indentation)</h2> + + <ul> + <li>The list can be indented on the source document. + </li> + <li>You can use any number of spaces. + </li> + <li>The result will be the same. + </li> + </ul> + +</section> +<section> +<h2>Items: Vertical spacing between items</h2> + +<ul> +<li>Let one blank line between the list items. +<p></p> +</li> +<li>It will be maintained on the conversion. +<p></p> +</li> +<li>Some targets don't support this behavior. +<p></p> +</li> +<li>This one was separated by a line with blanks. + You can also put a blank line inside +<p></p> + the item contents and it will be preserved. +</li> +</ul> + +</section> +<section> +<h2>Items: Exactly ONE space after the hyphen</h2> + +<p> +-This is not a list (no space) +</p> +<p> +- This is not a list (more than one space) +</p> +<p> +- This is not a list (a TAB instead the space) +</p> + +</section> +<section> +<h2>Items: Catchy cases</h2> + +<ul> +<li>- This is a list +</li> +<li>+ This is a list +</li> +<li>: This is a list +</li> +</ul> + +</section> +<section> +<h2>Nesting: Creating sublists</h2> + +<ul> +<li>This is the "mother" list first item. +</li> +<li>Here is the second, but inside this item, + <ul> + <li>there is a sublist, with its own items. + </li> + <li>Note that the items of the same sublist + </li> + <li>must have the same indentation. + <ul> + <li>And this can go on, opening sublists. + <ul> + <li>Just add leading spaces before the + </li> + <li>hyphen and sublists will be opened. + </li> + <li>The two blank lines closes them all. + </li> + </ul> + </li> + </ul> + </li> + </ul> +</li> +</ul> + +</section> +<section> +<h2>Nesting: Free leading spacing (indentation)</h2> + +<ul> +<li>When nesting lists, the additional spaces are free. + <ul> + <li>You can add just one, + <ul> + <li>or many. + <ul> + <li>What matters is to put more than the previous. + </li> + <li>But remember that the other items of the same list + </li> + <li>must use the same indentation. + </li> + </ul> + </li> + </ul> + </li> + </ul> +</li> +</ul> + +</section> +<section> +<h2>Nesting: Maximum depth</h2> + +<ul> +<li>There is not a depth limit, + <ul> + <li>you can go deeper and deeper. + <ul> + <li>But some targets may have restrictions. + <ul> + <li>The LaTeX maximum is here, 4 levels. + <ul> + <li>This one and the following sublists + <ul> + <li>are moved up to the level 4 + <ul> + <li>when converting to LaTeX. + <ul> + <li>On the other targets, + <ul> + <li>it is just fine + <ul> + <li>to have a very deep list. + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> + </li> + </ul> +</li> +</ul> + +</section> +<section> +<h2>Nesting: Reverse doesn't work</h2> + + <ul> + <li>Reverse nesting doesn't work. + </li> + </ul> + + <ul> + <li>Because a sublist *must* have a mother list. + </li> + </ul> + + <ul> + <li>It's the list concept, not a txt2tags limitation. + </li> + </ul> + + <ul> + <li>All this sublists will be bumped to mother lists. + </li> + </ul> + +<ul> +<li>At level 1, like this one. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Going deeper and back</h2> + +<ul> +<li>Level 1 + <ul> + <li>Level 2 + <ul> + <li>Level 3 + <ul> + <li>Level 4 + </li> + </ul> + </li> + <li>Level 3 -- (closed Level 4) + </li> + </ul> + </li> + <li>Level 2 -- (closed Level 3) + </li> + </ul> +</li> +<li>Level 1 -- (closed Level 2) +</li> +</ul> + +<ul> +<li>Level 1 + <ul> + <li>Level 2 + <ul> + <li>Level 3 + <ul> + <li>Level 4 + </li> + </ul> + </li> + </ul> + </li> + </ul> +</li> +<li>Level 1 -- (closed Level 4, Level 3 and Level 2) +</li> +</ul> + +</section> +<section> +<h2>Nesting: Vertical spacing between lists</h2> + +<ul> +<li>Level 1 +<p></p> + <ul> + <li>Level 2 -- blank BEFORE and AFTER (in) + <p></p> + <ul> + <li>Level 3 + <ul> + <li>Level 4 + </li> + </ul> + </li> + <li>Level 3 + <p></p> + </li> + </ul> + </li> + <li>Level 2 -- blank BEFORE and AFTER (out) + <p></p> + </li> + </ul> +</li> +<li>Level 1 +<p></p> + <ul> + <li>Level 2 -- blank BEFORE (spaces) and AFTER (TAB) + <p></p> + <ul> + <li>Level 3 + </li> + </ul> + </li> + </ul> +</li> +</ul> + +</section> +<section> +<h2>Nesting: Messing up</h2> + +<ul> +<li>Level 1 + <ul> + <li>Level 2 + <ul> + <li>Level 3 + <ul> + <li>Level 4 + </li> + </ul> + </li> + <li>Level 3.5 ??? + </li> + <li>Level 3 + </li> + </ul> + </li> + <li>Level 2.5 ??? + </li> + <li>Level 2 + </li> + </ul> +</li> +<li>Level 1.5 ??? +</li> +<li>Level 1 +</li> +</ul> + +</section> +<section> +<h2>Closing: Two (not so) empty lines</h2> + +<ul> +<li>This list is closed by a line with spaces and other with TABs +</li> +</ul> + +<ul> +<li>This list is NOT closed by two comment lines +</li> +<li>This list is closed by a line with spaces and TAB, +</li> +<li>then a comment line, then an empty line. +</li> +</ul> + +</section> +<section> +<h2>Closing: Empty item closes current (sub)list</h2> + +<ul> +<li>Level 1 + <ul> + <li>Level 2 + <ul> + <li>Level 3 + </li> + </ul> + Level 2 + </li> + </ul> + Level 1 +</li> +</ul> + +<ul> +<li>Empty item with trailing spaces. +</li> +</ul> + +<ul> +<li>Empty item with trailing TAB. +</li> +</ul> + +</section> +<section> +<h2>Closing: EOF closes the lists</h2> + +<ul> +<li>If the end of the file (EOF) is hit, + <ul> + <li>all the currently opened list are closed, + <ul> + <li>just like when using the two blank lines. + </li> + </ul> + </li> + </ul> +</li> +</ul> + +</section> +</section> +</div> +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc list.t2t --> +</article></body></html> diff --git a/test/marks/ok/numlist.html b/test/marks/ok/numlist.html new file mode 100644 index 0000000..ac6cfef --- /dev/null +++ b/test/marks/ok/numlist.html @@ -0,0 +1,425 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Items: Prefixed by plus</h2> + +<ol> +<li>Use the plus to prefix list items. +</li> +<li>There must be one space after the plus. +</li> +<li>The list is closed by two consecutive blank lines. +</li> +</ol> + +</section> +<section> +<h2>Items: Free leading spacing (indentation)</h2> + + <ol> + <li>The list can be indented on the source document. + </li> + <li>You can use any number of spaces. + </li> + <li>The result will be the same. + </li> + </ol> + +</section> +<section> +<h2>Items: Vertical spacing between items</h2> + +<ol> +<li>Let one blank line between the list items. +<p></p> +</li> +<li>It will be maintained on the conversion. +<p></p> +</li> +<li>Some targets don't support this behavior. +<p></p> +</li> +<li>This one was separated by a line with blanks. + You can also put a blank line inside +<p></p> + the item contents and it will be preserved. +</li> +</ol> + +</section> +<section> +<h2>Items: Exactly ONE space after the plus</h2> + +<p> ++This is not a list (no space) +</p> +<p> ++ This is not a list (more than one space) +</p> +<p> ++ This is not a list (a TAB instead the space) +</p> + +</section> +<section> +<h2>Items: Catchy cases</h2> + +<ol> +<li>- This is a list +</li> +<li>+ This is a list +</li> +<li>: This is a list +</li> +</ol> + +</section> +<section> +<h2>Nesting: Creating sublists</h2> + +<ol> +<li>This is the "mother" list first item. +</li> +<li>Here is the second, but inside this item, + <ol> + <li>there is a sublist, with its own items. + </li> + <li>Note that the items of the same sublist + </li> + <li>must have the same indentation. + <ol> + <li>And this can go on, opening sublists. + <ol> + <li>Just add leading spaces before the + </li> + <li>plus and sublists will be opened. + </li> + <li>The two blank lines closes them all. + </li> + </ol> + </li> + </ol> + </li> + </ol> +</li> +</ol> + +</section> +<section> +<h2>Nesting: Free leading spacing (indentation)</h2> + +<ol> +<li>When nesting lists, the additional spaces are free. + <ol> + <li>You can add just one, + <ol> + <li>or many. + <ol> + <li>What matters is to put more than the previous. + </li> + <li>But remember that the other items of the same list + </li> + <li>must use the same indentation. + </li> + </ol> + </li> + </ol> + </li> + </ol> +</li> +</ol> + +</section> +<section> +<h2>Nesting: Maximum depth</h2> + +<ol> +<li>There is not a depth limit, + <ol> + <li>you can go deeper and deeper. + <ol> + <li>But some targets may have restrictions. + <ol> + <li>The LaTeX maximum is here, 4 levels. + <ol> + <li>This one and the following sublists + <ol> + <li>are moved up to the level 4 + <ol> + <li>when converting to LaTeX. + <ol> + <li>On the other targets, + <ol> + <li>it is just fine + <ol> + <li>to have a very deep list. + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> + </li> + </ol> +</li> +</ol> + +</section> +<section> +<h2>Nesting: Reverse doesn't work</h2> + + <ol> + <li>Reverse nesting doesn't work. + </li> + </ol> + + <ol> + <li>Because a sublist *must* have a mother list. + </li> + </ol> + + <ol> + <li>It's the list concept, not a txt2tags limitation. + </li> + </ol> + + <ol> + <li>All this sublists will be bumped to mother lists. + </li> + </ol> + +<ol> +<li>At level 1, like this one. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Going deeper and back</h2> + +<ol> +<li>Level 1 + <ol> + <li>Level 2 + <ol> + <li>Level 3 + <ol> + <li>Level 4 + </li> + </ol> + </li> + <li>Level 3 -- (closed Level 4) + </li> + </ol> + </li> + <li>Level 2 -- (closed Level 3) + </li> + </ol> +</li> +<li>Level 1 -- (closed Level 2) +</li> +</ol> + +<ol> +<li>Level 1 + <ol> + <li>Level 2 + <ol> + <li>Level 3 + <ol> + <li>Level 4 + </li> + </ol> + </li> + </ol> + </li> + </ol> +</li> +<li>Level 1 -- (closed Level 4, Level 3 and Level 2) +</li> +</ol> + +</section> +<section> +<h2>Nesting: Vertical spacing between lists</h2> + +<ol> +<li>Level 1 +<p></p> + <ol> + <li>Level 2 -- blank BEFORE and AFTER (in) + <p></p> + <ol> + <li>Level 3 + <ol> + <li>Level 4 + </li> + </ol> + </li> + <li>Level 3 + <p></p> + </li> + </ol> + </li> + <li>Level 2 -- blank BEFORE and AFTER (out) + <p></p> + </li> + </ol> +</li> +<li>Level 1 +<p></p> + <ol> + <li>Level 2 -- blank BEFORE (spaces) and AFTER (TAB) + <p></p> + <ol> + <li>Level 3 + </li> + </ol> + </li> + </ol> +</li> +</ol> + +</section> +<section> +<h2>Nesting: Messing up</h2> + +<ol> +<li>Level 1 + <ol> + <li>Level 2 + <ol> + <li>Level 3 + <ol> + <li>Level 4 + </li> + </ol> + </li> + <li>Level 3.5 ??? + </li> + <li>Level 3 + </li> + </ol> + </li> + <li>Level 2.5 ??? + </li> + <li>Level 2 + </li> + </ol> +</li> +<li>Level 1.5 ??? +</li> +<li>Level 1 +</li> +</ol> + +</section> +<section> +<h2>Closing: Two (not so) empty lines</h2> + +<ol> +<li>This list is closed by a line with spaces and other with TABs +</li> +</ol> + +<ol> +<li>This list is NOT closed by two comment lines +</li> +<li>This list is closed by a line with spaces and TAB, +</li> +<li>then a comment line, then an empty line. +</li> +</ol> + +</section> +<section> +<h2>Closing: Empty item closes current (sub)list</h2> + +<ol> +<li>Level 1 + <ol> + <li>Level 2 + <ol> + <li>Level 3 + </li> + </ol> + Level 2 + </li> + </ol> + Level 1 +</li> +</ol> + +<ol> +<li>Empty item with trailing spaces. +</li> +</ol> + +<ol> +<li>Empty item with trailing TAB. +</li> +</ol> + +</section> +<section> +<h2>Closing: EOF closes the lists</h2> + +<ol> +<li>If the end of the file (EOF) is hit, + <ol> + <li>all the currently opened list are closed, + <ol> + <li>just like when using the two blank lines. + </li> + </ol> + </li> + </ol> +</li> +</ol> + +</section> +</section> +</div> +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -C config -o numlist.html list.t2t --> +</article></body></html> diff --git a/test/marks/ok/numtitle.html b/test/marks/ok/numtitle.html new file mode 100644 index 0000000..e0f65f8 --- /dev/null +++ b/test/marks/ok/numtitle.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>0.1. Syntax: Balanced plus signs (from 1 to 5)</h2> + +</section> +</section> +<section> +<h1>1. Title Level 1</h1> + +<section> +<h2>1.1. Title Level 2</h2> + +<section> +<h3>1.1.1. Title Level 3</h3> + +<section> +<h4>1.1.1.1. Title Level 4</h4> + +<section> +<h5>1.1.1.1.1. Title Level 5</h5> + +</section> +</section> +</section> +</section> +<section> +<h2>1.2. Label: Between brackets, alphanumeric [A-Za-z0-9_-]</h2> + +</section> +</section> +<section id="lab_el-1"> +<h1>2. Title Level 1</h1> + +<section id="lab_el-2"> +<h2>2.1. Title Level 2</h2> + +<section id="lab_el-3"> +<h3>2.1.1. Title Level 3</h3> + +<section id="lab_el-4"> +<h4>2.1.1.1. Title Level 4</h4> + +<section id="lab_el-5"> +<h5>2.1.1.1.1. Title Level 5</h5> + +</section> +</section> +</section> +</section> +<section> +<h2>2.2. Syntax: Spaces around and/or inside are allowed (and ignored)</h2> + +<section> +<h3>2.2.1. Title Level 3</h3> + +</section> +<section> +<h3>2.2.2. Title Level 3</h3> + +</section> +<section> +<h3>2.2.3. Title Level 3</h3> + +</section> +<section> +<h3>2.2.4. Title Level 3</h3> + +</section> +<section> +<h3>2.2.5. Title Level 3</h3> + +</section> +<section id="lab_el-9"> +<h3>2.2.6. Title Level 3</h3> + +</section> +</section> +<section> +<h2>2.3. Invalid: Unbalanced plus signs</h2> + +<p> + +Not Title +</p> +<p> + ++Not Title+ +</p> +<p> + +++Not Title++++ +</p> + +</section> +<section> +<h2>2.4. Invalid: Level deeper than 5</h2> + +<p> + ++++++Not Title 6++++++ +</p> +<p> ++++++++Not Title 7+++++++ +</p> + +</section> +<section> +<h2>2.5. Invalid: Space between title and label</h2> + +<p> ++Not Title+ [label1] +</p> + +</section> +<section> +<h2>2.6. Invalid: Space inside label</h2> + +<p> ++Not Title+[ label ] +</p> + +</section> +<section> +<h2>2.7. Invalid: Strange chars inside label</h2> + +<p> ++Not Title+[la/bel] +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -C config -o numtitle.html title.t2t --> +</article></body></html> diff --git a/test/marks/ok/paragraph.html b/test/marks/ok/paragraph.html new file mode 100644 index 0000000..98dbba4 --- /dev/null +++ b/test/marks/ok/paragraph.html @@ -0,0 +1,73 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: Lines grouped together</h2> + +<p> +A paragraph is composed by one or more lines. +A blank line (or a table, or a list) ends the +current paragraph. +</p> + +</section> +<section> +<h2>Syntax: Leading and trailing spaces are ignored</h2> + +<p> + Leading and trailing spaces are ignored. +</p> + +</section> +<section> +<h2>Syntax: A comment don't close a paragraph</h2> + +<p> +A comment line can be placed inside a paragraph. +It will not affect it. +</p> + +</section> +<section> +<h2>Closing: EOF closes the open paragraph</h2> + +<p> +The end of the file (EOF) closes the +currently open paragraph. +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc paragraph.t2t --> +</article></body></html> diff --git a/test/marks/ok/quote.html b/test/marks/ok/quote.html new file mode 100644 index 0000000..ef0db8e --- /dev/null +++ b/test/marks/ok/quote.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: TAB defines quote</h2> + + <blockquote> + To quote a paragraph, just prefix it by a TAB + character. All the lines of the paragraph must + begin with a TAB. + </blockquote> +<p> +Any non-tabbed line closes the quote block. +</p> + +</section> +<section> +<h2>Nesting: Creating deeper quotes</h2> + + <blockquote> + The number of leading TABs identifies the quote + block depth. This is quote level 1. + <blockquote> + With two TABs, we are on the quote + level 2. + <blockquote> + The more TABs, more deep is + the quote level. + <blockquote> + There isn't a limit. + </blockquote> + </blockquote> + </blockquote> + </blockquote> + +</section> +<section> +<h2>Nesting: Reverse nesting works</h2> + + <blockquote> + <blockquote> + <blockquote> + <blockquote> + This quote starts at + level 4. + </blockquote> + Then its depth is decreased. + </blockquote> + Counting down, one by one. + </blockquote> + Until the level 1. + </blockquote> + +</section> +<section> +<h2>Nesting: Random count</h2> + + <blockquote> + <blockquote> + <blockquote> + Unlike lists, any quote block is + independent, not part of a tree. + </blockquote> + </blockquote> + The TAB count don't need to be incremental + by one. + <blockquote> + <blockquote> + <blockquote> + The nesting don't need + to follow any rule. + </blockquote> + </blockquote> + Quotes can be opened and closed + in any way. + <blockquote> + <blockquote> + <blockquote> + You choose. + </blockquote> + </blockquote> + </blockquote> + </blockquote> + </blockquote> + +</section> +<section> +<h2>Nesting: When not supported</h2> + + <blockquote> + Some targets (as sgml) don't support the + nesting of quotes. There is only one quote + level. + <blockquote> + In this case, no matter how much + TABs are used to define the quote + block, it always will be level 1. + </blockquote> + </blockquote> + +</section> +<section> +<h2>Syntax: Spaces after TAB</h2> + + <blockquote> + Spaces AFTER the TAB character are allowed. + But be careful, it can be confusing. + </blockquote> + +</section> +<section> +<h2>Invalid: Spaces before TAB</h2> + +<p> + Spaces BEFORE the TAB character + invalidate the mark. It's not quote. +</p> + +</section> +<section> +<h2>Invalid: Paragraphs inside</h2> + + <blockquote> + Paragraph breaks inside a quote aren't + possible. + </blockquote> + <blockquote> + This sample are two separated quoted + paragraphs, not a quote block with + two paragraphs inside. + </blockquote> + +</section> +<section> +<h2>Closing: EOF closes the open block</h2> + + <blockquote> + The end of the file (EOF) closes the + currently open quote block. + </blockquote> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc quote.t2t --> +</article></body></html> diff --git a/test/marks/ok/raw.html b/test/marks/ok/raw.html new file mode 100644 index 0000000..e7ddd40 --- /dev/null +++ b/test/marks/ok/raw.html @@ -0,0 +1,90 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: A single line</h2> + +A raw line. + +</section> +<section> +<h2>Syntax: A single line with leading spaces</h2> + + Another raw line, with leading spaces. + +</section> +<section> +<h2>Syntax: Area (block)</h2> + +A raw area delimited + by lines with marks. + +</section> +<section> +<h2>Syntax: Area (block) with trailing spaces</h2> + +Trailing spaces and TABs after the area marks +are allowed, but not encouraged nor documented. + +</section> +<section> +<h2>Invalid: No space between mark and contents</h2> + +<p> +"""Not a raw line, need one space after mark. +</p> + +</section> +<section> +<h2>Invalid: Leading spaces on block marks</h2> + +<p> + """ + Not a raw area. + The marks must be at the line beginning, + no leading spaces. + """ +</p> + +</section> +<section> +<h2>Closing: EOF closes the open block</h2> + +The end of the file (EOF) closes +the currently open raw area. +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -C config -o raw.html verbatim.t2t --> +</article></body></html> diff --git a/test/marks/ok/table.html b/test/marks/ok/table.html new file mode 100644 index 0000000..1fae227 --- /dev/null +++ b/test/marks/ok/table.html @@ -0,0 +1,413 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: Lines starting with a pipe |</h2> + +<table> +<tr> +<td>Cell 1</td> +</tr> +</table> + +</section> +<section> +<h2>Syntax: Extra pipes separate cells</h2> + +<table> +<tr> +<td>Cell 1</td> +<td>Cell 2</td> +<td>Cell 3</td> +</tr> +</table> + +</section> +<section> +<h2>Syntax: With a trailing pipe, make border</h2> + +<table class="tableborder"> +<tr> +<td>Cell 1</td> +<td>Cell 2</td> +<td>Cell 3</td> +</tr> +</table> + +</section> +<section> +<h2>Syntax: Table lines starting with double pipe are heading</h2> + +<table class="tableborder"> +<tr> +<th>Cell 1</th> +<th>Cell 2</th> +<th>Cell 3</th> +</tr> +</table> + +</section> +<section> +<h2>Align: Spaces before the leading pipe centralize the table</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td>Cell 1</td> +<td>Cell 2</td> +<td>Cell 3</td> +</tr> +</table> + +</section> +<section> +<h2>Align: Spaces inside the cell denote its alignment</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<th>Heading</th> +<th>Heading</th> +<th>Heading</th> +</tr> +<tr> +<td><-</td> +<td class="center">--</td> +<td class="right">-></td> +</tr> +<tr> +<td class="center">--</td> +<td class="center">--</td> +<td class="center">--</td> +</tr> +<tr> +<td class="right">-></td> +<td class="center">--</td> +<td><-</td> +</tr> +</table> + +</section> +<section> +<h2>Span: Column span is defined by extra pipes at cell closing</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<th>1</th> +<th>2</th> +<th colspan="2">3+4</th> +</tr> +<tr> +<td class="center">1</td> +<td class="center">2</td> +<td class="center">3</td> +<td class="center">4</td> +</tr> +<tr> +<td class="center" colspan="3">1+2+3</td> +<td class="center">4</td> +</tr> +<tr> +<td class="center">1</td> +<td class="center" colspan="2">2+3</td> +<td class="center">4</td> +</tr> +<tr> +<td class="center" colspan="4">1+2+3+4</td> +</tr> +</table> + +</section> +<section> +<h2>Test: Empty cells are placed as expected</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td>0</td> +<td>1</td> +<td>2</td> +<td></td> +</tr> +<tr> +<td>4</td> +<td>5</td> +<td></td> +<td>7</td> +</tr> +<tr> +<td>8</td> +<td></td> +<td>A</td> +<td>B</td> +</tr> +<tr> +<td></td> +<td>D</td> +<td>E</td> +<td>F</td> +</tr> +</table> + +</section> +<section> +<h2>Test: Lines with different number of cells</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td>1</td> +</tr> +<tr> +<td>1</td> +<td>2</td> +</tr> +<tr> +<td>1</td> +<td>2</td> +<td>3</td> +</tr> +<tr> +<td>1</td> +<td>2</td> +<td>3</td> +<td>4</td> +</tr> +<tr> +<td>1</td> +<td>2</td> +<td>3</td> +<td>4</td> +<td>5</td> +</tr> +</table> + +</section> +<section> +<h2>Test: Empty cells + Span + Messy cell number = Fun!</h2> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td class="right">Jan</td> +</tr> +<tr> +<td class="right" colspan="2">Fev</td> +</tr> +<tr> +<td class="right" colspan="3">Mar</td> +</tr> +<tr> +<td class="right" colspan="4">Apr</td> +</tr> +<tr> +<td class="right" colspan="5">May</td> +</tr> +<tr> +<td class="center">20%</td> +<td class="center">40%</td> +<td class="center">60%</td> +<td class="center">80%</td> +<td class="center">100%</td> +</tr> +</table> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td></td> +<td></td> +<td class="center">/</td> +<td></td> +<td></td> +</tr> +<tr> +<td></td> +<td class="center" colspan="3">/ / / / /</td> +<td></td> +</tr> +<tr> +<td class="center" colspan="5">/ / / / / / / / /</td> +</tr> +<tr> +<td></td> +<td class="center">o</td> +<td></td> +<td class="center">o</td> +<td></td> +</tr> +<tr> +<td></td> +<td></td> +<td class="right">.</td> +<td></td> +<td></td> +</tr> +<tr> +<td></td> +<td class="center" colspan="3">= = = =</td> +<td></td> +</tr> +</table> + +<table style="margin-left: auto; margin-right: auto;" class="tableborder"> +<tr> +<td>01</td> +<td>02</td> +<td></td> +<td></td> +<td>05</td> +<td></td> +<td>07</td> +<td></td> +</tr> +<tr> +<td></td> +<td></td> +<td>11</td> +<td></td> +<td>13</td> +<td></td> +<td></td> +<td>16</td> +</tr> +<tr> +<td>17</td> +<td></td> +<td>19</td> +<td>20</td> +<td></td> +<td></td> +<td>23</td> +<td></td> +</tr> +<tr> +<td>25</td> +<td>26</td> +<td></td> +<td></td> +<td>29</td> +<td>30</td> +<td></td> +<td>32</td> +</tr> +<tr> +<td></td> +<td></td> +<td>35</td> +<td></td> +<td>37</td> +<td></td> +<td>39</td> +<td>40</td> +</tr> +</table> + +</section> +<section> +<h2>Test: Lots of cells at the same line</h2> + +<table class="tableborder"> +<tr> +<td>0</td> +<td>1</td> +<td>2</td> +<td>3</td> +<td>4</td> +<td>5</td> +<td>6</td> +<td>7</td> +<td>8</td> +<td>9</td> +<td>A</td> +<td>B</td> +<td>C</td> +<td>D</td> +<td>E</td> +<td>F</td> +<td>0</td> +<td>1</td> +<td>2</td> +<td>3</td> +<td>4</td> +<td>5</td> +<td>6</td> +<td>7</td> +<td>8</td> +<td>9</td> +<td>A</td> +<td>B</td> +<td>C</td> +<td>D</td> +<td>E</td> +<td>F</td> +</tr> +</table> + +</section> +<section> +<h2>Test: Empty lines</h2> + +<table class="tableborder"> +<tr> +<td></td> +</tr> +<tr> +<td></td> +</tr> +<tr> +<td></td> +</tr> +</table> + +</section> +<section> +<h2>Invalid: There must be at least one space around the pipe</h2> + +<p> +|this|is|not|a|table| +</p> +<p> +|this| is| not| a| table| +</p> +<p> +|this |is |not |a |table | +</p> + +</section> +<section> +<h2>Invalid: You must use spaces, not TABs</h2> + +<p> +| this | is | not | a | table | +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc table.t2t --> +</article></body></html> diff --git a/test/marks/ok/tagged.html b/test/marks/ok/tagged.html new file mode 100644 index 0000000..1b1d08c --- /dev/null +++ b/test/marks/ok/tagged.html @@ -0,0 +1,90 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: A single line</h2> + +A tagged line. + +</section> +<section> +<h2>Syntax: A single line with leading spaces</h2> + + Another tagged line, with leading spaces. + +</section> +<section> +<h2>Syntax: Area (block)</h2> + +A tagged area delimited + by lines with marks. + +</section> +<section> +<h2>Syntax: Area (block) with trailing spaces</h2> + +Trailing spaces and TABs after the area marks +are allowed, but not encouraged nor documented. + +</section> +<section> +<h2>Invalid: No space between mark and contents</h2> + +<p> +'''Not a tagged line, need one space after mark. +</p> + +</section> +<section> +<h2>Invalid: Leading spaces on block marks</h2> + +<p> + ''' + Not a tagged area. + The marks must be at the line beginning, + no leading spaces. + ''' +</p> + +</section> +<section> +<h2>Closing: EOF closes the open block</h2> + +The end of the file (EOF) closes +the currently open tagged area. +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc -C config -o tagged.html verbatim.t2t --> +</article></body></html> diff --git a/test/marks/ok/title.html b/test/marks/ok/title.html new file mode 100644 index 0000000..fd491dd --- /dev/null +++ b/test/marks/ok/title.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: Balanced equal signs (from 1 to 5)</h2> + +</section> +</section> +<section> +<h1>Title Level 1</h1> + +<section> +<h2>Title Level 2</h2> + +<section> +<h3>Title Level 3</h3> + +<section> +<h4>Title Level 4</h4> + +<section> +<h5>Title Level 5</h5> + +</section> +</section> +</section> +</section> +<section> +<h2>Label: Between brackets, alphanumeric [A-Za-z0-9_-]</h2> + +</section> +</section> +<section id="lab_el-1"> +<h1>Title Level 1</h1> + +<section id="lab_el-2"> +<h2>Title Level 2</h2> + +<section id="lab_el-3"> +<h3>Title Level 3</h3> + +<section id="lab_el-4"> +<h4>Title Level 4</h4> + +<section id="lab_el-5"> +<h5>Title Level 5</h5> + +</section> +</section> +</section> +</section> +<section> +<h2>Syntax: Spaces around and/or inside are allowed (and ignored)</h2> + +<section> +<h3>Title Level 3</h3> + +</section> +<section> +<h3>Title Level 3</h3> + +</section> +<section> +<h3>Title Level 3</h3> + +</section> +<section> +<h3>Title Level 3</h3> + +</section> +<section> +<h3>Title Level 3</h3> + +</section> +<section id="lab_el-9"> +<h3>Title Level 3</h3> + +</section> +</section> +<section> +<h2>Invalid: Unbalanced equal signs</h2> + +<p> + =Not Title +</p> +<p> + ==Not Title= +</p> +<p> + ===Not Title==== +</p> + +</section> +<section> +<h2>Invalid: Level deeper than 5</h2> + +<p> + ======Not Title 6====== +</p> +<p> +=======Not Title 7======= +</p> + +</section> +<section> +<h2>Invalid: Space between title and label</h2> + +<p> +=Not Title= [label1] +</p> + +</section> +<section> +<h2>Invalid: Space inside label</h2> + +<p> +=Not Title=[ label ] +</p> + +</section> +<section> +<h2>Invalid: Strange chars inside label</h2> + +<p> +=Not Title=[la/bel] +</p> +</section> +</section> +</div> + +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc title.t2t --> +</article></body></html> diff --git a/test/marks/ok/verbatim.html b/test/marks/ok/verbatim.html new file mode 100644 index 0000000..6b8edb0 --- /dev/null +++ b/test/marks/ok/verbatim.html @@ -0,0 +1,100 @@ +<!DOCTYPE html> +<html> +<head> +<meta name="generator" content="http://txt2tags.org"> +<style> +body{background-color:#fff;color:#000;} +hr{background-color:#000;border:0;color:#000;} +hr.heavy{height:5px;} +hr.light{height:1px;} +img{border:0;display:block;} +img.right{margin:0 0 0 auto;} +img.center{border:0;margin:0 auto;} +table th,table td{padding:4px;} +.center,header{text-align:center;} +table.center {margin-left:auto; margin-right:auto;} +.right{text-align:right;} +.left{text-align:left;} +.tableborder,.tableborder td,.tableborder th{border:1px solid #000;} +.underline{text-decoration:underline;} +</style> +</head> +<body> +<header> +<hgroup> +</hgroup> +</header> +<article> + +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Syntax: A single line</h2> + +<pre> +A verbatim line. +</pre> + +</section> +<section> +<h2>Syntax: A single line with leading spaces</h2> + +<pre> + Another verbatim line, with leading spaces. +</pre> + +</section> +<section> +<h2>Syntax: Area (block)</h2> + +<pre> +A verbatim area delimited + by lines with marks. +</pre> + +</section> +<section> +<h2>Syntax: Area (block) with trailing spaces</h2> + +<pre> +Trailing spaces and TABs after the area marks +are allowed, but not encouraged nor documented. +</pre> + +</section> +<section> +<h2>Invalid: No space between mark and contents</h2> + +<p> +```Not a verbatim line, need one space after mark. +</p> + +</section> +<section> +<h2>Invalid: Leading spaces on block marks</h2> + +<p> + ``` + Not a verbatim area. + The marks must be at the line beginning, + no leading spaces. + ``` +</p> + +</section> +<section> +<h2>Closing: EOF closes the open block</h2> + +<pre> +The end of the file (EOF) closes +the currently open verbatim area. +</pre> + +</section> +</section> +</div> +<!-- html code generated by txt2tags (http://txt2tags.org) --> +<!-- cmdline: txt2tags -q -\-no-rc verbatim.t2t --> +</article></body></html> diff --git a/test/marks/paragraph.t2t b/test/marks/paragraph.t2t new file mode 100644 index 0000000..3bb6308 --- /dev/null +++ b/test/marks/paragraph.t2t @@ -0,0 +1,20 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: Lines grouped together +A paragraph is composed by one or more lines. +A blank line (or a table, or a list) ends the +current paragraph. + +%%% Syntax: Leading and trailing spaces are ignored + Leading and trailing spaces are ignored. + +%%% Syntax: A comment don't close a paragraph +A comment line can be placed inside a paragraph. +% this comment will be ignored +It will not affect it. + +%%% Closing: EOF closes the open paragraph +The end of the file (EOF) closes the +currently open paragraph. diff --git a/test/marks/quote.t2t b/test/marks/quote.t2t new file mode 100644 index 0000000..b81676e --- /dev/null +++ b/test/marks/quote.t2t @@ -0,0 +1,64 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: TAB defines quote + To quote a paragraph, just prefix it by a TAB + character. All the lines of the paragraph must + begin with a TAB. +Any non-tabbed line closes the quote block. + +%%% Nesting: Creating deeper quotes + The number of leading TABs identifies the quote + block depth. This is quote level 1. + With two TABs, we are on the quote + level 2. + The more TABs, more deep is + the quote level. + There isn't a limit. + +%%% Nesting: Reverse nesting works + This quote starts at + level 4. + Then its depth is decreased. + Counting down, one by one. + Until the level 1. + +%%% Nesting: Random count + Unlike lists, any quote block is + independent, not part of a tree. + The TAB count don't need to be incremental + by one. + The nesting don't need + to follow any rule. + Quotes can be opened and closed + in any way. + You choose. + +%%% Nesting: When not supported + Some targets (as sgml) don't support the + nesting of quotes. There is only one quote + level. + In this case, no matter how much + TABs are used to define the quote + block, it always will be level 1. + +%%% Syntax: Spaces after TAB + Spaces AFTER the TAB character are allowed. + But be careful, it can be confusing. + +%%% Invalid: Spaces before TAB + Spaces BEFORE the TAB character + invalidate the mark. It's not quote. + +%%% Invalid: Paragraphs inside + Paragraph breaks inside a quote aren't + possible. + + This sample are two separated quoted + paragraphs, not a quote block with + two paragraphs inside. + +%%% Closing: EOF closes the open block + The end of the file (EOF) closes the + currently open quote block. diff --git a/test/marks/run.py b/test/marks/run.py new file mode 100644 index 0000000..ebb1d3f --- /dev/null +++ b/test/marks/run.py @@ -0,0 +1,69 @@ +# +# txt2tags marks parsing tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +import glob +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# left files are generated from right ones (using smart filters) +ALIASES = { + "numlist": "list", + "deflist": "list", + "numtitle": "title", + "raw": "verbatim", + "tagged": "verbatim", +} + +# smart filters to allow source inheritance +FILTERS = { + "deflist": [("pre", "hyphen", "colon"), ("pre", "^( *)-", r"\1:")], + "numlist": [("pre", "hyphen", "plus"), ("pre", "^( *)-", r"\1+")], + "numtitle": [("pre", "equal", "plus"), ("pre", "=", "+")], + "raw": [("pre", "verbatim", "raw"), ("pre", "`", '"')], + "tagged": [("pre", "verbatim", "tagged"), ("pre", "`", "'")], +} + + +# convert FILTERS tuples to txt2tags pre/postproc rules +def addFilters(filters): + if not filters: + return [] + config = [] + cmdline = [] + for filter in filters: + config.append( + "%%!%sproc: '%s' %s" % filter + ) # don't quote 2nd -- breaks tagged filter + if config: + lib.WriteFile(lib.CONFIG_FILE, "\n".join(config)) + cmdline = ["-C", lib.CONFIG_FILE] + return cmdline + + +def run(): + # test all .t2t files found + for infile in glob.glob("*.t2t"): + basename = infile.replace(".t2t", "") + outfile = basename + ".html" + if lib.initTest(basename, infile, outfile): + cmdline = addFilters(FILTERS.get(basename)) + cmdline.append(infile) + lib.test(cmdline, outfile) + # using smart filters, same files generate more than one output + for alias in ALIASES: + infile = ALIASES[alias] + ".t2t" + outfile = alias + ".html" + if lib.initTest(alias, infile, outfile): + cmdline = addFilters(FILTERS.get(alias)) + cmdline.extend(["-o", outfile, infile]) + lib.test(cmdline, outfile) + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/marks/table.t2t b/test/marks/table.t2t new file mode 100644 index 0000000..c1ed4f7 --- /dev/null +++ b/test/marks/table.t2t @@ -0,0 +1,84 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: Lines starting with a pipe | +| Cell 1 + +%%% Syntax: Extra pipes separate cells +| Cell 1 | Cell 2 | Cell 3 + +%%% Syntax: With a trailing pipe, make border +| Cell 1 | Cell 2 | Cell 3 | + +%%% Syntax: Table lines starting with double pipe are heading +|| Cell 1 | Cell 2 | Cell 3 | + +%%% Align: Spaces before the leading pipe centralize the table + | Cell 1 | Cell 2 | Cell 3 | + +%%% Align: Spaces inside the cell denote its alignment + || Heading | Heading | Heading | +% comments don't close an opened table + | <- | -- | -> | + | -- | -- | -- | + | -> | -- | <- | + +%%% Span: Column span is defined by extra pipes at cell closing + || 1 | 2 | 3+4 || + | 1 | 2 | 3 | 4 | + | 1+2+3 ||| 4 | + | 1 | 2+3 || 4 | + | 1+2+3+4 |||| + +%%% Test: Empty cells are placed as expected + | 0 | 1 | 2 | | + | 4 | 5 | | 7 | + | 8 | | A | B | + | | D | E | F | + +%%% Test: Lines with different number of cells + | 1 | + | 1 | 2 | + | 1 | 2 | 3 | + | 1 | 2 | 3 | 4 | + | 1 | 2 | 3 | 4 | 5 | + +%%% Test: Empty cells + Span + Messy cell number = Fun! + | Jan | + | Fev || + | Mar ||| + | Apr |||| + | May ||||| + | 20% | 40% | 60% | 80% | 100% | + + | | | / | | | + | | / / / / / ||| | + | / / / / / / / / / ||||| + | | o | | o | | + | | | . | | | + | | = = = = ||| | + + | 01 | 02 | | | 05 | | 07 | | + | | | 11 | | 13 | | | 16 | + | 17 | | 19 | 20 | | | 23 | | + | 25 | 26 | | | 29 | 30 | | 32 | + | | | 35 | | 37 | | 39 | 40 | + +%%% Test: Lots of cells at the same line +| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | + +%%% Test: Empty lines +| | +| | +| | + +%%% Invalid: There must be at least one space around the pipe +|this|is|not|a|table| + +|this| is| not| a| table| + +|this |is |not |a |table | + +%%% Invalid: You must use spaces, not TABs +| this | is | not | a | table | diff --git a/test/marks/test.conf b/test/marks/test.conf new file mode 100644 index 0000000..dc25204 --- /dev/null +++ b/test/marks/test.conf @@ -0,0 +1,16 @@ + +%!target: html +% Convert comments to titles +%!preproc : '^%%% ([^ \t].*)' '== \1 ==' +% Trick to ensure the body init (don't loose comments) +%!preproc : '^BODYINIT$' '' +% The real path to the image +%!preproc : 'img\.png' '../samples/img/t2tbutton.png' +% Line break before each inline test +%!postproc: '^i\)' '@@@@' +% Add the line breaks +%!postproc: '@@@@' '<br>' +% Remove txt2tags version information +%!postproc: '(generated by txt2tags) [^ ]+' '\1' + +% vim: ft=txt2tags diff --git a/test/marks/title.t2t b/test/marks/title.t2t new file mode 100644 index 0000000..15dad8a --- /dev/null +++ b/test/marks/title.t2t @@ -0,0 +1,39 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: Balanced equal signs (from 1 to 5) += Title Level 1 = +== Title Level 2 == +=== Title Level 3 === +==== Title Level 4 ==== +===== Title Level 5 ===== +%%% Label: Between brackets, alphanumeric [A-Za-z0-9_-] += Title Level 1 =[lab_el-1] +== Title Level 2 ==[lab_el-2] +=== Title Level 3 ===[lab_el-3] +==== Title Level 4 ====[lab_el-4] +===== Title Level 5 =====[lab_el-5] +%%% Syntax: Spaces around and/or inside are allowed (and ignored) + ===Title Level 3=== + === Title Level 3 === + === Title Level 3 === +=== Title Level 3 === +=== Title Level 3 === + === Title Level 3 ===[lab_el-9] +%%% Invalid: Unbalanced equal signs + =Not Title + + ==Not Title= + + ===Not Title==== +%%% Invalid: Level deeper than 5 + ======Not Title 6====== + +=======Not Title 7======= +%%% Invalid: Space between title and label +=Not Title= [label1] +%%% Invalid: Space inside label +=Not Title=[ label ] +%%% Invalid: Strange chars inside label +=Not Title=[la/bel] diff --git a/test/marks/verbatim.t2t b/test/marks/verbatim.t2t new file mode 100644 index 0000000..be3e030 --- /dev/null +++ b/test/marks/verbatim.t2t @@ -0,0 +1,36 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Syntax: A single line +``` A verbatim line. + +%%% Syntax: A single line with leading spaces +``` Another verbatim line, with leading spaces. + +%%% Syntax: Area (block) +``` +A verbatim area delimited + by lines with marks. +``` + +%%% Syntax: Area (block) with trailing spaces +``` +Trailing spaces and TABs after the area marks +are allowed, but not encouraged nor documented. +``` + +%%% Invalid: No space between mark and contents +```Not a verbatim line, need one space after mark. + +%%% Invalid: Leading spaces on block marks + ``` + Not a verbatim area. + The marks must be at the line beginning, + no leading spaces. + ``` + +%%% Closing: EOF closes the open block +``` +The end of the file (EOF) closes +the currently open verbatim area. diff --git a/test/nesting/list.t2t b/test/nesting/list.t2t new file mode 100644 index 0000000..89fcee5 --- /dev/null +++ b/test/nesting/list.t2t @@ -0,0 +1,80 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Nesting: Title inside is ignored +- Line 1. +- = No title tags here. = +- Line 3. +- +%%% Nesting: Paragraph inside is normal +- Line 1. +- Line 2. +- Line 3. +- +%%% Nesting: Line inside is ignored (becomes strike) +- Line 1. +- ------------------------------------------- +- Line 3. +- +%%% Nesting: Comment Line inside is ignored +- Line 1. +- % You're seeing this. +- Line 3. +- +%%% Nesting: Comment Block inside is ignored +- Line 1. +- %%% +- You're seeing this. +- %%% +- Line 3. +- +%%% Nesting: Raw Line inside is ignored +- Line 1. +- """ No raw here. +- Line 3. +- +%%% Nesting: Raw Block inside is ignored +- Line 1. +- """ +- No raw here. +- """ +- Line 3. +- +%%% Nesting: Verbatim Line inside is ignored +- Line 1. +- ``` No verbatim line here. +- Line 3. +- +%%% Nesting: Verbatim Block inside is ignored +- Line 1. +- ``` +- No verbatim here. +- ``` +- Line 3. +- +%%% Nesting: Quote inside is ignored +- Line 1. +- No quote here. +- Line 3. +- +%%% Nesting: List inside is ignored +- Line 1. +- - No list tags here. +- Line 3. +- +%%% Nesting: Numbered List inside is ignored +- Line 1. +- + No numbered list tags here. +- Line 3. +- +%%% Nesting: Definition List inside is ignored +- Line 1. +- : No definition term tags here. +- Line 3. +- +%%% Nesting: Table inside is ignored +- Line 1. +- | No table here. +- Line 3. +- diff --git a/test/nesting/ok/deflist.html b/test/nesting/ok/deflist.html new file mode 100644 index 0000000..e9a5c46 --- /dev/null +++ b/test/nesting/ok/deflist.html @@ -0,0 +1,200 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Nesting: Title inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>= No title tags here. =</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Paragraph inside is normal</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>Line 2.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Line inside is ignored (becomes strike)</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt><del>---------------------------------------</del></dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Comment Line inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>% You're seeing this.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Comment Block inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>%%%</dt><dd> +</dd> +<dt>You're seeing this.</dt><dd> +</dd> +<dt>%%%</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Raw Line inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>""" No raw here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Raw Block inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>"""</dt><dd> +</dd> +<dt>No raw here.</dt><dd> +</dd> +<dt>"""</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Verbatim Line inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>``` No verbatim line here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Verbatim Block inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>```</dt><dd> +</dd> +<dt>No verbatim here.</dt><dd> +</dd> +<dt>```</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Quote inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt> No quote here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: List inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>- No list tags here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Numbered List inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>+ No numbered list tags here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Definition List inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>: No definition term tags here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +<section> +<h2>Nesting: Table inside is ignored</h2> + +<dl> +<dt>Line 1.</dt><dd> +</dd> +<dt>| No table here.</dt><dd> +</dd> +<dt>Line 3.</dt><dd> +</dd> +</dl> + +</section> +</section> +</div> diff --git a/test/nesting/ok/list.html b/test/nesting/ok/list.html new file mode 100644 index 0000000..987c694 --- /dev/null +++ b/test/nesting/ok/list.html @@ -0,0 +1,200 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Nesting: Title inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>= No title tags here. = +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Paragraph inside is normal</h2> + +<ul> +<li>Line 1. +</li> +<li>Line 2. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Line inside is ignored (becomes strike)</h2> + +<ul> +<li>Line 1. +</li> +<li><del>---------------------------------------</del> +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Comment Line inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>% You're seeing this. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Comment Block inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>%%% +</li> +<li>You're seeing this. +</li> +<li>%%% +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Raw Line inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>""" No raw here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Raw Block inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>""" +</li> +<li>No raw here. +</li> +<li>""" +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Verbatim Line inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>``` No verbatim line here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Verbatim Block inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>``` +</li> +<li>No verbatim here. +</li> +<li>``` +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Quote inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li> No quote here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: List inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>- No list tags here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Numbered List inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>+ No numbered list tags here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Definition List inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>: No definition term tags here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +<section> +<h2>Nesting: Table inside is ignored</h2> + +<ul> +<li>Line 1. +</li> +<li>| No table here. +</li> +<li>Line 3. +</li> +</ul> + +</section> +</section> +</div> diff --git a/test/nesting/ok/numlist.html b/test/nesting/ok/numlist.html new file mode 100644 index 0000000..1b60727 --- /dev/null +++ b/test/nesting/ok/numlist.html @@ -0,0 +1,200 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Nesting: Title inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>= No title tags here. = +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Paragraph inside is normal</h2> + +<ol> +<li>Line 1. +</li> +<li>Line 2. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Line inside is ignored (becomes strike)</h2> + +<ol> +<li>Line 1. +</li> +<li><del>---------------------------------------</del> +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Comment Line inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>% You're seeing this. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Comment Block inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>%%% +</li> +<li>You're seeing this. +</li> +<li>%%% +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Raw Line inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>""" No raw here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Raw Block inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>""" +</li> +<li>No raw here. +</li> +<li>""" +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Verbatim Line inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>``` No verbatim line here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Verbatim Block inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>``` +</li> +<li>No verbatim here. +</li> +<li>``` +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Quote inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li> No quote here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: List inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>- No list tags here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Numbered List inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>+ No numbered list tags here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Definition List inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>: No definition term tags here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +<section> +<h2>Nesting: Table inside is ignored</h2> + +<ol> +<li>Line 1. +</li> +<li>| No table here. +</li> +<li>Line 3. +</li> +</ol> + +</section> +</section> +</div> diff --git a/test/nesting/ok/quote.html b/test/nesting/ok/quote.html new file mode 100644 index 0000000..3052ecd --- /dev/null +++ b/test/nesting/ok/quote.html @@ -0,0 +1,147 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Nesting: Title inside is plain text</h2> + + <blockquote> + Line 1. + = No title tags here. = + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Paragraph inside is parsed</h2> + + <blockquote> + Line 1. + Line 2. + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Line inside is parsed</h2> + + <blockquote> + Line 1. + + <hr class="light"> + + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Comment Line inside is plain text</h2> + + <blockquote> + Line 1. + % You're seeing this. + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Comment Block inside is plain text</h2> + + <blockquote> + Line 1. + %%% + You're seeing this. + %%% + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Raw Line inside is plain text</h2> + + <blockquote> + Line 1. + """ No raw here. + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Raw Block inside is plain text</h2> + + <blockquote> + Line 1. + """ + No raw here. + """ + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Verbatim Line inside is plain text</h2> + + <blockquote> + Line 1. + ``` No verbatim line here. + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Verbatim Block inside is plain text</h2> + + <blockquote> + Line 1. + ``` + No verbatim here. + ``` + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: List inside is plain text</h2> + + <blockquote> + Line 1. + - No list tags here. + - + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Numbered List inside is plain text</h2> + + <blockquote> + Line 1. + + No numbered list tags here. + + + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Definition List inside is plain text</h2> + + <blockquote> + Line 1. + : No definition term tags here. + No definition definition tags here. + : + Line 3. + </blockquote> + +</section> +<section> +<h2>Nesting: Table inside is plain text</h2> + + <blockquote> + Line 1. + | No table here. + Line 3. + </blockquote> +</section> +</section> +</div> diff --git a/test/nesting/ok/table.html b/test/nesting/ok/table.html new file mode 100644 index 0000000..68a2ef8 --- /dev/null +++ b/test/nesting/ok/table.html @@ -0,0 +1,244 @@ +<div class="body" id="body"> + +<section~A~> +<h1></h1> +<section> +<h2>Nesting: Title inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>= No title tags here. =</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Paragraph inside is normal</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>Line 2.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Line inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>-------------------------------------------</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Comment Line inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>% You're seeing this.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Comment Block inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>%%%</td> +</tr> +<tr> +<td>You're seeing this.</td> +</tr> +<tr> +<td>%%%</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Raw Line inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>""" No raw here.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Raw Block inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>"""</td> +</tr> +<tr> +<td>No raw here.</td> +</tr> +<tr> +<td>"""</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Verbatim Line inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>``` No verbatim line here.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Verbatim Block inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>```</td> +</tr> +<tr> +<td>No verbatim here.</td> +</tr> +<tr> +<td>```</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Quote inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>Line 2.</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: List inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>- No list tags here.</td> +</tr> +<tr> +<td>-</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Numbered List inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>+ No numbered list tags here.</td> +</tr> +<tr> +<td>+</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +<section> +<h2>Nesting: Definition List inside is ignored</h2> + +<table class="tableborder"> +<tr> +<td>Line 1.</td> +</tr> +<tr> +<td>: No definition term tags here.</td> +</tr> +<tr> +<td class="right">No definition definition tags here.</td> +</tr> +<tr> +<td>:</td> +</tr> +<tr> +<td>Line 3.</td> +</tr> +</table> + +</section> +</section> +</div> diff --git a/test/nesting/quote.t2t b/test/nesting/quote.t2t new file mode 100644 index 0000000..3217e67 --- /dev/null +++ b/test/nesting/quote.t2t @@ -0,0 +1,66 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Nesting: Title inside is plain text + Line 1. + = No title tags here. = + Line 3. +%%% Nesting: Paragraph inside is parsed + Line 1. + Line 2. + Line 3. +%%% Nesting: Line inside is parsed + Line 1. + ------------------------------------------- + Line 3. +%%% Nesting: Comment Line inside is plain text + Line 1. + % You're seeing this. + Line 3. +%%% Nesting: Comment Block inside is plain text + Line 1. + %%% + You're seeing this. + %%% + Line 3. +%%% Nesting: Raw Line inside is plain text + Line 1. + """ No raw here. + Line 3. +%%% Nesting: Raw Block inside is plain text + Line 1. + """ + No raw here. + """ + Line 3. +%%% Nesting: Verbatim Line inside is plain text + Line 1. + ``` No verbatim line here. + Line 3. +%%% Nesting: Verbatim Block inside is plain text + Line 1. + ``` + No verbatim here. + ``` + Line 3. +%%% Nesting: List inside is plain text + Line 1. + - No list tags here. + - + Line 3. +%%% Nesting: Numbered List inside is plain text + Line 1. + + No numbered list tags here. + + + Line 3. +%%% Nesting: Definition List inside is plain text + Line 1. + : No definition term tags here. + No definition definition tags here. + : + Line 3. +%%% Nesting: Table inside is plain text + Line 1. + | No table here. + Line 3. diff --git a/test/nesting/run.py b/test/nesting/run.py new file mode 100644 index 0000000..be801c3 --- /dev/null +++ b/test/nesting/run.py @@ -0,0 +1,58 @@ +# +# txt2tags nesting marks tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# + +import glob +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# left files are generated from right ones (using smart filters) +ALIASES = {"numlist": "list", "deflist": "list"} + +# smart filters to allow source inheritance +FILTERS = { + "deflist": [("pre", "^-( |$)", r":\1")], + "numlist": [("pre", "^-( |$)", r"+\1")], +} + + +# convert FILTERS tuples to txt2tags pre/postproc rules +def addFilters(filters): + if not filters: + return [] + config = [] + cmdline = [] + for filter in filters: + config.append("%%!%sproc: '%s' '%s'" % filter) + if config: + lib.WriteFile(lib.CONFIG_FILE, "\n".join(config)) + cmdline = ["-C", lib.CONFIG_FILE] + return cmdline + + +def run(): + # test all .t2t files found + for infile in glob.glob("*.t2t"): + basename = infile.replace(".t2t", "") + outfile = basename + ".html" + if lib.initTest(basename, infile, outfile): + cmdline = [infile] + lib.test(cmdline, outfile) + # using smart filters, same files generate more than one output + for alias in ALIASES: + infile = ALIASES[alias] + ".t2t" + outfile = alias + ".html" + if lib.initTest(alias, infile, outfile): + cmdline = addFilters(FILTERS.get(alias)) + cmdline.append("-H") + cmdline.extend(["-o", outfile, infile]) + lib.test(cmdline, outfile) + # clean up + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/nesting/table.t2t b/test/nesting/table.t2t new file mode 100644 index 0000000..a281d38 --- /dev/null +++ b/test/nesting/table.t2t @@ -0,0 +1,66 @@ + +%!includeconf: test.conf +BODYINIT + +%%% Nesting: Title inside is ignored +| Line 1. | +| = No title tags here. = +| Line 3. +%%% Nesting: Paragraph inside is normal +| Line 1. | +| Line 2. +| Line 3. +%%% Nesting: Line inside is ignored +| Line 1. | +| ------------------------------------------- +| Line 3. +%%% Nesting: Comment Line inside is ignored +| Line 1. | +| % You're seeing this. +| Line 3. +%%% Nesting: Comment Block inside is ignored +| Line 1. | +| %%% +| You're seeing this. +| %%% +| Line 3. +%%% Nesting: Raw Line inside is ignored +| Line 1. | +| """ No raw here. +| Line 3. +%%% Nesting: Raw Block inside is ignored +| Line 1. | +| """ +| No raw here. +| """ +| Line 3. +%%% Nesting: Verbatim Line inside is ignored +| Line 1. | +| ``` No verbatim line here. +| Line 3. +%%% Nesting: Verbatim Block inside is ignored +| Line 1. | +| ``` +| No verbatim here. +| ``` +| Line 3. +%%% Nesting: Quote inside is ignored +| Line 1. | +| Line 2. +| Line 3. +%%% Nesting: List inside is ignored +| Line 1. | +| - No list tags here. +| - +| Line 3. +%%% Nesting: Numbered List inside is ignored +| Line 1. | +| + No numbered list tags here. +| + +| Line 3. +%%% Nesting: Definition List inside is ignored +| Line 1. | +| : No definition term tags here. +| No definition definition tags here. +| : +| Line 3. diff --git a/test/nesting/test.conf b/test/nesting/test.conf new file mode 100644 index 0000000..6e66f88 --- /dev/null +++ b/test/nesting/test.conf @@ -0,0 +1,10 @@ + +%!target: html +%!options: --no-headers + +% Convert comments to titles +%!preproc : '^%%% ([^ \t].*)' '== \1 ==' +% Trick to ensure the body init (don't loose comments) +%!preproc : '^BODYINIT$' '' + +% vim: ft=txt2tags diff --git a/test/options/ok/H.html b/test/options/ok/H.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/H.html @@ -0,0 +1,5 @@ +<div class="body" id="body"> +<p> +Text. +</p> +</div> diff --git a/test/options/ok/V.out b/test/options/ok/V.out new file mode 100644 index 0000000..a043e20 --- /dev/null +++ b/test/options/ok/V.out @@ -0,0 +1 @@ +txt2tags version 2.6 <http://txt2tags.org> diff --git a/test/options/ok/arguments-missing.out b/test/options/ok/arguments-missing.out new file mode 100644 index 0000000..9a37075 --- /dev/null +++ b/test/options/ok/arguments-missing.out @@ -0,0 +1,4 @@ +txt2tags: Error: Missing input file (try --help) + +Please inform an input file (.t2t) at the end of the command. +Example: txt2tags -t html file.t2t diff --git a/test/options/ok/css-sugar-1.html b/test/options/ok/css-sugar-1.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/css-sugar-1.html @@ -0,0 +1,5 @@ +<div class="body" id="body"> +<p> +Text. +</p> +</div> diff --git a/test/options/ok/css-sugar-2.html b/test/options/ok/css-sugar-2.html new file mode 100644 index 0000000..fcf9164 --- /dev/null +++ b/test/options/ok/css-sugar-2.html @@ -0,0 +1,9 @@ +<nav> +<div class="body" id="body"> +</div> +</nav> +<div class="body" id="body"> +<p> +Text. +</p> +</div> diff --git a/test/options/ok/css-sugar-3.html b/test/options/ok/css-sugar-3.html new file mode 100644 index 0000000..a75ad57 --- /dev/null +++ b/test/options/ok/css-sugar-3.html @@ -0,0 +1,68 @@ +<!DOCTYPE html> +<html> +<head> +<title>Header 1 + + + + +
+
+

Header 1

+

Header 2

+

Header 3

+
+
+
+ + +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
+ + + +
diff --git a/test/options/ok/dump-config.out b/test/options/ok/dump-config.out new file mode 100644 index 0000000..891df8b --- /dev/null +++ b/test/options/ok/dump-config.out @@ -0,0 +1,22 @@ +RAW config for RC file + +RAW config for source document + (all) target........: html + +RAW config for command line + (all) quiet.........: ON + (all) no-rc.........: ON + (all) dump-config...: ON + (all) infile........: dump-config.t2t + (all) realcmdline...: ['-q', '--no-rc', '--dump-config', 'dump-config.t2t'] + +Full PARSED config + dump-config...: ON + infile........: dump-config.t2t + quiet.........: ON + rc............: OFF + realcmdline...: -q, --no-rc, --dump-config, dump-config.t2t + sourcefile....: dump-config.t2t + target........: html + +Active filters diff --git a/test/options/ok/dump-source.out b/test/options/ok/dump-source.out new file mode 100644 index 0000000..ae5b52b --- /dev/null +++ b/test/options/ok/dump-source.out @@ -0,0 +1,5 @@ +Header 1 +Header 2 +Header 3 +%!target: html +Text. diff --git a/test/options/ok/encoding-1.html b/test/options/ok/encoding-1.html new file mode 100644 index 0000000..273a407 --- /dev/null +++ b/test/options/ok/encoding-1.html @@ -0,0 +1,38 @@ + + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/encoding-2.html b/test/options/ok/encoding-2.html new file mode 100644 index 0000000..e22b1ff --- /dev/null +++ b/test/options/ok/encoding-2.html @@ -0,0 +1,38 @@ + + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/encoding-3.html b/test/options/ok/encoding-3.html new file mode 100644 index 0000000..8b7fff6 --- /dev/null +++ b/test/options/ok/encoding-3.html @@ -0,0 +1,38 @@ + + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/encoding-4.tex b/test/options/ok/encoding-4.tex new file mode 100644 index 0000000..298dc22 --- /dev/null +++ b/test/options/ok/encoding-4.tex @@ -0,0 +1,17 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{paralist} % needed for compact lists +\usepackage[normalem]{ulem} % needed by strike +\usepackage[urlcolor=blue,colorlinks=true]{hyperref} +\usepackage[latin1]{inputenc} % char encoding + +\begin{document} +\maketitle +\clearpage + + +Text. + +% LaTeX2e code generated by txt2tags (http://txt2tags.org) +% cmdline: txt2tags -q --no-rc -t tex --encoding iso-8859-1 encoding-4.t2t +\end{document} diff --git a/test/options/ok/enum-title-1.html b/test/options/ok/enum-title-1.html new file mode 100644 index 0000000..3e6d224 --- /dev/null +++ b/test/options/ok/enum-title-1.html @@ -0,0 +1,18 @@ +
+ +
+

1. Title 1

+ +

+Text. +

+ +
+

1.1. Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/enum-title-2.html b/test/options/ok/enum-title-2.html new file mode 100644 index 0000000..9745d6f --- /dev/null +++ b/test/options/ok/enum-title-2.html @@ -0,0 +1,32 @@ + +
+ +
+

1. Title 1

+ +

+Text. +

+ +
+

1.1. Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/enum-title-3.html b/test/options/ok/enum-title-3.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/enum-title-3.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/headers-1.html b/test/options/ok/headers-1.html new file mode 100644 index 0000000..0bc3f6f --- /dev/null +++ b/test/options/ok/headers-1.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/headers-2.html b/test/options/ok/headers-2.html new file mode 100644 index 0000000..a409785 --- /dev/null +++ b/test/options/ok/headers-2.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/i.html b/test/options/ok/i.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/i.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/infile-empty.out b/test/options/ok/infile-empty.out new file mode 100644 index 0000000..0fcb52b --- /dev/null +++ b/test/options/ok/infile-empty.out @@ -0,0 +1 @@ +txt2tags: Error: The input file is empty: infile-empty.t2t diff --git a/test/options/ok/infile-missing.out b/test/options/ok/infile-missing.out new file mode 100644 index 0000000..9a37075 --- /dev/null +++ b/test/options/ok/infile-missing.out @@ -0,0 +1,4 @@ +txt2tags: Error: Missing input file (try --help) + +Please inform an input file (.t2t) at the end of the command. +Example: txt2tags -t html file.t2t diff --git a/test/options/ok/infile-not-found-1.out b/test/options/ok/infile-not-found-1.out new file mode 100644 index 0000000..136a16f --- /dev/null +++ b/test/options/ok/infile-not-found-1.out @@ -0,0 +1 @@ +txt2tags: Error: Cannot read file: ERROR.t2t diff --git a/test/options/ok/infile-not-found-2.out b/test/options/ok/infile-not-found-2.out new file mode 100644 index 0000000..136a16f --- /dev/null +++ b/test/options/ok/infile-not-found-2.out @@ -0,0 +1 @@ +txt2tags: Error: Cannot read file: ERROR.t2t diff --git a/test/options/ok/infile.html b/test/options/ok/infile.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/infile.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/invalid-long-1.out b/test/options/ok/invalid-long-1.out new file mode 100644 index 0000000..8b16af2 --- /dev/null +++ b/test/options/ok/invalid-long-1.out @@ -0,0 +1 @@ +txt2tags: Error: option --zzzz not recognized (try --help) diff --git a/test/options/ok/invalid-long-2.out b/test/options/ok/invalid-long-2.out new file mode 100644 index 0000000..8b16af2 --- /dev/null +++ b/test/options/ok/invalid-long-2.out @@ -0,0 +1 @@ +txt2tags: Error: option --zzzz not recognized (try --help) diff --git a/test/options/ok/invalid-short-1.out b/test/options/ok/invalid-short-1.out new file mode 100644 index 0000000..ad70b8d --- /dev/null +++ b/test/options/ok/invalid-short-1.out @@ -0,0 +1 @@ +txt2tags: Error: option -z not recognized (try --help) diff --git a/test/options/ok/invalid-short-2.out b/test/options/ok/invalid-short-2.out new file mode 100644 index 0000000..ad70b8d --- /dev/null +++ b/test/options/ok/invalid-short-2.out @@ -0,0 +1 @@ +txt2tags: Error: option -z not recognized (try --help) diff --git a/test/options/ok/mask-email.html b/test/options/ok/mask-email.html new file mode 100644 index 0000000..e520caf --- /dev/null +++ b/test/options/ok/mask-email.html @@ -0,0 +1,5 @@ +
+

+<user (a) domain com> +

+
diff --git a/test/options/ok/n.html b/test/options/ok/n.html new file mode 100644 index 0000000..3e6d224 --- /dev/null +++ b/test/options/ok/n.html @@ -0,0 +1,18 @@ +
+ +
+

1. Title 1

+ +

+Text. +

+ +
+

1.1. Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-css-sugar-1.html b/test/options/ok/no-css-sugar-1.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-css-sugar-1.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-dump-config.out b/test/options/ok/no-dump-config.out new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-dump-config.out @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-dump-source.out b/test/options/ok/no-dump-source.out new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-dump-source.out @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-encoding-1.html b/test/options/ok/no-encoding-1.html new file mode 100644 index 0000000..877a497 --- /dev/null +++ b/test/options/ok/no-encoding-1.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/no-encoding-2.html b/test/options/ok/no-encoding-2.html new file mode 100644 index 0000000..623c95d --- /dev/null +++ b/test/options/ok/no-encoding-2.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/no-enum-title-1.html b/test/options/ok/no-enum-title-1.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-enum-title-1.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-enum-title-2.html b/test/options/ok/no-enum-title-2.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-enum-title-2.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-headers.html b/test/options/ok/no-headers.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-headers.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-infile-1.html b/test/options/ok/no-infile-1.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-infile-1.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-infile-2.html b/test/options/ok/no-infile-2.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-infile-2.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-infile-3.html b/test/options/ok/no-infile-3.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-infile-3.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-mask-email-1.html b/test/options/ok/no-mask-email-1.html new file mode 100644 index 0000000..15303c9 --- /dev/null +++ b/test/options/ok/no-mask-email-1.html @@ -0,0 +1,5 @@ + diff --git a/test/options/ok/no-mask-email-2.html b/test/options/ok/no-mask-email-2.html new file mode 100644 index 0000000..15303c9 --- /dev/null +++ b/test/options/ok/no-mask-email-2.html @@ -0,0 +1,5 @@ + diff --git a/test/options/ok/no-outfile-1.html b/test/options/ok/no-outfile-1.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-outfile-1.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-outfile-2.html b/test/options/ok/no-outfile-2.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-outfile-2.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-style-1.html b/test/options/ok/no-style-1.html new file mode 100644 index 0000000..f4df117 --- /dev/null +++ b/test/options/ok/no-style-1.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/no-style-2.html b/test/options/ok/no-style-2.html new file mode 100644 index 0000000..cea345c --- /dev/null +++ b/test/options/ok/no-style-2.html @@ -0,0 +1,37 @@ + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/no-targets.out b/test/options/ok/no-targets.out new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/no-targets.out @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/no-toc-1.html b/test/options/ok/no-toc-1.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-toc-1.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-toc-2.html b/test/options/ok/no-toc-2.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-toc-2.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-toc-only-1.html b/test/options/ok/no-toc-only-1.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-toc-only-1.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/no-toc-only-2.html b/test/options/ok/no-toc-only-2.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/no-toc-only-2.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/o.html b/test/options/ok/o.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/o.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/outfile-1.html b/test/options/ok/outfile-1.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/outfile-1.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/outfile-2.foo b/test/options/ok/outfile-2.foo new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/outfile-2.foo @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/q-verbose.txt b/test/options/ok/q-verbose.txt new file mode 100644 index 0000000..b430631 --- /dev/null +++ b/test/options/ok/q-verbose.txt @@ -0,0 +1,7 @@ +Header 1 +Header 2 +Header 3 + + +Text. + diff --git a/test/options/ok/quiet-verbose.txt b/test/options/ok/quiet-verbose.txt new file mode 100644 index 0000000..b430631 --- /dev/null +++ b/test/options/ok/quiet-verbose.txt @@ -0,0 +1,7 @@ +Header 1 +Header 2 +Header 3 + + +Text. + diff --git a/test/options/ok/style-1.html b/test/options/ok/style-1.html new file mode 100644 index 0000000..5b75dd0 --- /dev/null +++ b/test/options/ok/style-1.html @@ -0,0 +1,38 @@ + + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/style-2.html b/test/options/ok/style-2.html new file mode 100644 index 0000000..d878368 --- /dev/null +++ b/test/options/ok/style-2.html @@ -0,0 +1,39 @@ + + + + + + + + + +
+
+
+
+
+ +
+

+Text. +

+
+ + + +
diff --git a/test/options/ok/style-3.tex b/test/options/ok/style-3.tex new file mode 100644 index 0000000..6f91b43 --- /dev/null +++ b/test/options/ok/style-3.tex @@ -0,0 +1,17 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{paralist} % needed for compact lists +\usepackage[normalem]{ulem} % needed by strike +\usepackage[urlcolor=blue,colorlinks=true]{hyperref} +\usepackage{mypackage} % user defined + +\begin{document} +\maketitle +\clearpage + + +Text. + +% LaTeX2e code generated by txt2tags (http://txt2tags.org) +% cmdline: txt2tags -q --no-rc -t tex --style mypackage style-3.t2t +\end{document} diff --git a/test/options/ok/style-4.tex b/test/options/ok/style-4.tex new file mode 100644 index 0000000..3652052 --- /dev/null +++ b/test/options/ok/style-4.tex @@ -0,0 +1,17 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{paralist} % needed for compact lists +\usepackage[normalem]{ulem} % needed by strike +\usepackage[urlcolor=blue,colorlinks=true]{hyperref} +\usepackage{mypackage,otherpackage,another} % user defined + +\begin{document} +\maketitle +\clearpage + + +Text. + +% LaTeX2e code generated by txt2tags (http://txt2tags.org) +% cmdline: txt2tags -q --no-rc -t tex --style mypackage,otherpackage,another style-4.t2t +\end{document} diff --git a/test/options/ok/style-5.tex b/test/options/ok/style-5.tex new file mode 100644 index 0000000..097f933 --- /dev/null +++ b/test/options/ok/style-5.tex @@ -0,0 +1,19 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{paralist} % needed for compact lists +\usepackage[normalem]{ulem} % needed by strike +\usepackage[urlcolor=blue,colorlinks=true]{hyperref} +\usepackage{foo} % user defined +\usepackage{bar} % user defined +\usepackage{baz} % user defined + +\begin{document} +\maketitle +\clearpage + + +Text. + +% LaTeX2e code generated by txt2tags (http://txt2tags.org) +% cmdline: txt2tags -q --no-rc -t tex --style foo.sty --style bar.STY --style baz style-5.t2t +\end{document} diff --git a/test/options/ok/t-invalid.out b/test/options/ok/t-invalid.out new file mode 100644 index 0000000..1f51840 --- /dev/null +++ b/test/options/ok/t-invalid.out @@ -0,0 +1,3 @@ +txt2tags: Error: Invalid target 'ERROR' + +Run 'txt2tags --targets' to see all the available targets. diff --git a/test/options/ok/t.html b/test/options/ok/t.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/t.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/target-invalid.out b/test/options/ok/target-invalid.out new file mode 100644 index 0000000..1f51840 --- /dev/null +++ b/test/options/ok/target-invalid.out @@ -0,0 +1,3 @@ +txt2tags: Error: Invalid target 'ERROR' + +Run 'txt2tags --targets' to see all the available targets. diff --git a/test/options/ok/target.html b/test/options/ok/target.html new file mode 100644 index 0000000..49aa39f --- /dev/null +++ b/test/options/ok/target.html @@ -0,0 +1,5 @@ +
+

+Text. +

+
diff --git a/test/options/ok/toc-1.html b/test/options/ok/toc-1.html new file mode 100644 index 0000000..a0c2477 --- /dev/null +++ b/test/options/ok/toc-1.html @@ -0,0 +1,32 @@ + +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/toc-2.html b/test/options/ok/toc-2.html new file mode 100644 index 0000000..fcf9164 --- /dev/null +++ b/test/options/ok/toc-2.html @@ -0,0 +1,9 @@ + +
+

+Text. +

+
diff --git a/test/options/ok/toc-3.html b/test/options/ok/toc-3.html new file mode 100644 index 0000000..f18e75c --- /dev/null +++ b/test/options/ok/toc-3.html @@ -0,0 +1,6 @@ + +
+
diff --git a/test/options/ok/toc-level-1.html b/test/options/ok/toc-level-1.html new file mode 100644 index 0000000..ffc6a50 --- /dev/null +++ b/test/options/ok/toc-level-1.html @@ -0,0 +1,28 @@ + +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/toc-level-2.html b/test/options/ok/toc-level-2.html new file mode 100644 index 0000000..a0c2477 --- /dev/null +++ b/test/options/ok/toc-level-2.html @@ -0,0 +1,32 @@ + +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/toc-level-3.html b/test/options/ok/toc-level-3.html new file mode 100644 index 0000000..8128d85 --- /dev/null +++ b/test/options/ok/toc-level-3.html @@ -0,0 +1,18 @@ +
+ +
+

Title 1

+ +

+Text. +

+ +
+

Title 2

+ +

+Text. +

+
+
+
diff --git a/test/options/ok/toc-only-1.html b/test/options/ok/toc-only-1.html new file mode 100644 index 0000000..017954e --- /dev/null +++ b/test/options/ok/toc-only-1.html @@ -0,0 +1,12 @@ +
+ + + +
diff --git a/test/options/ok/toc-only-2.html b/test/options/ok/toc-only-2.html new file mode 100644 index 0000000..051bb12 --- /dev/null +++ b/test/options/ok/toc-only-2.html @@ -0,0 +1,2 @@ +
+
diff --git a/test/options/ok/toc-only-3.out b/test/options/ok/toc-only-3.out new file mode 100644 index 0000000..44bd4a4 --- /dev/null +++ b/test/options/ok/toc-only-3.out @@ -0,0 +1,4 @@ + + Title 1 + Title 2 + diff --git a/test/options/ok/toc-only-4.html b/test/options/ok/toc-only-4.html new file mode 100644 index 0000000..1c9aa06 --- /dev/null +++ b/test/options/ok/toc-only-4.html @@ -0,0 +1,8 @@ +
+ + + +
diff --git a/test/options/ok/toc-only-5.html b/test/options/ok/toc-only-5.html new file mode 100644 index 0000000..6559f5e --- /dev/null +++ b/test/options/ok/toc-only-5.html @@ -0,0 +1,12 @@ +
+ +
    +
  1. Title 1 + +
  2. +
+ +
diff --git a/test/options/ok/v-1.txt b/test/options/ok/v-1.txt new file mode 100644 index 0000000..6876b4e --- /dev/null +++ b/test/options/ok/v-1.txt @@ -0,0 +1,14 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +----- Parsing and saving all config found (008 items) +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/v-2.txt b/test/options/ok/v-2.txt new file mode 100644 index 0000000..fc59220 --- /dev/null +++ b/test/options/ok/v-2.txt @@ -0,0 +1,18 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): v-2.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (009 items) +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/v-3.txt b/test/options/ok/v-3.txt new file mode 100644 index 0000000..f510581 --- /dev/null +++ b/test/options/ok/v-3.txt @@ -0,0 +1,27 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): v-3.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (010 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : v-3.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-v', '-v', '-v', '-o-', 'v-3.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/v-4.txt b/test/options/ok/v-4.txt new file mode 100644 index 0000000..37d28a0 --- /dev/null +++ b/test/options/ok/v-4.txt @@ -0,0 +1,28 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): v-4.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (011 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : v-4.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-v', '-v', '-v', '-v', '-o-', 'v-4.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/v-5.txt b/test/options/ok/v-5.txt new file mode 100644 index 0000000..d422451 --- /dev/null +++ b/test/options/ok/v-5.txt @@ -0,0 +1,29 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): v-5.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (012 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : v-5.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-v', '-v', '-v', '-v', '-v', '-o-', 'v-5.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/verbose-1.txt b/test/options/ok/verbose-1.txt new file mode 100644 index 0000000..6876b4e --- /dev/null +++ b/test/options/ok/verbose-1.txt @@ -0,0 +1,14 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +----- Parsing and saving all config found (008 items) +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/verbose-2.txt b/test/options/ok/verbose-2.txt new file mode 100644 index 0000000..d79a90c --- /dev/null +++ b/test/options/ok/verbose-2.txt @@ -0,0 +1,18 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): verbose-2.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (009 items) +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/verbose-3.txt b/test/options/ok/verbose-3.txt new file mode 100644 index 0000000..8d733fa --- /dev/null +++ b/test/options/ok/verbose-3.txt @@ -0,0 +1,27 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): verbose-3.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (010 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : verbose-3.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '--verbose', '--verbose', '--verbose', '-o-', 'verbose-3.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/verbose-4.txt b/test/options/ok/verbose-4.txt new file mode 100644 index 0000000..da4282d --- /dev/null +++ b/test/options/ok/verbose-4.txt @@ -0,0 +1,28 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): verbose-4.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (011 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : verbose-4.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '--verbose', '--verbose', '--verbose', '--verbose', '-o-', 'verbose-4.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/verbose-5.txt b/test/options/ok/verbose-5.txt new file mode 100644 index 0000000..3c0aa22 --- /dev/null +++ b/test/options/ok/verbose-5.txt @@ -0,0 +1,29 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): verbose-5.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (012 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : verbose-5.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '--verbose', '--verbose', '--verbose', '--verbose', '--verbose', '-o-', 'verbose-5.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/version.out b/test/options/ok/version.out new file mode 100644 index 0000000..a043e20 --- /dev/null +++ b/test/options/ok/version.out @@ -0,0 +1 @@ +txt2tags version 2.6 diff --git a/test/options/ok/vv.txt b/test/options/ok/vv.txt new file mode 100644 index 0000000..603c40b --- /dev/null +++ b/test/options/ok/vv.txt @@ -0,0 +1,18 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): vv.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (009 items) +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/vvv.txt b/test/options/ok/vvv.txt new file mode 100644 index 0000000..dddc45f --- /dev/null +++ b/test/options/ok/vvv.txt @@ -0,0 +1,27 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): vvv.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (010 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : vvv.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-vvv', '-o-', 'vvv.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/vvvv.txt b/test/options/ok/vvvv.txt new file mode 100644 index 0000000..5f832e1 --- /dev/null +++ b/test/options/ok/vvvv.txt @@ -0,0 +1,28 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): vvvv.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (011 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : vvvv.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-vvvv', '-o-', 'vvvv.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/ok/vvvvv.txt b/test/options/ok/vvvvv.txt new file mode 100644 index 0000000..6d17107 --- /dev/null +++ b/test/options/ok/vvvvv.txt @@ -0,0 +1,29 @@ +----- Txt2tags 2.6 processing begins +----- Ignoring user configuration file +----- Loading source document +---------- File read (2 lines): vvvvv.t2t +---------- Areas found: body ( 2) +---------- Source document contents stored +----- Parsing and saving all config found (012 items) +--------------- Added config .......quiet : 1 +--------------- Added config ..........rc : 0 +--------------- Added config ......target : txt +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....verbose : 1 +--------------- Added config .....outfile : - +--------------- Added config ......infile : vvvvv.t2t +--------------- Added config .realcmdline : ['-q', '--no-rc', '-t', 'txt', '--no-quiet', '-vvvvv', '-o-', 'vvvvv.t2t'] +---------- Added the following keys: infile, outfile, rc, realcmdline, target, verbose +----- Composing target Headers +----- Composing target Body +----- Composing target Footer +----- Composing target TOC +----- Saving results to the output file + + +Text. + +----- Txt2tags finished successfully diff --git a/test/options/run.py b/test/options/run.py new file mode 100644 index 0000000..b909b5a --- /dev/null +++ b/test/options/run.py @@ -0,0 +1,648 @@ +# +# txt2tags command line options tester (http://txt2tags.org) +# See also: ../run.py ../lib.py +# +# Note: The .t2t files are generated dynamicaly, based on 'tests' dict data +# + +import os +import sys + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +# text patterns to compose source files +EMPTY_HEADER = "\n" +FULL_HEADER = "Header 1\nHeader 2\nHeader 3\n" +SIMPLE_BODY = "Text.\n" +TITLED_BODY = "= Title 1 =\nText.\n== Title 2 ==\nText.\n" +EMAIL = "user@domain.com\n" +CONFIG_FILE_TXT = "%!target: html\n" +CSS_FILE_TXT = "p { color: blue; }\n" + +# a nice postproc to rip off version information from output +VERSION_GOTCHA = "%!postproc: '(generated by txt2tags) [^ ]+' '\\1'\n" + +# the registered tests +tests = [ + { + "name": "arguments-missing", # t2t + "content": "", + "cmdline": [""], + "redir": ["> arguments-missing.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "infile-missing", # t2t -t html + "content": "", + "cmdline": ["-t html"], + "redir": ["> infile-missing.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "infile-empty", # infile is empty + "content": "", + "cmdline": ["-t html"], + "redir": ["> infile-empty.out"], + "extra": ["notarget"], + }, + { + "name": "infile-not-found-1", # infile -t html ERROR.t2t + "content": "", + "cmdline": ["-t html ERROR.t2t"], + "redir": ["> infile-not-found-1.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "infile-not-found-2", # infile -t html -i ERROR.t2t + "content": "", + "cmdline": ["-t html -i ERROR.t2t"], + "redir": ["> infile-not-found-2.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "target-invalid", # t2t --target ERROR + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--target ERROR"], + "redir": ["> target-invalid.out"], + "extra": ["notarget"], + }, + { + "name": "t-invalid", # t2t --t ERROR + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-t ERROR"], + "redir": ["> t-invalid.out"], + "extra": ["notarget"], + }, + { + "name": "invalid-short-1", # t2t -z + "content": "", + "cmdline": ["-z"], + "redir": ["> invalid-short-1.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "invalid-long-1", # t2t --zzzz + "content": "", + "cmdline": ["--zzzz"], + "redir": ["> invalid-long-1.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "invalid-short-2", # t2t -z infile.t2t + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-z"], + "redir": ["> invalid-short-2.out"], + "extra": ["notarget"], + }, + { + "name": "invalid-long-2", # t2t --zzzz infile.t2t + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--zzzz"], + "redir": ["> invalid-long-2.out"], + "extra": ["notarget"], + }, + { + "name": "version", # t2t --version + "content": "", + "cmdline": ["--version"], + "redir": ["> version.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "V", # t2t -V + "content": "", + "cmdline": ["-V"], + "redir": ["> V.out"], + "extra": ["notarget", "noinfile"], + }, + { + "name": "verbose-1", # t2t --verbose infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --verbose -o-"], + "redir": ["> verbose-1.txt"], + }, + { + "name": "verbose-2", # t2t --verbose*2 infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --verbose --verbose -o-"], + "redir": ["> verbose-2.txt"], + }, + { + "name": "verbose-3", # t2t --verbose*3 infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --verbose --verbose --verbose -o-"], + "redir": ["> verbose-3.txt"], + }, + { + "name": "verbose-4", # t2t --verbose*4 infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --verbose --verbose --verbose --verbose -o-"], + "redir": ["> verbose-4.txt"], + }, + { + "name": "verbose-5", # t2t --verbose*5 infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --verbose --verbose --verbose --verbose --verbose -o-"], + "redir": ["> verbose-5.txt"], + }, + { + "name": "v-1", # t2t -v infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -v -o-"], + "redir": ["> v-1.txt"], + }, + { + "name": "v-2", # t2t -v -v infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -v -v -o-"], + "redir": ["> v-2.txt"], + }, + { + "name": "v-3", # t2t -v -v -v infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -v -v -v -o-"], + "redir": ["> v-3.txt"], + }, + { + "name": "v-4", # t2t -v -v -v -v infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -v -v -v -v -o-"], + "redir": ["> v-4.txt"], + }, + { + "name": "v-5", # t2t -v -v -v -v -v infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -v -v -v -v -v -o-"], + "redir": ["> v-5.txt"], + }, + { + "name": "vv", # t2t -vv infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -vv -o-"], + "redir": ["> vv.txt"], + }, + { + "name": "vvv", # t2t -vvv infile.t2t + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -vvv -o-"], + "redir": ["> vvv.txt"], + }, + { + "name": "vvvv", # t2t -vvvv infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -vvvv -o-"], + "redir": ["> vvvv.txt"], + }, + { + "name": "vvvvv", # t2t -vvvvv infile.t2t (same -vvv) + "target": "txt", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -vvvvv -o-"], + "redir": ["> vvvvv.txt"], + }, + { + "name": "q-verbose", # t2t -q -vvv infile.t2t + "target": "txt", + "content": FULL_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet -q -vvv -o-"], + "redir": ["> q-verbose.txt"], + }, + { + "name": "quiet-verbose", # t2t --quiet -vvv infile.t2t + "target": "txt", + "content": FULL_HEADER + SIMPLE_BODY, + "cmdline": ["--no-quiet --quiet -vvv -o-"], + "redir": ["> quiet-verbose.txt"], + }, + { + "name": "target", # t2t --target html infile.t2t + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --target html"], + "extra": ["notarget"], + }, + { + "name": "t", # t2t -t html infile.t2t + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H -t html"], + "extra": ["notarget"], + }, + { + "name": "infile", + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --infile"], + }, + { + "name": "no-infile-1", # useless + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --no-infile"], + }, + { + "name": "no-infile-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --infile fake --no-infile"], + }, + { + "name": "no-infile-3", # turning OFF multiple + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --infile fake1 --infile fake2 --no-infile"], + }, + { + "name": "i", + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H -i"], + }, + { + "name": "outfile-1", # same name as default + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --outfile outfile-1.html"], + }, + { + "name": "outfile-2", # different name + "target": "foo", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H -t html --outfile outfile-2.foo"], + "extra": ["notarget"], + }, + { + "name": "no-outfile-1", # useless + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --no-outfile"], + }, + { + "name": "no-outfile-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --outfile fake --no-outfile"], + }, + { + "name": "o", # same name as default + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H -o o.html"], + }, + { + "name": "enum-title-1", + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --enum-title"], + }, + { + "name": "enum-title-2", # with --toc + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc --enum-title"], + }, + { + "name": "enum-title-3", # no title to enumerate + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --enum-title"], + }, + { + "name": "no-enum-title-1", # useless + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --no-enum-title"], + }, + { + "name": "no-enum-title-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --enum-title --no-enum-title"], + }, + { + "name": "n", + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H -n"], + }, + { + "name": "toc-1", + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc"], + }, + { + "name": "toc-2", # empty toc (no title) + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --toc"], + }, + { + "name": "toc-3", # empty body + "target": "html", + "content": EMPTY_HEADER, + "cmdline": ["-H --toc"], + }, + { + "name": "no-toc-1", # useless + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --no-toc"], + }, + { + "name": "no-toc-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc --no-toc"], + }, + { + "name": "toc-level-1", + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc --toc-level 1"], + }, + { + "name": "toc-level-2", # very deep + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc --toc-level 999"], + }, + { + "name": "toc-level-3", # useless (no --toc) + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc-level 1"], + }, + { + "name": "toc-only-1", + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["--toc-only -o toc-only-1.html"], + }, + { + "name": "toc-only-2", # empty toc (no title) + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--toc-only -o toc-only-2.html"], + }, + { + "name": "toc-only-3", # no target, defaults to txt + "target": "out", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["--toc-only -o toc-only-3.out"], + "extra": ["notarget"], + }, + { + "name": "toc-only-4", # with --toc-level + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["--toc-only --toc-level 1 -o toc-only-4.html"], + }, + { + "name": "toc-only-5", # with --enum-title + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["--toc-only --enum-title -o toc-only-5.html"], + }, + { + "name": "no-toc-only-1", # useless + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --no-toc-only"], + }, + { + "name": "no-toc-only-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + TITLED_BODY, + "cmdline": ["-H --toc-only --no-toc-only"], + }, + { + "name": "mask-email", + "target": "html", + "content": EMPTY_HEADER + EMAIL, + "cmdline": ["-H --mask-email"], + }, + { + "name": "no-mask-email-1", # useless + "target": "html", + "content": EMPTY_HEADER + EMAIL, + "cmdline": ["-H --no-mask-email"], + }, + { + "name": "no-mask-email-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + EMAIL, + "cmdline": ["-H --mask-email --no-mask-email"], + }, + { + "name": "headers-1", # useless + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--headers"], + }, + { + "name": "headers-2", # turning OFF --no-headers + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--no-headers --headers"], + }, + { + "name": "no-headers", + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["--no-headers"], + }, + { + "name": "H", + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H"], + }, + { + "name": "encoding-1", + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--encoding iso-8859-1"], + }, + { + "name": "encoding-2", # normalization + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--encoding ISO88591"], + }, + { + "name": "encoding-3", # customized + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--encoding fake-999"], + }, + { + "name": "encoding-4", # LaTeX translation + "target": "tex", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--encoding iso-8859-1"], + }, + { + "name": "no-encoding-1", # useless + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--no-encoding"], + }, + { + "name": "no-encoding-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--encoding iso-8859-1 --no-encoding"], + }, + { + "name": "style-1", + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style", lib.CSS_FILE], + }, + { + "name": "style-2", # multiple declaration + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style other.css --style", lib.CSS_FILE], + }, + { + "name": "style-3", # LaTeX package + "target": "tex", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style mypackage"], + }, + { + "name": "style-4", # LaTeX multiple package + "target": "tex", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style mypackage,otherpackage,another"], + }, + { + "name": "style-5", # LaTeX module no .sty + "target": "tex", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style foo.sty --style bar.STY --style baz"], + }, + { + "name": "no-style-1", # useless + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--no-style"], + }, + { + "name": "no-style-2", # turning OFF + "target": "html", + "content": EMPTY_HEADER + VERSION_GOTCHA + SIMPLE_BODY, + "cmdline": ["--style fake.css --no-style"], + }, + { + "name": "css-sugar-1", # just body + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H"], + }, + { + "name": "css-sugar-2", # empty toc & body + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H --toc"], + }, + { + "name": "css-sugar-3", # headers, toc & body + "target": "html", + "content": FULL_HEADER + VERSION_GOTCHA + TITLED_BODY, + "cmdline": ["--toc"], + }, + { + "name": "no-css-sugar-1", # useless + "target": "html", + "content": EMPTY_HEADER + SIMPLE_BODY, + "cmdline": ["-H"], + }, + { + "name": "dump-config", + "content": EMPTY_HEADER + CONFIG_FILE_TXT + SIMPLE_BODY, + "cmdline": ["--dump-config"], + "redir": ["> dump-config.out"], + "extra": ["notarget"], + }, + { + "name": "no-dump-config", + "content": EMPTY_HEADER + CONFIG_FILE_TXT + SIMPLE_BODY, + "cmdline": ["-H -o- --dump-config --no-dump-config"], + "redir": ["> no-dump-config.out"], + "extra": ["notarget"], + }, + { + "name": "dump-source", + "content": FULL_HEADER + CONFIG_FILE_TXT + SIMPLE_BODY, + "cmdline": ["--dump-source"], + "redir": ["> dump-source.out"], + "extra": ["notarget"], + }, + { + "name": "no-dump-source", + "content": EMPTY_HEADER + CONFIG_FILE_TXT + SIMPLE_BODY, + "cmdline": ["-H -o- --dump-source --no-dump-source"], + "redir": ["> no-dump-source.out"], + "extra": ["notarget"], + }, + { + "name": "no-targets", + "content": EMPTY_HEADER + CONFIG_FILE_TXT + SIMPLE_BODY, + "cmdline": ["-H -o- --targets --no-targets"], + "redir": ["> no-targets.out"], + "extra": ["notarget"], + }, +] + + +def run(): + for test in tests: + infile = test["name"] + ".t2t" + outfile = test["name"] + "." + (test.get("target") or "out") + extra = test.get("extra") or [] + cmdline = test["cmdline"] + if "noinfile" not in extra: + cmdline = test["cmdline"] + [infile] + if lib.initTest(test["name"], infile, outfile): + # create the extra files (if needed for this test) + if "config" in extra: + lib.WriteFile(lib.CONFIG_FILE, CONFIG_FILE_TXT) + if "css" in extra: + lib.WriteFile(lib.CSS_FILE, CSS_FILE_TXT) + # may I add the -t target automatically? + if "notarget" not in extra: + cmdline = ["-t", test["target"]] + cmdline + # may I redirect the output to a file? + if test.get("redir"): + cmdline.extend(test["redir"]) + # always catch the error output + cmdline.append("2>&1") + # create the source file + lib.WriteFile(infile, test["content"]) + # convert and check results + lib.test(cmdline, outfile) + # remove the trash + os.remove(infile) + if os.path.isfile(lib.CSS_FILE): + os.remove(lib.CSS_FILE) + if os.path.isfile(lib.CONFIG_FILE): + os.remove(lib.CONFIG_FILE) diff --git a/test/run.py b/test/run.py new file mode 100755 index 0000000..eef38f0 --- /dev/null +++ b/test/run.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python +# +# txt2tags test-suite (http://txt2tags.org) +# See also: lib.py, */run.py +# +# Just run this file without parameters at it will perform +# all the tests. At the end a report will be printed, and +# if any error is found, the program will tell you. +# +# Inside each test module (the subdirs) there is a run.py +# script, that will make the tests. The expected results +# are on the module's "ok" subdir. If any error is found, +# it will be stored on the "error" subdir. +# +# TIP: To quickly check the errors, run: +# for f in */error/*; do diff -u ${f/error/ok} $f; done + +from __future__ import print_function + +import argparse +import os.path +import sys + +import lib + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument("modules", nargs="*") + parser.add_argument("--override", action="store_true", help="override test files") + return parser.parse_args() + + +DIR = os.path.dirname(os.path.abspath(__file__)) +os.chdir(DIR) + +MODULES = [] +for path in sorted(os.listdir(DIR)): + if path.startswith("__") or not os.path.isdir(path): + continue + if os.path.exists(os.path.join(path, "run.py")): + MODULES.append(path) + else: + sys.exit("test module %s does not contain run.py file" % path) + +ARGS = parse_args() +lib.OVERRIDE = ARGS.override + +if ARGS.modules: + MODULES = sorted(set(ARGS.modules) & set(MODULES)) + +# Show which version is being tested +print("Testing txt2tags version", lib.get_output(lib.TXT2TAGS + ["-V"])) +print() +print("Base commands used for all tests:") +print(lib.TXT2TAGS) +print() + +for module in MODULES: + os.chdir(DIR) + + print("Entering module", module) + if not os.path.isdir(module): + sys.exit("ERROR: Invalid module %s" % module) + + # load test module + sys.path.insert(0, module) + import run + + os.chdir(module) + run.run() + + # cleanup + del sys.path[0] + del run + del sys.modules["run"] + +# show report at the end +if lib.FAILED: + stats = "%d ok / %d failed" % (lib.OK, lib.FAILED) +else: + stats = "100% ok" +print() +print("Totals: %d tests (%s)" % (lib.OK + lib.FAILED, stats)) + +if lib.ERROR_FILES: + print() + print("Check out the files with errors:") + print("\n".join(lib.ERROR_FILES)) + sys.exit(1) diff --git a/test/sample/run.py b/test/sample/run.py new file mode 100644 index 0000000..a8dfba4 --- /dev/null +++ b/test/sample/run.py @@ -0,0 +1,27 @@ +from __future__ import print_function + +import os.path +import sys + +DIR = os.path.dirname(os.path.abspath(__file__)) +REPO = os.path.dirname(os.path.dirname(DIR)) + +sys.path.insert(0, "..") +import lib + +del sys.path[0] + +sys.path.insert(0, REPO) +import txt2tags + +del sys.path[0] + + +def run(): + infile = os.path.join(REPO, "samples", "sample.t2t") + for target in txt2tags.TARGETS: + outfile = "sample." + target + cmdline = ["-t", target, "-o", outfile, infile] + okfile = os.path.join(REPO, "samples", outfile) + print(" ", target, end=" ") + lib.test(cmdline, outfile, okfile=okfile) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a8cd3fe --- /dev/null +++ b/tox.ini @@ -0,0 +1,36 @@ +[tox] +envlist = py{27,36,37,38}, style, docs +skip_missing_interpreters = true + +[testenv] +changedir = {toxinidir}/test/ +commands = + python run.py + bash -c "python ../samples/module/module-body.py > /dev/null" + bash -c "python ../samples/module/module-full.py > /dev/null" + txt2tags -t html -o /dev/null {toxinidir}/samples/sample.t2t + bash ../samples/css/build +whitelist_externals = bash + +[testenv:style] +basepython = python3 +changedir = {toxinidir} +deps = + black + flake8 + flake8-2020 + flake8-bugbear + flake8-comprehensions + pyupgrade +commands = + black --check setup.py txt2tags.py samples/module/ test/ + flake8 --max-line-length=90 --extend-ignore E402 --exclude .tox . + bash -c "pyupgrade `find samples/module test -name '*.py'` txt2tags.py" +whitelist_externals = bash + +[testenv:docs] +basepython = python3 +changedir = {toxinidir}/docs/ +commands = + bash build-docs.sh +whitelist_externals = bash diff --git a/txt2tags.py b/txt2tags.py new file mode 100755 index 0000000..83fb411 --- /dev/null +++ b/txt2tags.py @@ -0,0 +1,5045 @@ +#!/usr/bin/env python +# txt2tags - generic text conversion tool +# https://txt2tags.org/ +# https://github.com/jendrikseipp/txt2tags +# +# Copyright 2001-2010 Aurelio Jargas +# Copyright 2010-2019 Jendrik Seipp +# +# License: GPL2+ (http://www.gnu.org/licenses/gpl-2.0.txt) +# +######################################################################## +# +# The code that [1] parses the marked text is separated from the +# code that [2] insert the target tags. +# +# [1] made by: def convert() +# [2] made by: class BlockMaster +# +# The structures of the marked text are identified and its contents are +# extracted into a data holder (Python lists and dictionaries). +# +# When parsing the source file, the blocks (para, lists, quote, table) +# are opened with BlockMaster, right when found. Then its contents, +# which spans on several lines, are feeded into a special holder on the +# BlockMaster instance. Just when the block is closed, the target tags +# are inserted for the full block as a whole, in one pass. This way, we +# have a better control on blocks. Much better than the previous line by +# line approach. +# +# In other words, whenever inside a block, the parser *holds* the tag +# insertion process, waiting until the full block is read. That was +# needed primary to close paragraphs for the XHTML target, but +# proved to be a very good adding, improving many other processing. +# +# ------------------------------------------------------------------- +# +# These important classes are all documented: +# CommandLine, SourceDocument, ConfigMaster, ConfigLines. +# +# There is a RAW Config format and all kind of configuration is first +# converted to this format. Then a generic method parses it. +# +# These functions get information about the input file(s) and take +# care of the init processing: +# get_infiles_config(), process_source_file() and convert_this_files() +# +######################################################################## + +# XXX Smart Image Align don't work if the image is a link +# Can't fix that because the image is expanded together with the +# link, at the linkbank filling moment. Only the image is passed +# to parse_images(), not the full line, so it is always 'middle'. + +# XXX Paragraph separation not valid inside Quote +# Quote will not have

inside, instead will close and open +# again the
. This really sux in CSS, when defining a +# different background color. Still don't know how to fix it. + +# XXX TODO (maybe) +# New mark which expands to an anchor full title. +# It is necessary to parse the full document in this order: +# DONE 1st scan: HEAD: get all settings, including %!includeconf +# DONE 2nd scan: BODY: expand includes & apply %!preproc +# 3rd scan: BODY: read titles and compose TOC info +# 4th scan: BODY: full parsing, expanding [#anchor] 1st +# Steps 2 and 3 can be made together, with no tag adding. +# Two complete body scans will be *slow*, don't know if it worths. +# One solution may be add the titles as postproc rules + +from __future__ import print_function + +import collections +import getopt +import os +import re +import sys + +############################################################################## + +# Program information +my_url = "http://txt2tags.org" +my_name = "txt2tags" +my_email = "jendrikseipp@gmail.com" +__version__ = "3.4" + +# FLAGS : the conversion related flags , may be used in %!options +# OPTIONS : the conversion related options, may be used in %!options +# ACTIONS : the other behavior modifiers, valid on command line only +# SETTINGS: global miscellaneous settings, valid on RC file only +# NO_TARGET: actions that don't require a target specification +# NO_MULTI_INPUT: actions that don't accept more than one input file +# CONFIG_KEYWORDS: the valid %!key:val keywords +# +# FLAGS and OPTIONS are configs that affect the converted document. +# They usually have also a --no-
", + "blockQuoteOpen": "
", + "blockVerbClose": "", + "blockVerbOpen": "
",
+            "bodyClose": "",
+            "bodyOpen": '
', + "comment": "", + "cssClose": "", + "cssOpen": "