1 module ithox.qrcode.renderer.text.html; 2 3 import ithox.qrcode.encoder.qrcode; 4 import ithox.qrcode.renderer.text.plain; 5 /** 6 * Html renderer. 7 */ 8 class Html : Plain 9 { 10 /** 11 * HTML CSS class attribute value. 12 * 13 * @var string 14 */ 15 protected string css_class; 16 /** 17 * HTML CSS style definition for the code element. 18 * 19 * @var string 20 */ 21 protected string style = "font-family: monospace; line-height: 0.65em; letter-spacing: -1px"; 22 /** 23 * Set CSS class name. 24 * 25 * @param string class 26 */ 27 public void setClass(string _class) 28 { 29 this.css_class = _class; 30 } 31 /** 32 * Get CSS class name. 33 * 34 * @return string 35 */ 36 public string getClass() 37 { 38 return this.css_class; 39 } 40 /** 41 * Set CSS style value. 42 * 43 * @param string style 44 */ 45 public void setStyle(string style) 46 { 47 this.style = style; 48 } 49 /** 50 * Get CSS style value. 51 * 52 * @return string 53 */ 54 public string getStyle() 55 { 56 return this.style; 57 } 58 /** 59 * render(): defined by RendererInterface. 60 * 61 * @see RendererInterface::render() 62 * @param QrCode qrCode 63 * @return string 64 */ 65 public override string render(QrCode qrCode) 66 { 67 68 auto textCode = super.render(qrCode); 69 return "<pre>" ~ textCode ~ "</pre>"; 70 } 71 }