diff --git a/src/Output/QRString.php b/src/Output/QRString.php index 3537de246..e35087d13 100644 --- a/src/Output/QRString.php +++ b/src/Output/QRString.php @@ -85,17 +85,19 @@ class QRString extends QROutputBase implements QROutputInterface{ foreach($this->matrix as &$row){ // in order to not bloat the output too much, we use the shortest possible valid HTML tags - $html .= '
'; + $html .= '<'.$this->options->htmlRowTag.'>'; foreach($row as &$col){ $tag = $col ? 'b' // dark : 'i'; // light - $html .= '<'.$tag.'>'.$tag.'>'; + $html .= '<'.$tag.'>'.$tag.'>'; + } + + if(!(bool)$this->options->htmlOmitEndTag){ + $html .= ''.$this->options->htmlRowTag.'>'; } - // the closing
tag may be omitted -# $html .= '
'; $html .= PHP_EOL; } diff --git a/src/Output/QRStringOptions.php b/src/Output/QRStringOptions.php index 04fece1ce..ccfac292c 100644 --- a/src/Output/QRStringOptions.php +++ b/src/Output/QRStringOptions.php @@ -18,7 +18,7 @@ use chillerlan\QRCode\QRCode; */ class QRStringOptions{ - public $type = QRCode::OUTPUT_STRING_TEXT; + public $type = QRCode::OUTPUT_STRING_HTML; public $textDark = '#'; @@ -26,4 +26,8 @@ class QRStringOptions{ public $textNewline = PHP_EOL; + public $htmlRowTag = 'p'; + + public $htmlOmitEndTag = true; + }