From f38cc5825e7fa8ac94eabe72e964ad4850d10c5f Mon Sep 17 00:00:00 2001 From: b Date: Thu, 31 Aug 2023 23:54:18 +0000 Subject: [PATCH] all 3 post styles are working now. --- post_common.1.pm | 955 ++++++++++++++++++++++++++++++++++++++++++++++- preview.1.pl | 24 +- 2 files changed, 963 insertions(+), 16 deletions(-) diff --git a/post_common.1.pm b/post_common.1.pm index b1a3f8e..b32da66 100644 --- a/post_common.1.pm +++ b/post_common.1.pm @@ -33,7 +33,7 @@ our @EXPORT_OK = ( 'CODE', 'bbcode_to_html', 'HTML_PAGE_START', 'HTML_PAGE_END', 'HTML_POST_START', 'HTML_POST_END', - 'HTML_STYLE' + 'HTML_STYLE', 'HTML_POST_CLASS' ); ###PERL_LIB: use lib '/botm/lib/post'; @@ -200,8 +200,35 @@ use constant HTML_PAGE_START => { '' ], 'bsta' => [ + '', + '', + '', + '&_title;', + '', + '', + '', + '' ], 'phpbb' => [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '&_title;', + '', + '', + '', + '', + '
', + # '

&_title;

', + '' ] }; @@ -214,19 +241,45 @@ use constant HTML_POST_START => { '' ], 'bsta' => [ - ], + '
', + '
', + '

&_subject;

', + '
', + '
', + '' +], 'phpbb' => [ + '
', + '
', + '
', + '

&_subject;

', + '

by &_username; » &_time;

