eric6/QScintilla/Exporters/ExporterHTML.py

branch
maintenance
changeset 8043
0acf98cd089a
parent 7924
8a96736d465e
parent 7960
e8fc383322f7
child 8273
698ae46f40a4
diff -r 866adc8c315b -r 0acf98cd089a eric6/QScintilla/Exporters/ExporterHTML.py
--- a/eric6/QScintilla/Exporters/ExporterHTML.py	Sun Jan 17 13:53:08 2021 +0100
+++ b/eric6/QScintilla/Exporters/ExporterHTML.py	Mon Feb 01 10:38:16 2021 +0100
@@ -44,13 +44,13 @@
         """
         Public method to generate HTML for the source editor.
         
-        @keyparam tabSize size of tabs (integer)
-        @keyparam useTabs flag indicating the use of tab characters (boolean)
-        @keyparam wysiwyg flag indicating colorization (boolean)
-        @keyparam folding flag indicating usage of fold markers
-        @keyparam onlyStylesUsed flag indicating to include only style
+        @param tabSize size of tabs (integer)
+        @param useTabs flag indicating the use of tab characters (boolean)
+        @param wysiwyg flag indicating colorization (boolean)
+        @param folding flag indicating usage of fold markers
+        @param onlyStylesUsed flag indicating to include only style
             definitions for styles used in the source (boolean)
-        @keyparam titleFullPath flag indicating to include the full file path
+        @param titleFullPath flag indicating to include the full file path
             in the title tag (boolean)
         @return generated HTML text (string)
         """
@@ -86,7 +86,7 @@
             html += '''<title>{0}</title>\n'''.format(
                 os.path.basename(self.editor.getFileName()))
         html += (
-            '''<meta name="Generator" content="eric6" />\n'''
+            '''<meta name="Generator" content="eric" />\n'''
             '''<meta http-equiv="Content-Type" '''
             '''content="text/html; charset=utf-8" />\n'''
         )
@@ -165,6 +165,29 @@
                             html += '''    font-size: {0:d}pt;\n'''.format(
                                     QFontInfo(font).pointSize())
                         html += '''}\n'''
+                        
+                        # get substyles
+                        subs_start, subs_count = self.editor.getSubStyleRange(
+                            istyle)
+                        for subs_idx in range(subs_count):
+                            styleIsUsed[subs_idx - subs_start] = True
+                            font = lex.font(subs_start + subs_idx)
+                            colour = lex.color(subs_start + subs_idx)
+                            paper = lex.paper(subs_start + subs_idx)
+                            html += '.S{0:d} {{\n'.format(
+                                subs_idx - subs_start)
+                            if font.italic():
+                                html += '    font-style: italic;\n'
+                            if font.bold():
+                                html += '    font-weight: bold;\n'
+                            if wysiwyg:
+                                html += "    font-family: '{0}';\n".format(
+                                        font.family())
+                            html += '    color: {0};\n'.format(colour.name())
+                            if wysiwyg:
+                                html += '    font-size: {0:d}pt;\n'.format(
+                                        QFontInfo(font).pointSize())
+                            html += '}\n'
                     else:
                         styleIsUsed[istyle] = False
                 istyle += 1
@@ -659,7 +682,7 @@
             head += '''<title>{0}</title>\n'''.format(
                 os.path.basename(self.editor.getFileName()))
         head += (
-            '''<meta name="Generator" content="eric6" />\n'''
+            '''<meta name="Generator" content="eric" />\n'''
             '''<meta http-equiv="Content-Type" '''
             '''content="text/html; charset=utf-8" />\n'''
             '''{0}'''

eric ide

mercurial