Apply the CSS correctly when generating vehicle/ordnance notes as an image.

master
Pacman Ghost 5 years ago
parent f8eb902e7e
commit 55e45af6f3
  1. 23
      vasl_templates/webapp/data/default-template-pack/ob_vo_note.css
  2. 20
      vasl_templates/webapp/data/default-template-pack/ob_vo_note.j2
  3. 6
      vasl_templates/webapp/static/snippets.js
  4. 2
      vasl_templates/webapp/vo_notes.py

@ -0,0 +1,23 @@
/* NOTE: This CSS is split out into a separate file so we can apply it when generating Chapter H notes as images. */
img.piece { float: left ; margin-right: 0.5em ; }
.header { margin-bottom: 0.25em ; }
.header .note-number { font-weight: bold ; }
.header .name { font-weight: bold ; font-style: italic ; }
.content { text-align: justify ; }
.content p { margin-top: 5px ; }
.content ul { margin-left: 0 ; padding-left: 25px ; list-style-image: url("{{IMAGES_BASE_URL}}/bullet.png") ; }
.content li { margin-bottom: 2px ; }
.content .example { font-size: 90% ; font-style: italic ; }
.content .rf { font-style: italic ; color: #444 ; }
.content .lfloat { float: left ; margin-right: 0.5em ; }
.content .rfloat { float: right ; margin-left: 0.5em ; }
.content table { margin: 0 10px 0 10px ; margin-top: -0.5em ; }
.content table th { padding: 2px 10px 2px 5px ; text-align: left ; background: #f0f0f0 ; }
.content table td { padding: 0 10px 0 5px ; }
table.layout td { padding: 0 5px 0 5px ; }
.content .rf { display: none ; }

@ -2,25 +2,7 @@
<head>
<meta charset="utf-8">
<style>
img.piece { float: left ; margin-right: 0.5em ; }
.header { margin-bottom: 0.25em ; }
.header .note-number { font-weight: bold ; }
.header .name { font-weight: bold ; font-style: italic ; }
.content { text-align: justify ; }
.content p { margin-top: 5px ; }
.content ul { margin-left: 0 ; padding-left: 25px ; list-style-image: url("{{IMAGES_BASE_URL}}/bullet.png") ; }
.content li { margin-bottom: 2px ; }
.content .example { font-size: 90% ; font-style: italic ; }
.content .rf { font-style: italic ; color: #444 ; }
.content .lfloat { float: left ; margin-right: 0.5em ; }
.content .rfloat { float: right ; margin-left: 0.5em ; }
.content table { margin: 0 10px 0 10px ; margin-top: -0.5em ; }
.content table th { padding: 2px 10px 2px 5px ; text-align: left ; background: #f0f0f0 ; }
.content table td { padding: 0 10px 0 5px ; }
table.layout td { padding: 0 5px 0 5px ; }
.content .rf { display: none ; }
</style>
<style> {{CSS:ob_vo_note}} </style>
</head>
<table>

@ -375,8 +375,10 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
var templ = get_template( template_id, true ) ;
if ( templ === null )
return { content: "[error: can't find template]" } ;
for ( var incl in gTemplatePack.includes )
templ = strReplaceAll( templ, "{{INCLUDE:"+incl+"}}", gTemplatePack.includes[incl] ) ;
for ( var key in gTemplatePack.css )
templ = strReplaceAll( templ, "{{CSS:"+key+"}}", gTemplatePack.css[key] ) ;
for ( key in gTemplatePack.includes )
templ = strReplaceAll( templ, "{{INCLUDE:"+key+"}}", gTemplatePack.includes[key] ) ;
var func ;
try {
func = jinja.compile( templ ).render ;

@ -236,7 +236,7 @@ def _make_vo_note_html( vo_note ):
url_root = url_root[:-1]
# inject the CSS (we do it like this since VASSAL doesn't support <link> :-/)
css = globvars.template_pack.get( "css", {} ).get( "vo_note" )
css = globvars.template_pack.get( "css", {} ).get( "ob_vo_note" )
if css:
vo_note = "<head>\n<style>\n{}\n</style>\n</head>\n\n{}".format( css, vo_note )

Loading…
Cancel
Save