', + '
', + '' ] }; use constant HTML_POST_END => { 'botm' => [ '
', + '
', '' ], 'bsta' => [ + '
', + '
', + '
', + '', ], 'phpbb' => [ + '
', + '
', + '
', + '
', + '' ] }; @@ -235,12 +288,29 @@ use constant HTML_PAGE_END => { '' ], 'bsta' => [ + '' ], 'phpbb' => [ + '', + '', + '' + ] +}; + +use constant HTML_POST_CLASS => { + 'botm' => [ + 'plw', + 'plv' + ], + 'bsta' => [ + 'all' + ], + 'phpbb' => [ + 'bg2', + 'bg1' ] }; -# TODO get CSS from silent chronotransponder use constant HTML_STYLE => { 'botm' => [ '', @@ -279,10 +349,14 @@ use constant HTML_STYLE => { '}', '.br', '{', - ' border-color:', - ' #bb6622!important;', + ' border-color: #bb6622!important;', ' color: #bb6622!important;', '}', + '.po', + '{', + ' border-color: #ff8800!important;', + ' color: #ff8800!important;', + '}', '.ni', '{', ' border-color: #0057af!important;', @@ -293,12 +367,47 @@ use constant HTML_STYLE => { ' border-color: #ffffff!important;', ' color: #ffffff!important;', '}', + '.cz', + '{', + ' border-color: #000000!important;', + ' color: #000000!important;', + '}', + 'div.fq', + '{', + ' text-align: left;', + ' border: solid #0057af 4px;', + ' font-family: monospace;', + '}', + 'div.tq', + '{', + ' text-align: left;', + ' border: solid #0057af 4px;', + '}', + 'table.pl', + '{', + ' border-color: #0057af;', + ' border-width: 4px 16px 16px 16px;', + ' border-style: solid;', + ' border-spacing: 0px;', + '}', 'div.pl', '{', ' border-color: #0057af;', ' border-width: 4px 16px 16px 16px;', ' border-style: solid;', '}', + 'div.in', + '{', + ' display: inline-block;', + '}', + 'div.le', + '{', + ' float: left;', + '}', + 'div.pr', + '{', + ' float: right;', + '}', '.tp', '{', ' text-align: right;', @@ -325,6 +434,103 @@ use constant HTML_STYLE => { ' padding: 4px;', ' clear: both;', '}', + 'div.plv', + '{', + ' background-color: #D9ECFF;', + ' color: #000000;', + ' padding: 4px;', + ' clear: both;', + '}', + 'tr.plw', + '{', + ' background-color: #ffffff;', + ' color: #000000;', + '}', + 'tr.plv', + '{', + ' background-color: #D9ECFF;', + ' color: #000000;', + '}', + 'tr.plt', + '{', + ' color: #ffffff;', + ' background-color: #0057af;', + '}', + 'tr.pls', + '{', + ' text-align: center;', + ' font-weight: bold;', + ' color: #ffffff;', + ' background-color: #0057af;', + '}', + 'td.plk', + '{', + ' padding: 4px 8px;', + '}', + 'input.hl {', + ' background:none!important;', + ' border:none!important; ', + ' padding:0!important;', + '/* font-family:inherit;', + ' font-size:inherit; */', + ' font: inherit;', + ' text-decoration:underline;', + ' border-color: #0057af;', + ' color: #0057af;', + '}', + 'input.hl:hover {', + ' border-color: #bb6622;', + ' color: #bb6622;', + '}', + 'input.pt', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + '}', + 'input.pt:focus', + '{', + ' border-color: #bb6622;', + '}', + 'select.pk', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + '}', + 'select.pk:focus', + '{', + ' border-color: #bb6622;', + '}', + 'input.pk', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + '}', + 'input.pk:focus', + '{', + ' border-color: #bb6622;', + '}', + 'textarea.pt', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 0px;', + ' border-style: solid;', + ' width: 100%;', + ' resize: none;', + '}', 'blockquote.pq', '{', ' color: #000000;', @@ -366,8 +572,721 @@ use constant HTML_STYLE => { '' ], 'bsta' => [ + '', + 'html', + '{', + ' background-color: #46a3ff;', + ' /* background-color: #d9ecff; */', + ' border-color: #000000;', + ' color: #000000;', + ' text-align: center;', + '}', + 'a', + '{', + ' border-color: #0057af;', + ' color: #0057af;', + ' text-decoration:underline;', + '}', + 'a:visited', + '{', + ' border-color: #bb6622;', + ' color: #bb6622;', + '}', + 'a:hover', + '{', + ' border-color: #bb6622;', + ' color: #bb6622;', + '}', + 'a:hover:visited', + '{', + ' border-color: #0057af;', + ' color: #0057af;', + '}', + '::selection', + '{', + ' color: #ffffff;', + ' background-color: #bb6622;', + '}', + '', + 'div#all', + '{', + ' background-color: #d9ecff;', + ' /* background-color: #ffffff; */', + ' margin-left: auto;', + ' margin-right: auto;', + ' margin-top: 0px;', + ' margin-bottom: 0px;', + ' width: 656px;', + ' padding-top: 27px;', + ' padding-bottom: 27px;', + ' text-align: center;', + '}', + 'div.all', + '{', + ' background-color: #d9ecff;', + ' /* background-color: #ffffff; */', + ' margin-left: auto;', + ' margin-right: auto;', + ' margin-top: 0px;', + ' margin-bottom: 0px;', + ' width: 656px;', + ' padding-top: 27px;', + ' padding-bottom: 27px;', + ' text-align: center;', + '}', + '', + 'div.ins', + '{', + ' background-color: #ffffff;', + ' margin-left: auto;', + ' margin-right: auto;', + ' margin-top: 0px;', + ' margin-bottom: 0px;', + ' padding: 0px;', + ' border: 0px;', + ' width: 580px;', + '}', + 'div#inst', + '{', + ' /* margin-top: 27px; */', + ' /* margin-bottom: 0px; */', + '}', + 'div#insb', + '{', + ' /* margin-top: 0px; */', + ' /* margin-bottom: 27px; */', + '}', + '', + 'div#title', + '{', + ' text-align: center;', + ' padding-top: 21px;', + ' padding-bottom: 21px;', + ' padding-left: 0px;', + ' padding-right: 0px;', + ' border: 0px;', + ' margin: 0px;', + '}', + '', + 'h1#titletext', + '{', + ' margin: 0px;', + ' border: 0px;', + ' padding: 0px;', + '}', + '', + 'div#storypuzzle', + '{', + ' text-align: left;', + ' padding: 8px;', + ' margin: 0px;', + ' border: 0px;', + ' font-weight: bold;', + '}', + '', + 'div#framespace', + '{', + ' background-color: #ffffff;', + ' margin-left: auto;', + ' margin-right: auto;', + ' margin-top: 0px;', + ' margin-bottom: 0px;', + ' padding: 0px;', + ' border: 0px;', + ' width: 656px;', + '}', + '', + 'img#frame', + '{', + ' border: solid #0057af;', + ' border-width:27px 38px;', + ' padding: 0px;', + ' margin: 0px;', + '}', + '', + 'img.intf', + '{', + ' border-width: 0px;', + ' padding: 0px;', + ' margin: 0px;', + '}', + '', + 'tr.intf', + '{', + ' border-width: 0px;', + ' padding: 0px;', + ' margin: 0px;', + '}', + '', + 'td.intf', + '{', + ' border-width: 0px;', + ' padding: 0px;', + ' margin: 0px;', + '}', + '', + 'table#intftable', + '{', + ' border: solid #0057af;', + ' border-width:27px 38px;', + ' padding: 0px;', + ' margin: 0px;', + ' background-color: #00ff00;', + ' border-collapse: collapse;', + ' border-spacing: 0px;', + '}', + '', + 'img#frame:hover', + '{', + ' border-color: #bb6622;', + '}', + '', + 'div#undertext', + '{', + ' text-align: left;', + ' padding: 8px;', + ' margin: 0px;', + ' border: 0px;', + '}', + '', + 'div#chat', + '{', + ' text-align: left;', + ' padding: 8px;', + ' margin: 0px;', + ' border: 0px;', + ' font-family: monospace;', + '}', + '', + 'div.fq', + '{', + ' text-align: left;', + ' border: solid #0057af 4px;', + ' font-family: monospace;', + '}', + '', + 'div.fq:hover', + '{', + ' border-color: #bb6622;', + '}', + '', + 'div.tq', + '{', + ' text-align: left;', + ' border: solid #0057af 4px;', + '}', + '', + 'div.tq:hover', + '{', + ' border-color: #bb6622;', + '}', + '', + 'div#command', + '{', + ' text-align: left;', + ' margin: 0px;', + ' border: 0px;', + ' padding: 8px;', + ' font-family: monospace;', + ' font-size: 150%;', + ' /* font-weight: bold; */', + '}', + '', + 'div#underlinks', + '{', + ' text-align: left;', + ' padding: 8px;', + ' margin: 0px;', + ' border: 0px;', + ' font-family: monospace;', + '}', + '', + 'span.inp', + '{', + ' animation: inp 2380ms step-start infinite;', + '}', + '', + '@keyframes inp', + '{', + ' 50% { opacity: 0.0;}', + '}', + '', + 'input.intx', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + ' font-family: monospace;', + ' /* font-size: 150%; */', + '}', + '', + 'input.intx:focus', + '{', + ' border-color: #bb6622;', + '}', + '', + 'input.intxc', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + ' font-family: monospace;', + ' width: 100%;', + ' /* font-size: 150%; */', + '}', + '', + 'input.intxc:focus', + '{', + ' border-color: #bb6622;', + '}', + '', + '/* table.intxc', + '{', + ' width=100%;', + '} */', + '', + 'textarea.inta', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' width: 100%;', + ' margin: 2px;', + ' resize: none;', + '}', + '', + 'textarea.inta:focus', + '{', + ' border-color: #bb6622;', + '}', + '', + 'input.inbt', + '{', + ' border-color: #0057af;', + ' color: #000000;', + ' background-color: #ffffff;', + ' border-width: 2px;', + ' border-style: solid;', + ' margin: 2px;', + ' font-family: monospace;', + ' /* font-size: 150%; */', + '}', + '', + 'input.inbt:focus', + '{', + ' border-color: #bb6622;', + '}', + '', + '.br', + '{', + ' border-color: #bb6622!important;', + ' color: #bb6622!important;', + '}', + '.po', + '{', + ' border-color: #ff8800!important;', + ' color: #ff8800!important;', + '}', + '.ni', + '{', + ' border-color: #0057af!important;', + ' color: #0057af!important;', + '}', + '.bi', + '{', + ' border-color: #ffffff!important;', + ' color: #ffffff!important;', + '}', + '.cz', + '{', + ' border-color: #000000!important;', + ' color: #000000!important;', + '}', + '', + 'div.le', + '{', + ' float: left;', + '}', + 'div.pr', + '{', + ' float: right;', + '}', + '' ], 'phpbb' => [ + '* {', + ' margin: 0;', + ' padding: 0;', + '}', + 'html {', + ' font-size: 100%;', + ' height: 101%;', + '}', + 'body {', + ' color: #828282;', + ' background-color: #FFFFFF;', + ' font-size: 10px;', + ' margin: 0;', + ' padding: 12px 0;', + ' -ie-text-size-adjust: 100%;', + ' -moz-text-size-adjust: 100%;', + ' -webkit-text-size-adjust: 100%;', + '}', + 'h1 {', + ' margin-right: 200px;', + ' color: #FFFFFF;', + ' margin-top: 15px;', + ' font-weight: bold;', + ' font-size: 2em;', + '}', + 'h2 {', + ' font-weight: normal;', + ' color: #3f3f3f;', + ' font-size: 2em;', + ' margin: 0.8em 0 0.2em 0;', + '}', + 'h2.solo {', + ' margin-bottom: 1em;', + '}', + 'h3 {', + ' font-weight: bold;', + ' text-transform: uppercase;', + ' border-bottom: 1px solid #CCCCCC;', + ' margin-bottom: 3px;', + ' padding-bottom: 2px;', + ' font-size: 1.05em;', + ' color: #989898;', + ' margin-top: 20px;', + '}', + 'h4 {', + ' font-size: 1.3em;', + '}', + 'p {', + ' line-height: 1.3em;', + ' font-size: 1.1em;', + ' margin-bottom: 1.5em;', + '}', + 'img {', + ' border-width: 0;', + '}', + '#wrap {', + ' padding: 0 20px;', + ' min-width: 650px;', + '}', + '#page-body {', + ' margin: 4px 0;', + ' clear: both;', + '}', + '.post {', + ' padding: 0 10px;', + ' margin-bottom: 4px;', + ' background-repeat: no-repeat;', + ' background-position: 100% 0;', + ' border-radius: 7px;', + '}', + '.post:target .content {', + ' color: #000000;}', + '.post:target h3 a {', + ' color: #000000;', + '}', + '.bg1 { background-color: #f7f7f7;}', + '.bg2 { background-color: #f2f2f2; }', + '.bg3 { background-color: #ebebeb; }', + 'span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span {', + ' font-size: 1px;', + ' line-height: 1px;', + ' display: block;', + ' height: 5px;', + ' background-repeat: no-repeat;', + '}', + 'span.corners-top {', + ' background-image: none;', + ' background-position: 0 0;', + ' margin: 0 -5px;', + '}', + 'span.corners-top span {', + ' background-image: none;', + ' background-position: 100% 0;', + '}', + 'span.corners-bottom {', + ' background-image: none;', + ' background-position: 0 100%;', + ' margin: 0 -5px;', + ' clear: both;', + '}', + 'span.corners-bottom span {', + ' background-image: none;', + ' background-position: 100% 100%;', + '}', + '.post span.corners-top, .post span.corners-bottom, .panel span.corners-top, .panel span.corners-bottom, .navbar span.corners-top, .navbar span.corners-bottom {', + ' margin: 0 -10px;', + '}', + 'a {', + ' direction: ltr;', + ' unicode-bidi: embed;', + '}', + 'a:link { color: #898989; text-decoration: none; }', + 'a:visited { color: #898989; text-decoration: none; }', + 'a:hover { color: #d3d3d3; text-decoration: underline; }', + 'a:active { color: #d2d2d2; text-decoration: none; }', + '.postlink {', + ' text-decoration: none;', + ' color: #d2d2d2;', + ' border-bottom: 1px solid #d2d2d2;', + ' padding-bottom: 0;', + '}', + '.postlink:active {', + ' color: #d2d2d2;', + '}', + '.postlink:hover {', + ' background-color: #f6f6f6;', + ' text-decoration: none;', + ' color: #404040;', + '}', + '.postbody {', + ' padding: 0;', + ' line-height: 1.48em;', + ' color: #333333;', + ' width: 100%;', + ' float: left;', + ' clear: both;', + '}', + '.postbody h3 {', + ' font-size: 1.5em;', + ' padding: 2px 0 0 0;', + ' margin: 0 0 0.3em 0 !important;', + ' text-transform: none;', + ' border: none;', + ' line-height: 125%;', + '}', + '.postbody .content {', + ' font-size: 1.3em;', + '}', + '.content {', + ' min-height: 3em;', + ' overflow: hidden;', + ' line-height: 1.4em;', + ' font-size: 1em;', + ' color: #333333;', + ' padding-bottom: 1px;', + '}', + '.content h2, .panel h2 {', + ' font-weight: normal;', + ' color: #989898;', + ' border-bottom: 1px solid #CCCCCC;', + ' font-size: 1.6em;', + ' margin-top: 0.5em;', + ' margin-bottom: 0.5em;', + ' padding-bottom: 0.5em;', + '}', + '.content p {', + ' font-size: 1.2em;', + ' margin-bottom: 1em;', + ' line-height: 1.4em;', + '}', + '.content li {', + ' list-style-type: inherit;', + '}', + '.content ul, .content ol {', + ' margin-bottom: 1em;', + ' margin-left: 3em;', + '}', + 'p.author {', + ' margin: 0 15em 0.6em 0;', + ' padding: 0 0 5px 0;', + ' font-size: 1em;', + ' line-height: 1.2em;', + '}', + 'blockquote {', + ' background: #ebebeb none 6px 8px no-repeat;', + ' border: 1px solid #dbdbdb;', + ' font-size: 0.95em;', + ' margin: 0.5em 1px 0 25px;', + ' overflow: hidden;', + ' padding: 5px;', + '}', + 'blockquote blockquote {', + ' background-color: #bababa;', + ' font-size: 1em;', + ' margin: 0.5em 1px 0 15px; ', + '}', + 'blockquote blockquote blockquote {', + ' background-color: #e4e4e4;', + '}', + 'blockquote cite {', + ' font-style: normal;', + ' font-weight: bold;', + ' margin-left: 20px;', + ' display: block;', + ' font-size: 0.9em;', + '}', + 'blockquote cite cite {', + ' font-size: 1em;', + '}', + 'blockquote.uncited {', + ' padding-top: 25px;', + '}', + 'dl.codebox {', + ' padding: 3px;', + ' background-color: #FFFFFF;', + ' border: 1px solid #d8d8d8;', + ' font-size: 1em;', + '}', + 'dl.codebox dt {', + ' text-transform: uppercase;', + ' border-bottom: 1px solid #CCCCCC;', + ' margin-bottom: 3px;', + ' font-size: 0.8em;', + ' font-weight: bold;', + ' display: block;', + '}', + 'blockquote dl.codebox {', + ' margin-left: 0;', + '}', + 'dl.codebox code {', + ' /* Also see tweaks.css */', + ' overflow: auto;', + ' display: block;', + ' height: auto;', + ' max-height: 200px;', + ' white-space: normal;', + ' padding-top: 5px;', + ' font: 0.9em mono;', + ' line-height: 1.3em;', + ' color: #8b8b8b;', + ' margin: 2px 0;', + '}', + '.codebox {', + ' background-color: #FFF;', + ' padding: 3px;', + ' border: 1px solid #C9D2D8;', + ' font-size: 1em;', + '}', + '.codebox code {', + ' color: #2E8B57;', + ' overflow: auto;', + ' display: block;', + ' height: auto;', + ' max-height: 200px;', + ' white-space: normal;', + ' padding-top: 5px;', + ' font: mono;', + ' margin: 2px 0px;', + '}', + '.codebox p {', + ' text-transform: uppercase;', + ' border-bottom: 1px solid #CCC;', + ' margin-bottom: 3px;', + ' font-size: 0.8em !important;', + ' font-weight: bold;', + ' display: block;', + '}', + '.syntaxbg { color: #FFFFFF; }', + '.syntaxcomment { color: #000000; }', + '.syntaxdefault { color: #bcbcbc; }', + '.syntaxhtml { color: #000000; }', + '.syntaxkeyword { color: #585858; }', + '.syntaxstring { color: #a7a7a7; }', + '* html .post {', + ' height: 25%;', + ' overflow: hidden;', + '}', + 'html, body {', + ' color: #536482;', + ' background-color: #FFFFFF;', + '}', + 'h1 {', + ' color: #FFFFFF;', + '}', + 'h2 {', + ' color: #28313F;', + '}', + 'h3 {', + ' border-bottom-color: #CCCCCC;', + ' color: #115098;', + '}', + 'hr {', + ' border-color: #FFFFFF;', + ' border-top-color: #CCCCCC;', + '}', + 'hr.dashed {', + ' border-top-color: #CCCCCC;', + '}', + '.post:target .content {', + ' color: #000000;', + '}', + '.post:target h3 a {', + ' color: #000000;', + '}', + '.bg1 { background-color: #ECF3F7; }', + '.bg2 { background-color: #e1ebf2; }', + '.bg3 { background-color: #cadceb; }', + 'a:link { color: #105289; }', + 'a:visited { color: #105289; }', + 'a:hover { color: #D31141; }', + 'a:active { color: #368AD2; }', + '.postlink {', + ' color: #368AD2;', + ' border-bottom-color: #368AD2;', + '}', + '.postlink:visited {', + ' color: #5D8FBD;', + ' border-bottom-color: #5D8FBD;', + '}', + '.postlink:active {', + ' color: #368AD2;', + '}', + '.postlink:hover {', + ' background-color: #D0E4F6;', + ' color: #0D4473;', + '}', + '.postbody {', + ' color: #333333;', + '}', + '.content {', + ' color: #333333;', + '}', + '.content h2, .panel h2 {', + ' color: #115098;', + ' border-bottom-color: #CCCCCC;', + '}', + 'blockquote {', + ' background-color: #EBEADD;', + ' border-color:#DBDBCE;', + '}', + '.rtl blockquote {', + '}', + 'blockquote blockquote {', + ' background-color:#EFEED9;', + '}', + 'blockquote blockquote blockquote {', + ' background-color: #EBEADD;', + '}', + 'dl.codebox {', + ' background-color: #FFFFFF;', + ' border-color: #C9D2D8;', + '}', + 'dl.codebox dt {', + ' border-bottom-color: #CCCCCC;', + '}', + 'dl.codebox code {', + ' color: #2E8B57;', + '}', + '.syntaxbg { color: #FFFFFF; }', + '.syntaxcomment { color: #FF8000; }', + '.syntaxdefault { color: #0000BB; }', + '.syntaxhtml { color: #000000; }', + '.syntaxkeyword { color: #007700; }', + '.syntaxstring { color: #DD0000; }', + '' ] }; @@ -979,6 +1898,9 @@ sub bbcode_to_html { if ($cmd_options->{'post-style'} eq 'phpbb') { $add_html .= '
'; } + elsif ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
'; + } else { $add_html .= '
'; } @@ -993,6 +1915,9 @@ sub bbcode_to_html { if ($cmd_options->{'post-style'} eq 'phpbb') { $add_html .= '
'.$tag_value.' wrote:'; } + elsif ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
'.$tag_value.' wrote:
'; + } else { $add_html .= '
'.$tag_value.' wrote:
'; } @@ -1031,6 +1956,9 @@ sub bbcode_to_html { if ($cmd_options->{'post-style'} eq 'phpbb') { $add_html .= '
Code: Select all
'; } + elsif ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
Code:
'; + } else { $add_html .= '
Code: Select all
'; } @@ -1112,6 +2040,9 @@ sub bbcode_to_html { if ($cmd_options->{'post-style'} eq 'phpbb') { $add_html .= '
Spoiler:
'; } + elsif ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
Spoiler:
'; + } else { $add_html .= '
Spoiler:
'; } @@ -1178,7 +2109,12 @@ sub bbcode_to_html { } elsif ($tag_name eq 'quote') { - $add_html .= '
'; + if ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
'; + } + else { + $add_html .= '
'; + } } elsif ($tag_name =~ m/^(b|i|u|(size)|(color))$/gs) { @@ -1194,7 +2130,12 @@ sub bbcode_to_html { $add_html .= html_entity_encode_dec($tag_end, 1); } else { - $add_html .= ''; + if ($cmd_options->{'post-style'} eq 'bsta') { + $add_html .= '
'; + } + else { + $add_html .= ''; + } } } diff --git a/preview.1.pl b/preview.1.pl index e176711..3335deb 100644 --- a/preview.1.pl +++ b/preview.1.pl @@ -31,7 +31,7 @@ use post_common ( 'CODE', 'bbcode_to_html', 'HTML_PAGE_START', 'HTML_PAGE_END', 'HTML_POST_START', 'HTML_POST_END', - 'HTML_STYLE' + 'HTML_STYLE', 'HTML_POST_CLASS' ); ###PERL_VERSION: use constant VERSION => 'x.x.x'; @@ -145,7 +145,6 @@ if (($options{'output-file'} eq '') and ($options{'verbose'} eq '')) { $options{'quiet'} = '1'; } if ($options{'post-style'} !~ /^((botm)|(bsta)|(phpbb))$/) { - # $options{'post-style'} = 'phpbb'; $options{'post-style'} = 'botm'; } @@ -167,6 +166,7 @@ my $code; my %data; my %post; my $html; +my $i; if ($options{'output-file'} ne '') { unless (open ($fh, '>:encoding(UTF-8)', encode('locale_fs', $options{'output-file'}))) { @@ -185,10 +185,12 @@ else { $code = CODE->{'OK'}; unless ($options{'content-only'} ne '') { - print_preview($fh, HTML_PAGE_START(), \%post, \%options); + print_preview($fh, HTML_PAGE_START(), \%post, \%options, 0); } +$i = -1; foreach my $arg (@ARGV) { + $i += 1; unless ($options{'quiet'} ne '') { if ($arg == \*STDIN) { print "STDIN\n"; @@ -239,17 +241,17 @@ foreach my $arg (@ARGV) { } unless ($options{'content-only'} ne '') { - print_preview($fh, HTML_POST_START(), \%post, \%options); + print_preview($fh, HTML_POST_START(), \%post, \%options, $i); } print $fh $html."\n"; unless ($options{'content-only'} ne '') { - print_preview($fh, HTML_POST_END(), \%post, \%options); + print_preview($fh, HTML_POST_END(), \%post, \%options, $i); } } unless ($options{'content-only'} ne '') { - print_preview($fh, HTML_PAGE_END(), \%post, \%options); + print_preview($fh, HTML_PAGE_END(), \%post, \%options, $i); } close ($fh); @@ -257,7 +259,7 @@ exit $code; sub print_preview { - (my $fh, my $data, my $post, my $options) = @_; + (my $fh, my $data, my $post, my $options, my $i) = @_; my @data_list = @{$data->{$options->{'post-style'}}}; @@ -273,7 +275,7 @@ sub print_preview { if ($data_line =~ m/&_inline_css;/gs) { if ($options->{'inline-css'} ne '') { print $fh $`; - print_preview($fh, HTML_STYLE(), $post, $options); + print_preview($fh, HTML_STYLE(), $post, $options, $i); print $fh $' . "\n"; } next; @@ -283,7 +285,11 @@ sub print_preview { $data_line =~ s/&_subject;/html_entity_encode_dec($post->{'subject'},1)/gse; $data_line =~ s/&_username;/html_entity_encode_dec($post->{'username'},1)/gse; $data_line =~ s/&_time;/\$time/gs; # TODO - $data_line =~ s/&_post_class;/html_entity_encode_dec($post->{'class'},1)/gse; + if ($data_line =~ m/&_post_class/gs) { + my @class_list = @{HTML_POST_CLASS->{$options->{'post-style'}}}; + my $class = $class_list[$i % @class_list]; + $data_line =~ s/&_post_class;/$class/gs; # already html encoded + } print $fh $data_line."\n"; } -- 2.30.2