Add files for MD generation.

This commit is contained in:
Toby Allen 2020-05-04 11:11:00 +01:00
parent 631ec38925
commit a2e8429c51
7 changed files with 378 additions and 0 deletions

8
.gitignore vendored
View File

@ -17,6 +17,14 @@ test/InputFiles/generatedfiles/
test/Generated*
test/InputFiles3*
###########
# github
#############
pages/gen/vendor*
pages/all/*
pages/gen/templates_c/*
############
# Delphi
############

1
pages/gen/config.php Normal file
View File

@ -0,0 +1 @@

43
pages/gen/generate.phps Normal file
View File

@ -0,0 +1,43 @@
<?php
require "config.php";
require "loadcommands.php";
$smarty->assign('Params',$Explain);
foreach ($Commands as $CommandName => $Command) {
foreach ($Command['Items'] as $keytag => $Item) {
# code...
$smarty->assign('Command', $Item);
# code...
$MDFile = $smarty->fetch($Command['Template']);
if (!file_exists('../all/')){
mkdir('../all/');
}
$Fn = $CommandName . @$Item['FileTypeTitleExtra'] . $Item['FileTypeExt'] . '.md' ;
$Links[] = $Fn;
echo "Create File : $Fn\n";
file_put_contents('../all/' . $Fn, $MDFile);
}
}
$md = '
List of Files
==
';
foreach ($Links as $key => $value) {
$md .= " - [$value]($value)\n";
}
file_put_contents('../all/index.md' , $md);
echo "\nList index.md";

204
pages/gen/loadcommands.php Normal file
View File

@ -0,0 +1,204 @@
<?php
$Commands = [
"ConvertDocToFile" => [
"Items" => [
[
"FileTypeExt" => 'RTF',
"FileTypeDescription" => 'Windows Rich Text Format',
"FileFormat" => 'wdFormatRTF',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'PDF',
"FileTypeDescription" => 'Adobe Acrobat Portable Document Format',
"FileFormat" => 'wdFormatPDF',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'TXT',
"FileTypeDescription" => 'Text File',
"FileFormat" => 'wdFormatText',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'ODD',
"FileTypeDescription" => 'Open Document Text Format',
"FileFormat" => 'wdFormatStrictOpenXMLDocument',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'XML',
"FileTypeDescription" => 'XML Document Format',
"FileFormat" => 'wdFormatXMLDocument',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'HTML',
"FileTypeDescription" => 'HTML File',
"FileFormat" => 'wdFormatHTML',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'HTML',
"FileTypeTitleExtra" => 'Filtered',
"FileTypeDescription" => 'Filtered HTML File',
"FileFormat" => 'wdFormatFilteredHTML',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'XPS',
"FileTypeDescription" => 'Microsoft XPS Format',
"FileFormat" => 'wdFormatXPS',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'DOC',
"FileTypeDescription" => 'Latest Microsoft Office Word 365 Version Format ',
"FileFormat" => 'wdFormatDocumentDefault',
"RelatedLinks" => []
],
],
"Template" => "ConvertFromDocToFile.md"
],
"ConvertXLSToFile" => [
"Items" => [
[
"FileTypeExt" => 'CSV',
"FileTypeDescription" => 'Comma Seperated Values file',
"FileFormat" => 'xlCSV',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'PDF',
"FileTypeDescription" => 'Adobe Acrobat Portable Document Format',
"FileFormat" => 'xlpdf',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'TXT',
"FileTypeDescription" => 'Text File',
"FileFormat" => 'xlTextWindows',
"RelatedLinks" => []
],[
"FileTypeExt" => 'TXT',
"FileTypeDescription" => 'Unicode Text File',
"FileTypeTitleExtra" => 'Unicode',
"FileFormat" => 'xlUnicodeText',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'ODS',
"FileTypeDescription" => 'Open Document Spreadsheet Format',
"FileFormat" => 'xlOpenDocumentSpreadsheet',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'XML',
"FileTypeDescription" => 'Open XML Workbook Format',
"FileFormat" => 'xlOpenXMLWorkbook',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'HTML',
"FileTypeDescription" => 'HTML File',
"FileFormat" => 'xlHtml',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'xls',
"FileTypeTitleExtra" => '9795',
"FileTypeDescription" => 'Excel 97/95 format',
"FileFormat" => 'xlExcel9795',
"RelatedLinks" => []
],
[
"FileTypeExt" => 'XPS',
"FileTypeDescription" => 'Microsoft XPS Format',
"FileFormat" => 'xlXPS',
"RelatedLinks" => []
]
],
"Template" => "ConvertFromXLSToFile.md"
]
];
$Explain = [
"appwd" => ['cmd' => '-WD' , 'desc' => "This is a conversion using Microsoft Word. This is not required but makes it easier to read"],
"appxl" => ['cmd' => '-XL' , 'desc' => "This is a conversion using Microsoft Excel. "],
"dashf" => ['cmd' => '-f' , 'desc' => "The File or directory to be converted"],
"dasho" => ['cmd' => '-o' , 'desc' => "The File or Directory where you would like the converted file to be written to."],
"dashl" => ['cmd' => '-L' , 'desc' => "The log level to be output."],
"dasht" => ['cmd' => '-T' , 'desc' => "The file format type that is being converted to"]
];
/*
"ConvertDocToPDF" => [
"Title" => "How do I Convert a Word Doc to a PDF? ",
"CMDValues" => [
'-WD',
'-f',
"'c:\path\Document.doc'",
"-o",
"'c:\path\output\Document.pdf'"
],
"Description" => "It is very simple to convert a Word Document to a PDF on the command line using [Docto](https://github.com/tobya/docto). You can also do this easily in word, but sometimes it helps to be able to do it from the command line. The command line below shows how you can convert a Microsoft Word Document to a Adobe Acrobat PDF file.",
"RelatedLinks" => [
"Convert a Directory to PDF" => "ConvertFolderToPDF"
]
],
,
"ConvertDocToRTF" => [
"Title" => "How do I Convert a Word Document to a RTF File? ",
"CMDValues" => [
'-WD',
'-f',
"'c:\path\Document.doc'",
"-o",
"'c:\path\output\Document.rtf'"
],
"Description" => "It is very simple to convert a Word Document to a RTF on the command line using [Docto](https://github.com/tobya/docto). You can also do this easily in word, but sometimes it helps to be able to do it from the command line. The command line below shows how you can convert a Microsoft Word Document to a Windows Rich Text Format file - RTF.",
"RelatedLinks" => [
"Convert a Directory to RTF" => "ConvertFolderToRTF"
]
],
"Name" => [
"Title" => "",
"CMDValues" => [
'-WD',
],
"Description" => "",
"RelatedLinks" => [
"" => ""
]
]
*/

