Skip to content

Commit

Permalink
Updated LDPL OMFG to work with the new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lartu committed Dec 13, 2019
1 parent 36291cf commit c95030e
Show file tree
Hide file tree
Showing 3 changed files with 974 additions and 994 deletions.
70 changes: 50 additions & 20 deletions man/compileman.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$manPage = $manPage . "\n\n" . ".ce 1\n.SH -=-=-=-=- DOCS: " . trim(strtoupper(substr($line, 2))) . " -=-=-=-=-";
}
}

//Replace all originally blank lines with <BLANK>
$manPage = explode("\n", $manPage);
foreach($manPage as &$line){
Expand All @@ -21,9 +21,28 @@
}
}
$manPage = implode("\n", $manPage);


$manPage = str_replace("\\", "\\\\", $manPage);
$manPage = str_replace("\(", "(", $manPage);
$manPage = str_replace("\)", ")", $manPage);
$manPage = str_replace("**", "", $manPage);
$manPage = str_replace("_ ", " ", $manPage);
$manPage = str_replace(" _", " ", $manPage);
$manPage = preg_replace("/\!\[(.*?)\]\(.*?\)/m", "", $manPage);
$manPage = preg_replace("/\[(.*?)\]\(.*?\)/m", "$1", $manPage);
$manPage = preg_replace("/\:\:\:.*/m", "", $manPage);
$manPage = preg_replace("/\!\!\!\s*warning/m", "~ Warning ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*hint/m", "~ Hint ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*note/m", "~ Note ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*tip/m", "~ Tip ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*Warning/m", "~ Warning ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*Hint/m", "~ Hint ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*Note/m", "~ Note ~", $manPage);
$manPage = preg_replace("/\!\!\!\s*Tip/m", "~ Tip ~", $manPage);


/*$manPage = str_replace("\(", "(", $manPage);
$manPage = str_replace("\)", ")", $manPage);
$manPage = str_replace('{% hint style="info" %}', "-- Note:\n.br", $manPage);
$manPage = str_replace('{% hint style="warning" %}', "-- Warning:\n.br", $manPage);
$manPage = str_replace('{% endhint %}', ".br\n--", $manPage);
Expand All @@ -33,15 +52,14 @@
$manPage = str_replace('{% code-tabs-item title="', "File: ", $manPage);
$manPage = str_replace('" %}', "\n.br", $manPage);
$manPage = str_replace("\\", "\\\\", $manPage);
$manPage = str_replace("**", "", $manPage);
$manPage = str_replace("_ ", " ", $manPage);
$manPage = str_replace(" _", " ", $manPage);
$manPage = str_replace("\[", "[", $manPage);
$manPage = str_replace("\]", "]", $manPage);
$manPage = str_replace("\#", "#", $manPage);
$manPage = str_replace("&gt;", ">", $manPage);
$manPage = str_replace("&lt;", "<", $manPage);
$manPage = preg_replace("/\[(.*?)\]\(.*?\)/m", "$1", $manPage);
$manPage = str_replace("&lt;", "<", $manPage);*/


$manPage = explode("\n", $manPage);

Expand All @@ -59,13 +77,33 @@
$line = "";
}
else if($incode){
if($lineNum < 10)
/*if($lineNum < 10)
$line = $lineNum . " | " . $line . "\n.br";
else
$line = $lineNum . "| " . $line . "\n.br";
$lineNum++;
$lineNum++;*/
$line = " " . $line . "\n.br";
}
else if(strlen($line) > 0 && trim(substr($line, 0, 4)) == "####"){
else if(strlen($line) > 0 && substr(trim($line), 0, 2) == "* "){
//$line = ".br\n • " . trim(substr($line, 2));
$count = 1;
$line = str_replace("*", "", $line, $count);
if(substr($line, 0, 4) != " "){
$line = " " . trim($line);
}
}
else if(strlen($line) > 0 && substr(trim($line), 0, 2) == "- "){
//$line = ".br\n • " . trim(substr($line, 2));
$count = 1;
$line = str_replace("-", "", $line, $count);
if(substr($line, 0, 4) != " "){
$line = " " . trim($line);
}
}
else if(strlen($line) > 0 && substr($line, 0, 1) == "|"){
$line = ".br\n" . trim($line);
}
/*else if(strlen($line) > 0 && trim(substr($line, 0, 4)) == "####"){
$line = ".B " . trim(substr($line, 4));
}
if(strlen($line) > 0 && trim(substr($line, 0, 3)) == "###"){
Expand All @@ -77,19 +115,11 @@
else if(strlen($line) > 0 && substr($line, 0, 1) == "#"){
$line = ".SH " . strtoupper(trim(substr($line, 1)));
}
else if(strlen($line) > 0 && substr($line, 0, 1) == "|"){
$line = ".br\n" . trim($line);
}
else if(strlen($line) > 0 && substr($line, 0, 2) == "* "){
$line = ".br\n[*] " . trim(substr($line, 2));
}
else if($line == "!"){
$line = "";
}

$line = trim($line);
}*/
}

$manPage = implode("\n", $manPage);

$manPage = str_replace('`', "'", $manPage);
Expand Down
1 change: 0 additions & 1 deletion man/generateMan.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
cp -r ../docs docs
#git clone https://www.github.com/lartu/ldpl-docs
cp compileman.php docs/
cp ldplman-intro docs/
cd docs
Expand Down
Loading

0 comments on commit c95030e

Please sign in to comment.