| ... | ... |
@@ -24,6 +24,11 @@ do |
| 24 | 24 |
log "====== $gen" |
| 25 | 25 |
output=$(echo $gen|cut -d'-' -f2|cut -d'.' -f1).html |
| 26 | 26 |
php $gen > $output 2>> $LOGFILE |
| 27 |
+ #html2pdf $output 2>> $LOGFILE |
|
| 28 |
+ NEWSALL="all-$output" |
|
| 29 |
+ NEWSPDF=$(basename $NEWSALL .html).pdf |
|
| 30 |
+ log "Generating Single HTML for $NEWSALL" |
|
| 31 |
+ php news2html.php $output > $NEWSALL 2>> $LOGFILE |
|
| 27 | 32 |
done |
| 28 | 33 |
log "Done." |
| 29 | 34 |
log "==================================================================" |
| ... | ... |
@@ -0,0 +1,47 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+$source=null; |
|
| 4 |
+if( isset($argc) ) {
|
|
| 5 |
+/* for ($i = 0; $i < $argc; $i++) {
|
|
| 6 |
+ echo "Argument #" . $i . " - " . $argv[$i] . "\n"; |
|
| 7 |
+} |
|
| 8 |
+ */ |
|
| 9 |
+ $source=$argv[1]; |
|
| 10 |
+} |
|
| 11 |
+else {
|
|
| 12 |
+ return 1; |
|
| 13 |
+} |
|
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+include_once( 'news-constants.php' ); |
|
| 17 |
+$MAX_ITEMS=$NEWS_RSS_MAX_ITEMS; |
|
| 18 |
+ |
|
| 19 |
+$article_content = file_get_contents($source); |
|
| 20 |
+$article_content_utf8 = mb_convert_encoding($article_content, 'HTML-ENTITIES', "UTF-8"); |
|
| 21 |
+$doc = new DOMDocument(); |
|
| 22 |
+$doc->preserveWhiteSpace = false; |
|
| 23 |
+$doc->formatOutput = true; |
|
| 24 |
+$libxml_previous_state = libxml_use_internal_errors(true); |
|
| 25 |
+$doc->loadHTML($article_content_utf8); |
|
| 26 |
+libxml_use_internal_errors($libxml_previous_state); |
|
| 27 |
+ |
|
| 28 |
+$html = "<html>".PHP_EOL; |
|
| 29 |
+$html .= "<head>".PHP_EOL; |
|
| 30 |
+$html .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'.PHP_EOL; |
|
| 31 |
+$html .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'.PHP_EOL; |
|
| 32 |
+$html .= '<style>'.PHP_EOL; |
|
| 33 |
+$html .= 'html { font-family: "Lucida Sans", sans-serif; }'.PHP_EOL;
|
|
| 34 |
+$html .= 'img { width: 80%; margin-left: auto; margin-right: auto; }'.PHP_EOL;
|
|
| 35 |
+$html .= '.img-conspiracy { width: 50%; margin-left: 30%; margin-right: auto; }'.PHP_EOL;
|
|
| 36 |
+$html .= 'iframe { width: 80%; margin-left: auto; margin-right: auto; }'.PHP_EOL;
|
|
| 37 |
+$html .= '</style>'.PHP_EOL; |
|
| 38 |
+$html .= '</head>'.PHP_EOL; |
|
| 39 |
+$html .= '<body>'.PHP_EOL; |
|
| 40 |
+for($i=0; $i < $MAX_ITEMS; $i++ ) {
|
|
| 41 |
+ $html .= DOMInnerHTML($doc->getElementById($i)); |
|
| 42 |
+ $html .= '<hr>'.PHP_EOL; |
|
| 43 |
+} |
|
| 44 |
+$html .= '</body>'.PHP_EOL; |
|
| 45 |
+$html .= '</html>'.PHP_EOL; |
|
| 46 |
+echo $html; |
|
| 47 |
+?> |