LCOV - code coverage report
Current view: top level - io/source/document - document_css_writer.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.61.0_covts Lines: 0 19 0.0 %
Date: 2024-10-26 21:44:38 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* File: document_css_writer.c; Copyright and License: see below */
       2             : 
       3             : #include "document/document_css_writer.h"
       4             : #include "utf8stringbuf/utf8string.h"
       5             : #include "u8/u8_trace.h"
       6             : #include "u8/u8_log.h"
       7             : #include <stdbool.h>
       8             : #include <assert.h>
       9             : 
      10             : /* IO_FILE_FORMAT_CSS */
      11             : 
      12             : static const char CSS_ALL[]
      13             : ="body {\n"
      14             : "    background-color: rgb(255,255,255);\n"
      15             : "    font-family: Helvetica,Arial,sans-serif;\n"
      16             : "}\n"
      17             : ".toc1 {\n"
      18             : "    color: rgb(192,128,0);\n"
      19             : "    font-size: small;\n"
      20             : "    counter-reset: cnt-head-two;\n"
      21             : "}\n"
      22             : ".toc2::before {\n"
      23             : "    counter-increment: cnt-head-two;\n"
      24             : "    content: counter(cnt-head-two) \"\\0000a0 \";\n"
      25             : "}\n"
      26             : ".toc2 {\n"
      27             : "    color: rgb(192,128,0);\n"
      28             : "    font-size: small;\n"
      29             : "    counter-reset: cnt-head-three;\n"
      30             : "}\n"
      31             : ".toc3::before {\n"
      32             : "    counter-increment: cnt-head-three;\n"
      33             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \"\\0000a0 \";\n"
      34             : "}\n"
      35             : ".toc3 {\n"
      36             : "    color: rgb(192,128,0);\n"
      37             : "    font-size: x-small;\n"
      38             : "    counter-reset: cnt-head-four;\n"
      39             : "}\n"
      40             : ".toc4::before {\n"
      41             : "    counter-increment: cnt-head-four;\n"
      42             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \"\\0000a0 \";\n"
      43             : "}\n"
      44             : ".toc4 {\n"
      45             : "    color: rgb(192,128,0);\n"
      46             : "    font-size: xx-small;\n"
      47             : "    counter-reset: cnt-head-five;\n"
      48             : "}\n"
      49             : ".toc5::before {\n"
      50             : "    counter-increment: cnt-head-five;\n"
      51             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \".\" counter(cnt-head-five) \"\\0000a0 \";\n"
      52             : "}\n"
      53             : ".toc5 {\n"
      54             : "    color: rgb(192,128,0);\n"
      55             : "    font-size: xx-small;\n"
      56             : "    counter-reset: cnt-head-six;\n"
      57             : "}\n"
      58             : ".toc6::before {\n"
      59             : "    counter-increment: cnt-head-six;\n"
      60             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \".\" counter(cnt-head-five) \".\" counter(cnt-head-six) \"\\0000a0 \";\n"
      61             : "}\n"
      62             : ".toc6 {\n"
      63             : "    color: rgb(192,128,0);\n"
      64             : "    font-size: xx-small;\n"
      65             : "}\n"
      66             : ".diag-title {\n"
      67             : "    color: rgb(192,128,0);\n"
      68             : "}\n"
      69             : ".diag-stereo::before {\n"
      70             : "    content:\"\\0000a0 \\0000ab\";\n"
      71             : "}\n"
      72             : ".diag-stereo {\n"
      73             : "    color: rgb(80,80,80);\n"
      74             : "}\n"
      75             : ".diag-stereo::after {\n"
      76             : "    content: \"\\0000bb\";\n"
      77             : "}\n"
      78             : ".diag-name {\n"
      79             : "    color: rgb(128,128,128);\n"
      80             : "}\n"
      81             : ".diag-type::before {\n"
      82             : "    content:\"\\0000a0 \\0000a0 {type=\";\n"
      83             : "}\n"
      84             : ".diag-type {\n"
      85             : "    color: rgb(160,160,160);\n"
      86             : "}\n"
      87             : ".diag-type::after {\n"
      88             : "    content: \"}\";\n"
      89             : "}\n"
      90             : ".diag-id::before {\n"
      91             : "    content:\"\\0000a0 \\0000a0 {id=\";\n"
      92             : "}\n"
      93             : ".diag-id {\n"
      94             : "    color: rgb(160,160,160);\n"
      95             : "}\n"
      96             : ".diag-id::after {\n"
      97             : "    content: \"}\";\n"
      98             : "}\n"
      99             : ".diag-descr {\n"
     100             : "    padding: 8px;\n"
     101             : "    margin-left: 2px;\n"
     102             : "    margin-right: 2px;\n"
     103             : "    margin-top: 2px;\n"
     104             : "    margin-bottom: 12px;\n"
     105             : "    border: 1px solid #CC8800;\n"
     106             : "}\n"
     107             : ".clas {\n"
     108             : "    background-color: rgb(240,240,240);\n"
     109             : "    margin-top: 8px;\n"
     110             : "}\n"
     111             : ".clas-stereo::before {\n"
     112             : "    content:\"\\0000a0 \\0000ab\";\n"
     113             : "}\n"
     114             : ".clas-stereo {\n"
     115             : "    color: rgb(80,80,80);\n"
     116             : "}\n"
     117             : ".clas-stereo::after {\n"
     118             : "    content: \"\\0000bb\";\n"
     119             : "}\n"
     120             : ".clas-name {\n"
     121             : "    color: rgb(192,128,0);\n"
     122             : "}\n"
     123             : ".clas-type::before {\n"
     124             : "    content:\"\\0000a0 \\0000a0 {type=\";\n"
     125             : "}\n"
     126             : ".clas-type {\n"
     127             : "    color: rgb(160,160,160);\n"
     128             : "}\n"
     129             : ".clas-type::after {\n"
     130             : "    content: \"}\";\n"
     131             : "}\n"
     132             : ".clas-id::before {\n"
     133             : "    content:\"\\0000a0 \\0000a0 {id=\";\n"
     134             : "}\n"
     135             : ".clas-id {\n"
     136             : "    color: rgb(160,160,160);\n"
     137             : "}\n"
     138             : ".clas-id::after {\n"
     139             : "    content: \"}\";\n"
     140             : "}\n"
     141             : ".clas-see::before {\n"
     142             : "    content:\"appears in \";\n"
     143             : "}\n"
     144             : ".clas-see {\n"
     145             : "    text-align: right;\n"
     146             : "    font-size: x-small;\n"
     147             : "    color: rgb(160,160,160);\n"
     148             : "}\n"
     149             : ".clas-descr {\n"
     150             : "    background-color: rgb(255,255,255);\n"
     151             : "    padding: 8px;\n"
     152             : "    margin: 2px;\n"
     153             : "    border: 1px solid #CCCCCC;\n"
     154             : "}\n"
     155             : ".feat {\n"
     156             : "    background-color: rgb(255,255,255);\n"
     157             : "    font-size: small;\n"
     158             : "    margin-left: 32px;\n"
     159             : "    margin-right: 32px;\n"
     160             : "    border: 1px solid #F0F0F0;\n"
     161             : "}\n"
     162             : ".feat-stereo::before {\n"
     163             : "    content:\"\\0000a0 \\0000ab\";\n"
     164             : "}\n"
     165             : ".feat-stereo {\n"
     166             : "    color: rgb(80,80,80);\n"
     167             : "}\n"
     168             : ".feat-stereo::after {\n"
     169             : "    content: \"\\0000bb\";\n"
     170             : "}\n"
     171             : /* ".feat-name {\n" */
     172             : /* "    color: rgb(0,0,0);\n" */
     173             : /* "}\n" */
     174             : ".feat-type::before {\n"
     175             : "    content:\"\\0000a0 \\0000a0 {type=\";\n"
     176             : "}\n"
     177             : ".feat-type {\n"
     178             : "    color: rgb(160,160,160);\n"
     179             : "}\n"
     180             : ".feat-type::after {\n"
     181             : "    content: \"}\";\n"
     182             : "}\n"
     183             : ".feat-id::before {\n"
     184             : "    content: \"\\0000a0 \\0000a0 {id=\";\n"
     185             : "}\n"
     186             : ".feat-id {\n"
     187             : "    color: rgb(160,160,160);\n"
     188             : "}\n"
     189             : ".feat-id::after {\n"
     190             : "    content :\"}\";\n"
     191             : "}\n"
     192             : ".feat-descr {\n"
     193             : "    background-color: rgb(255,255,255);\n"
     194             : "    padding: 8px;\n"
     195             : "    margin: 2px;\n"
     196             : "    border: 1px solid #CCCCCC;\n"
     197             : "}\n"
     198             : ".rel {\n"
     199             : "    background-color: rgb(255,255,255);\n"
     200             : "    font-size: small;\n"
     201             : "    margin-left: 32px;\n"
     202             : "    margin-right: 32px;\n"
     203             : "}\n"
     204             : ".rel-stereo::before {\n"
     205             : "    content:\"\\0000a0 \\0000ab\";\n"
     206             : "}\n"
     207             : ".rel-stereo {\n"
     208             : "    color: rgb(80,80,80);\n"
     209             : "}\n"
     210             : ".rel-stereo::after {\n"
     211             : "    content: \"\\0000bb\";\n"
     212             : "}\n"
     213             : /* ".rel-name {\n" */
     214             : /* "    color: rgb(0,0,0);\n" */
     215             : /* "}\n" */
     216             : /* ".rel-dest {\n" */
     217             : /* "    color: rgb(0,0,0);\n" */
     218             : /* "}\n" */
     219             : ".rel-type::before {\n"
     220             : "    content:\"\\0000a0 \\0000a0 {type=\";\n"
     221             : "}\n"
     222             : ".rel-type {\n"
     223             : "    color: rgb(160,160,160);\n"
     224             : "}\n"
     225             : ".rel-type::after {\n"
     226             : "    content: \"}\";\n"
     227             : "}\n"
     228             : ".rel-id::before {\n"
     229             : "    content: \"\\0000a0 \\0000a0 {id=\";\n"
     230             : "}\n"
     231             : ".rel-id {\n"
     232             : "    color: rgb(160,160,160);\n"
     233             : "}\n"
     234             : ".rel-id::after {\n"
     235             : "    content: \"}\";\n"
     236             : "}\n"
     237             : ".rel-descr {\n"
     238             : "    background-color: rgb(255,255,255);\n"
     239             : "    padding: 8px;\n"
     240             : "    margin: 2px;\n"
     241             : "    border: 1px solid #CCCCCC;\n"
     242             : "}\n"
     243             : "h1 {\n"
     244             : "    counter-reset: cnt-head-two;\n"
     245             : "}\n"
     246             : "h2::before {\n"
     247             : "    counter-increment: cnt-head-two;\n"
     248             : "    content: counter(cnt-head-two) \"\\0000a0 \";\n"
     249             : "}\n"
     250             : "h2 {\n"
     251             : "    counter-reset: cnt-head-three;\n"
     252             : "}\n"
     253             : "h3::before {\n"
     254             : "    counter-increment: cnt-head-three;\n"
     255             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \"\\0000a0 \";\n"
     256             : "}\n"
     257             : "h3 {\n"
     258             : "    counter-reset: cnt-head-four;\n"
     259             : "}\n"
     260             : "h4::before {\n"
     261             : "    counter-increment: cnt-head-four;\n"
     262             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \"\\0000a0 \";\n"
     263             : "}\n"
     264             : "h4 {\n"
     265             : "    counter-reset: cnt-head-five;\n"
     266             : "}\n"
     267             : "h5::before {\n"
     268             : "    counter-increment: cnt-head-five;\n"
     269             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \".\" counter(cnt-head-five) \"\\0000a0 \";\n"
     270             : "}\n"
     271             : "h5 {\n"
     272             : "    counter-reset: cnt-head-six;\n"
     273             : "}\n"
     274             : "h6::before {\n"
     275             : "    counter-increment: cnt-head-six;\n"
     276             : "    content: counter(cnt-head-two) \".\" counter(cnt-head-three) \".\" counter(cnt-head-four) \".\" counter(cnt-head-five) \".\" counter(cnt-head-six) \"\\0000a0 \";\n"
     277             : "}\n"
     278             : "p {\n"
     279             : "    padding: 2px;\n"
     280             : "    margin: 0px;\n"
     281             : "}\n";
     282             : 
     283           0 : void document_css_writer_init ( document_css_writer_t *this_,
     284             :                                 universal_output_stream_t *output )
     285             : {
     286           0 :     U8_TRACE_BEGIN();
     287           0 :     assert( NULL != output );
     288             : 
     289           0 :     (*this_).output = output;
     290             : 
     291           0 :     U8_TRACE_END();
     292           0 : }
     293             : 
     294           0 : void document_css_writer_destroy( document_css_writer_t *this_ )
     295             : {
     296           0 :     U8_TRACE_BEGIN();
     297             : 
     298           0 :     (*this_).output = NULL;
     299             : 
     300           0 :     U8_TRACE_END();
     301           0 : }
     302             : 
     303           0 : u8_error_t document_css_writer_write_stylesheet( document_css_writer_t *this_ )
     304             : {
     305           0 :     U8_TRACE_BEGIN();
     306           0 :     u8_error_t export_err = U8_ERROR_NONE;
     307             : 
     308           0 :     utf8string_t *text = CSS_ALL;
     309           0 :     const size_t text_len = utf8string_get_length(text);
     310           0 :     export_err |= universal_output_stream_write( (*this_).output, text, text_len);
     311             : 
     312           0 :     U8_TRACE_END_ERR( export_err );
     313           0 :     return export_err;
     314             : }
     315             : 
     316             : 
     317             : /*
     318             : Copyright 2017-2024 Andreas Warnke
     319             : 
     320             : Licensed under the Apache License, Version 2.0 (the "License");
     321             : you may not use this file except in compliance with the License.
     322             : You may obtain a copy of the License at
     323             : 
     324             :     http://www.apache.org/licenses/LICENSE-2.0
     325             : 
     326             : Unless required by applicable law or agreed to in writing, software
     327             : distributed under the License is distributed on an "AS IS" BASIS,
     328             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     329             : See the License for the specific language governing permissions and
     330             : limitations under the License.
     331             : */

Generated by: LCOV version 1.16