Skip to content

Commit

Permalink
feat: update txt2tags to 3.4
Browse files Browse the repository at this point in the history
conversion tool to generating several file formats

Issue: deepin-community/sig-deepin-sysdev-team#558
Log: update repo
  • Loading branch information
xzl01 committed Dec 18, 2024
1 parent 0a728df commit 4f8cf87
Show file tree
Hide file tree
Showing 377 changed files with 27,522 additions and 41 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
570 changes: 570 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,83 @@
# template-repository
[![Build Status](https://travis-ci.org/jendrikseipp/txt2tags.svg?branch=master)](https://travis-ci.org/jendrikseipp/txt2tags)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# Txt2tags

Txt2tags is a document generator. It reads a text file with
minimal markup such as `**bold**` and `//italic//` and converts it
to the following formats:

* AsciiDoc
* Creole 1.0
* DocBook
* DokuWiki
* Google Wiki
* HTML
* LaTeX
* Lout
* MagicPoint
* MoinMoin
* PmWiki
* Plain Text
* SGML
* UNIX Manpage
* Wikipedia/MediaWiki

You can use it as a command line program or in a Python application.

# Installation

We recommend using [pipx](https://pipxproject.github.io/pipx/) to install and run txt2tags in an isolated environment without affecting any system packages:

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install txt2tags
txt2tags --help

Of course you can also use pip to install txt2tags globally or in a virtual environment:

pip install -U txt2tags

# Usage

Simple example for command line usage:

1. Write a text file like this (leave 1st line blank):

```
= Hello =
I'm a robot. You're my **master**!
[smile.jpg]
```

2. Run this command:

`txt2tags --target html --no-headers file.t2t`

3. The result is:

```
<H1>Hello</H1>
<P>
I'm a robot. You're my <B>master</B>!
<IMG ALIGN="middle" SRC="smile.jpg" BORDER="0" ALT="">
</P>
```

# History

Aurelio Jargas started the development of Txt2tags in 2001. The program
saw several releases from 2001 to 2010, the last of which was version
2.6. Afterwards, Aurelio became less involved in the development. Still,
many new features were added in the main repository
(https://github.com/txt2tags/txt2tags), but they were never officially
released. In my opinion, many of the new features are only useful for a
very small set of users. The extra code adds bloat to the program and
makes it hard to maintain the code. Unfortunately, these concerns are
not shared by the whole Txt2tags development team. Therefore, I decided
to branch off version 2.6 and maintain a simpler txt2tags version that
works on Python 3. The file [TODO.md](TODO.md) lists the goals for the
project.

If you'd like to help out with any of the tasks, please get in touch.
Pull requests are very welcome!
55 changes: 55 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
* Clean up the code
* Remove more seldom-used features
* Make the code faster
* Drop --encoding option and always use UTF-8
* Inspect the following commits from https://github.com/txt2tags/txt2tags and backport useful changes:

* Escaping:

73f5aecb90cfd4d3c5b778ab3e46755625fe46b8: New MaskMaster

20405d82494cd5789540ea86d72a182c2fde7110: do not escape text in tagged blocks (closes issue 11)

* HTML:

c2945d57a1e743758c62225aeafb67c4b25b42ba: HTML, XHTML and XHTMLS: moved anchors as title ids

457e2308a0012a55cbc844ecdc6d13dfc18a3188: [html] updated tests and fixed some issues with centering tables and images in xhtml

* Path adjustment:

1b6d27f169293475f1901507117d0448b9e12aa4 and
5eaaa90d53fbb31cb3e3213928da6237bd89ce17 and
124054b6d968a31eb33cee1cd5d775ec577d635d and
d7ee71e8018d19c3cf66a947a22f86d5620acc47:
The path adjustment for images now is not done when source or output files are STDIN/STDOUT. See issue 62.

0b9eb9bca5a95d35ea089e7c23dde3988b553d1b: Fixed the problem with CSS files path when using %!includeconf from a different folder. Closes issue 71.

b2200665eac4ad39aac7c1af8f8d99095830c2f0: New fix_css_out_path() to fix inconsistent behavior with relative CSS paths. Now these paths are handled the same way as image paths. Added new tests in test/path for %!style. See issue 71.

bb5ccc0d77b07ad40e994175f37505938ae2719a: New class PathMaster to help solving the path issues.
New tests in test/path to check %!option: --style and config nesting.
New ghost option --dirname (for internal use only) to help tracking the original folder for %!options settings.
Closes issue 85.

39327217a1bdb9c1eb7f7d85443d48b5478b02b1: New option --fix-path to enable the path adjustment for images, local links and CSS files when saving output file to a different folder with --outfile. Use --no-fix-path to turn it off. Tests updated.
This reverts txt2tags to v2.6 state, when resources path in output is not touched at all. This way we don't break existing setups. See discussion in issue 62 for details. See also: issue 63, issue 71.

63ae4342500702510e296cd132c9ab103ea57e5c: Outfile path fix. With the recently added path routines, it's not necessary to join paths inside get_outfile_name() anymore.

6ae08f85e84599d012a568f3211f0d19aaa4eed6: Bugfix in --fix-path option: now it behaves the same regardless if the input file was informed as a relative or absolute path. New tests added to trunk/test/path to check for this specific case.


* Wikipedia:

f0a4c5d265b85d3edb9c49253216a249e19ab164:
Wikipedia: Changed table syntax for cells. Now using "one cell per line" syntax, to make it easier to add alignment and colspan. Also, this syntax seems to be the preferred in MediaWiki docs. Sample file updated. See issue 93.

25a0f867e5bed98ce29577a455cd92970f1026e4:
Wikipedia: Added cell span and cell alignment to tables. Sample file updated. See issue 93.
New regex/key called _tableAttrDelimiter, to place a delimiter into the table cell opening tag only when attributes (as align and span) were used.

cfac162d394d6733622714f9588890919f075be6:
Wikipedia: Added support for internal links to anchors. See issue 93.
Added new tag key urlMarkAnchor, for those cases were the link to anchor tag is different from the normal link tag.
14 changes: 14 additions & 0 deletions debian/README.Debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
txt2tags for Debian
-------------------

Look at /usr/share/doc/txt2tags for documentation, extras and examples.

If you need GUI, you need to install the suggested python-tk package.

-- Christian Surchi <[email protected]>, Mon, 24 Jul 2006 01:16:08 +0200


txt2tags is now maintained under the Debian Python Applications Packaging
Team.

-- Jonathan Wiltshire <[email protected]>, Sun, 09 August 2009 00:43:00 +0100
8 changes: 8 additions & 0 deletions debian/README.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This package uses quilt to manage all modifications to the upstream
source. Changes are stored in the source package as diffs in
debian/patches and applied during the build. Please see:

/usr/share/doc/quilt/README.source

for more information on how to apply the patches, modify patches, or
remove a patch.
Loading

0 comments on commit 4f8cf87

Please sign in to comment.