View File

@ -0,0 +1,47 @@
{
"title" : "How do I Convert a Microsoft Word Doc to a {[$Command.FileTypeDescription]}? "
}
{[$Command.FileTypeDescription]}
==
How do I Convert a Microsoft Word Doc to a {[$Command.FileTypeDescription]} ({[$Command.FileTypeExt]})?
-
It is very simple to convert a Word Document to a {[$Command.FileTypeExt]} file on the command line using [Docto](https://github.com/tobya/docto). You can also do this easily in Microsoft Word, but sometimes it helps to be able to do it from the command line.
The command line below shows how you can convert a Microsoft Word Document to a {[$Command.FileTypeDescription]} file - {[$Command.FileTypeExt]}.
Command Line
-
````
docto -WD -f 'c:\path\Document.doc' -o 'c:\path\Document.{[$Command.FileTypeExt]}' -t {[$Command.FileFormat]}
````
or easier to read
````
docto -WD -f 'c:\path\Document.doc'
-o 'c:\path\Document.{[$Command.FileTypeExt]}'
-t {[$Command.FileFormat]}
````
Command Line Explained
-
- `{[$Params.appwd.cmd]}` - {[$Params.appwd.desc]}
- `{[$Params.dashf.cmd]}` - {[$Params.dashf.desc]}
- `{[$Params.dasho.cmd]}` - {[$Params.dasho.desc]}
- `{[$Params.dasht.cmd]}` - {[$Params.dasht.desc]}
Some other interesting commands
-
You might find some of the following commands also interesting.
{[foreach from=$Command.RelatedLinks key=LinkTitle item=L]}
- [{[$LinkTitle]}]({[$L]})
{[/foreach]}

View File

@ -0,0 +1,26 @@
{[$Command.Title]}
==
{[$Command.Description]}
Command Line
-
docto {[foreach from=$Command.CMDValues item=Param]}{[$Param]} {[/foreach]}
Command Line Explained
-
{[foreach from=$Command.CMDValues item=Param]}
- {[$Param]}
{[/foreach]}
Some other interesting commands
-
{[foreach from=$Command.RelatedLinks key=LinkTitle item=L]}
- [{[$LinkTitle]}]({[$L]})
{[/foreach]}

View File

@ -0,0 +1,49 @@
{
"title" : "How do I Convert a Microsoft Word Doc to a {[$Command.FileTypeDescription]}? "
}
{[$Command.FileTypeDescription]}
==
How do I Convert a Microsoft Excel Spreadsheet to a {[$Command.FileTypeDescription]} ({[$Command.FileTypeExt]})?
-
It is very simple to convert a Microsoft Excel Spreadsheet to a {[$Command.FileTypeExt]} file on the command line using [Docto](https://github.com/tobya/docto). You can also do this easily in Microsoft Excel, but sometimes it helps to be able to do it from the command line.
The command line below shows how you can convert a Microsoft Excel Spreadsheet Document to a {[$Command.FileTypeDescription]} file - {[$Command.FileTypeExt]}.
Command Line
-
````
docto -XL -f 'c:\path\Spreadsheet.xls' -o 'c:\path\Spreadsheet.{[$Command.FileTypeExt]}' -t {[$Command.FileFormat]}
````
or easier to read
````
docto -XL -f 'c:\path\Spreadsheet.xls'
-o 'c:\path\Spreadsheet.{[$Command.FileTypeExt]}'
-t {[$Command.FileFormat]}
````
Command Line Explained
-
- `{[$Params.appxl.cmd]}` {[$Params.appxl.desc]}
- `{[$Params.dashf.cmd]}` {[$Params.dashf.desc]}
- `{[$Params.dasho.cmd]}` {[$Params.dasho.desc]}
- `{[$Params.dasht.cmd]}` {[$Params.dasht.desc]}
Some other interesting commands
-
You might find some of the following commands also interesting.
{[foreach from=$Command.RelatedLinks key=LinkTitle item=L]}
- [{[$LinkTitle]}]({[$L]})
{[/foreach]}