# 2004-06-26 Aurelio: v2.0: %%date, photo, s/orange/blue/, XHTML target, # CSS, work in new PHP, --enum-title, show parsed x?html # 2004-10-20 Aurelio: v2.1: Text capitalized, using button instead photo # 2004-12-28 Aurelio: v2.2: Lout target # 2005-05-28 Aurelio: v2.3: link: s/sample.t2t/markup.html/, gray table # 2006-07-24 Aurelio: v2.4: rewrote. Now configurable, clean and modular # Form using labels and fieldset, --toc, hints simplified # 2008-07-08 Aurelio: v2.5: is_standalone flag to turn headers on/off #-----------------------------[ CONFIG ]----------------------------- # # The txt2tags program location (PATH) # $prog = "txt2tags"; # Set to 1 to use this file alone (will print page headers) # Set to 0 to use this file inserted on another .php (embedded) $is_standalone = 0; # The default marked text # $dfttxt = "= My Title ="; $dfttxt.= "\nA __paragraph__ with **bold** and //italic//.\n"; $dfttxt.= "\nToday is %%date(%c)."; $dfttxt.= "\nHere is a nice pic: [images/t2tpowered.png].\n"; $dfttxt.= "\n | John | 33 | Male |"; $dfttxt.= "\n | Mary | 19 | Female |"; # The options labels for the form # $labels = array( 'target' => 'Target', 'noheaders' => 'Hide headers', 'enumtitle' => 'Numbered titles', 'toc' => 'Table Of Contents', 'csssugar' => 'CSS Sugar (HTML and XHTML)' ); # The available targets # $targets = array( 'html' => 'HTML page', 'xhtml' => 'XHTML page', 'sgml' => 'SGML document', 'tex' => 'LaTeX document', 'lout' => 'Lout document', 'man' => 'UNIX Manual page', 'mgp' => 'MagicPoint slides', 'wiki' => 'Wikipedia page', 'gwiki' => 'Google Wiki page', 'doku' => 'DokuWiki page', 'moin' => 'MoinMoin page', 'pm6' => 'PageMaker document' ); #----------------------------[ FUNCTIONS ]--------------------------- function FormSelect($name, $arr, $selected='', $size=0) { if ($size == 0) $size = count($arr); $r = "\n\n"; return $r; } function FormCheck($name, $value, $on=0){ $on = ($on) ? 'checked' : ''; return ""; } function FormLabel($name) { global $labels; return ""; } function getvar($name){ eval('global $'.$name.';'); # first try the global one eval('$val = $'.$name.';'); if (!$val) $val = $_SERVER[$name]; # if not found, try others if (!$val) $val = $_POST[$name]; # echo "

key: $name, value: $val---

"; return $val; } #-----------------------------[ INIT ]---------------------------- $myself = getvar('PHP_SELF'); $txt = getvar('txt'); $target = getvar('target'); $noheaders = getvar('noheaders'); $enumtitle = getvar('enumtitle'); $toc = getvar('toc'); $csssugar = getvar('csssugar'); if (!$txt) $txt = $dfttxt; if (!$target) $noheaders = '-H'; # Default ON #---------------------------[ HEADERS ]---------------------------- if ($is_standalone) { ?> txt2tags // ONE source, MULTI targets

txt2tags WEB Interface

Text Source

Options
Markup Hints
**bold** = title = %%date
//italic// - list [image.jpg]
__under__ + numlist [link www.com]
--strike-- ``code`` | table |

'; echo FormCheck('noheaders', '--no-headers', $noheaders); echo FormLabel('noheaders').'
'; echo FormCheck('enumtitle', '-n', $enumtitle); echo FormLabel('enumtitle').'
'; echo FormCheck('toc', '--toc', $toc); echo FormLabel('toc').'
'; # Mmmmm, no. # echo FormCheck('csssugar', '--css-sugar', $csssugar); # echo FormLabel('csssugar').'
'; ?>

Text converted to


	

parsed