This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
82 lines (55 loc) · 2.84 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
This project is archived.
This is the new location for the up-to-date code:
https://github.com/farvardin/lionwiki-t2t/blob/master/txt2tags.class.php
Snapshot from July 2024, just in case the previous link gets broken in the future:
https://github.com/farvardin/lionwiki-t2t/blob/b003c9a1e7bb35b2abda76e249100fa2333a7904/txt2tags.class.php
-----------------------------------------------------------------
┌────────────────────┐
│ txt2tags.class.php │
└────────────────────┘
Written by (c) Petko Yotov 2012 www.pmwiki.org/Petko
Development sponsored by Eric Forgeot.
txt2tags is a lightweight markup language created by
Aurelio Jargas and written in Python (www.txt2tags.org).
This class here attempts to transpose some of the features
of the Python convertor to the PHP language.
Most of this script was written by Petko Yotov except:
⁃ functions PSS(), Keep(), Restore(), RegExp $UEX based on
the PmWiki engine by Patrick R. Michaud www.pmichaud.com
⁃ the RegExp $imgrx based on txt2tags.py by Aurelio Jargas
This text is Free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.
See http://www.gnu.org/copyleft/gpl.html for full details
and lack of warranty.
How to use this script
══════════════════════
This class should be included from other scripts, for example:
# load the class
require_once('txt2tags.class.php');
## initialize a new T2T object: two ways
# either with an existing disk file:
$x = new T2T("test.t2t", true);
# or with a variable containing the entire T2T markup:
$x = new T2T($page["text"]);
# optional: some settings, after new/init, before go()
$x->enabletoc = 1;
$x->enableinclude = 1;
$x->snippets['**'] = "<strong>%s</strong>"; # instead of <b>
# run all processing
$x->go();
# get the complete HTML output including <head>
$html = $x->fullhtml;
# alternatively, get some other variables:
$body = $x->bodyhtml; # only the part inside the <body> tags
$fullconfig = $x->config; # what was in the "config" area of the file?
Notes
═════
⁃ This is an early public release, ready to be tested.
⁃ Including disk files is disabled out of the box, because of
potential vulnerabilities. Enabling it on systems where
untrusted people could edit the t2t content is not recommended.
A future version may allow the inclusion of files from the
current directory or only with *.t2t extension.
To enable inclusions, use $x->enableinclude = 1;