diff --git a/vasl_templates/webapp/data/default-template-pack/ma_note.css b/vasl_templates/webapp/data/default-template-pack/ma_note.css
deleted file mode 100644
index caf7e89..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ma_note.css
+++ /dev/null
@@ -1,17 +0,0 @@
-.ma-note { margin: 2px 0 3px 0 ; text-align: justify ; }
-.ma-note .key { font-weight: bold ; }
-.ma-note table { margin-left: 10px ; }
-.ma-note td { padding: 0 ; }
-.ma-note ul { padding-left: 10px ; list-style-image: url("{{IMAGES_BASE_URL}}/bullet.png") ; }
-.ma-note li { margin-bottom: 2px ; }
-.ma-note .example { font-size: 90% ; font-style: italic ; }
-.ma-note table { margin-left: 10px ; margin-top: -5px ; }
-.ma-note table th { padding: 2px 10px 2px 5px ; text-align: left ; background: #f0f0f0 ; }
-.ma-note table td { padding: 0 10px 0 5px ; }
-
-.extra-notes-caption { border: 1px solid #e0e0e0 ; background: #fcfcfc ; font-weight: bold ; padding: 2px 5px ; }
-.slashed { text-decoration: line-through ; }
-
-p { margin-top: 5px ; margin-bottom: 0 ; }
-ul { margin: 0 0 0 15px ; padding: 0 ; }
-sup { font-size: 75% ; }
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2 b/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2
new file mode 100644
index 0000000..2ebe201
--- /dev/null
+++ b/vasl_templates/webapp/data/default-template-pack/ob_ma_notes.j2
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+ {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} {{VO_TYPE}} Notes
+
+{%if OB_MA_NOTES%}
+ |
+{%for ma_note in OB_MA_NOTES%}
+ {{ma_note}}
+{%endfor%}
+{%endif%}
+
+{%if OB_EXTRA_MA_NOTES%}
+ |
+{%if OB_EXTRA_MA_NOTES_CAPTION%} {%endif%}
+{%for ma_note in OB_EXTRA_MA_NOTES%}
+ {{ma_note}}
+{%endfor%}
+{%endif%}
+
+ |
+
+
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_ordnance.j2 b/vasl_templates/webapp/data/default-template-pack/ob_ordnance.j2
deleted file mode 100644
index 3720142..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_ordnance.j2
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} Ordnance
-
-{%for ord in OB_ORDNANCE%}
- |
-
- {{ord.name}} {%if ord.elite%}Ⓔ{%endif%}
- {%if ord.image%} {%endif%}
-
- {%if ord.extn_id%} ❖ {%endif%}
- {%if ord.notes%}
- {{ord.note_number}}, {{ord.notes | join(", ")}}
- {%else%}
- {{ord.note_number}}
- {%endif%}
-
- |
- {%for cap in ord.capabilities%} {{cap}} {%endfor%}
- {%for cmnt in ord.comments%} {%endfor%}
-{%endfor%}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_ordnance_ma_notes.j2 b/vasl_templates/webapp/data/default-template-pack/ob_ordnance_ma_notes.j2
deleted file mode 100644
index 8d1f5bd..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_ordnance_ma_notes.j2
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} Ordnance Notes
-
-{%if OB_ORDNANCE_MA_NOTES%}
- |
-{%for ma_note in OB_ORDNANCE_MA_NOTES%}
- {{ma_note}}
-{%endfor%}
-{%endif%}
-
-{%if OB_ORDNANCE_EXTRA_MA_NOTES%}
- |
-{%if OB_ORDNANCE_EXTRA_MA_NOTES_CAPTION%} {%endif%}
-{%for ma_note in OB_ORDNANCE_EXTRA_MA_NOTES%}
- {{ma_note}}
-{%endfor%}
-{%endif%}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_ordnance_note.j2 b/vasl_templates/webapp/data/default-template-pack/ob_ordnance_note.j2
deleted file mode 100644
index eeed342..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_ordnance_note.j2
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{ORDNANCE_NAME}}
-
- |
- {{ORDNANCE_NOTE_HTML}}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vehicle_note.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vehicle_note.j2
deleted file mode 100644
index a40e0b9..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_vehicle_note.j2
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{VEHICLE_NAME}}
-
- |
- {{VEHICLE_NOTE_HTML}}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vehicles.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vehicles.j2
deleted file mode 100644
index eb0a0d0..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_vehicles.j2
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} Vehicles
-
-{%for veh in OB_VEHICLES%}
- |
-
- {{veh.name}} {%if veh.elite%}Ⓔ{%endif%}
- {%if veh.image%} {%endif%}
-
- {%if veh.extn_id%} ❖ {%endif%}
- {%if veh.notes%}
- {{veh.note_number}}, {{veh.notes | join(", ")}}
- {%else%}
- {{veh.note_number}}
- {%endif%}
-
- |
- {%for cap in veh.capabilities%} {{cap}} {%endfor%}
- {%for cmnt in veh.comments%} {%endfor%}
-{%endfor%}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vehicles_ma_notes.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vehicles_ma_notes.j2
deleted file mode 100644
index 96a3ab4..0000000
--- a/vasl_templates/webapp/data/default-template-pack/ob_vehicles_ma_notes.j2
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} Vehicle Notes
-
-{%if OB_VEHICLES_MA_NOTES%}
- |
-{%for ma_note in OB_VEHICLES_MA_NOTES%}
- {{ma_note}}
-{%endfor%}
-{%endif%}
-
-{%if OB_VEHICLES_EXTRA_MA_NOTES%}
- |
-{%if OB_VEHICLES_EXTRA_MA_NOTES_CAPTION%} {%endif%}
-{%for ma_note in OB_VEHICLES_EXTRA_MA_NOTES%}
- {{ma_note}}
-{%endfor%}
-{%endif%}
-
- |
-
-
diff --git a/vasl_templates/webapp/data/default-template-pack/ob_vo.j2 b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2
new file mode 100644
index 0000000..f367680
--- /dev/null
+++ b/vasl_templates/webapp/data/default-template-pack/ob_vo.j2
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+ {%if PLAYER_FLAG%} {%endif%}{{PLAYER_NAME}} {{VO_TYPES}}
+
+{%for vo in OB_VO%}
+ |
+
+ {{vo.name}} {%if vo.elite%}Ⓔ{%endif%}
+ {%if vo.image%} {%endif%}
+
+ {%if vo.extn_id%} ❖ {%endif%}
+ {%if vo.notes%}
+ {{vo.note_number}}, {{vo.notes | join(", ")}}
+ {%else%}
+ {{vo.note_number}}
+ {%endif%}
+
+ |
+ {%for cap in vo.capabilities%} {{cap}} {%endfor%}
+ {%for cmnt in vo.comments%} {%endfor%}
+{%endfor%}
+
+ |
+
+
diff --git a/vasl_templates/webapp/data/default-template-pack/vo_note.css b/vasl_templates/webapp/data/default-template-pack/ob_vo_note.j2
similarity index 70%
rename from vasl_templates/webapp/data/default-template-pack/vo_note.css
rename to vasl_templates/webapp/data/default-template-pack/ob_vo_note.j2
index f6be1d4..eb54ce6 100644
--- a/vasl_templates/webapp/data/default-template-pack/vo_note.css
+++ b/vasl_templates/webapp/data/default-template-pack/ob_vo_note.j2
@@ -1,9 +1,12 @@
-img.piece { float: left ; margin-right: 0.5em ; }
+
+
+
+
+
+
+
+
+
+
+ {%if PLAYER_FLAG%} {%endif%}{{VO_NAME}}
+
+ |
+ {{VO_NOTE_HTML}}
+
+ |
+
+
diff --git a/vasl_templates/webapp/data/default-template-pack/vo.css b/vasl_templates/webapp/data/default-template-pack/vo.css
deleted file mode 100644
index 89e9b09..0000000
--- a/vasl_templates/webapp/data/default-template-pack/vo.css
+++ /dev/null
@@ -1,5 +0,0 @@
-td { margin: 0 ; padding: 0 ; }
-sup { font-size: 75% ; }
-
-.note { margin-top: 2px ; font-size: 90% ; font-style: italic ; color: #808080 ; }
-.comment { font-size: 90% ; font-style: italic ; color: #404040 ; }
diff --git a/vasl_templates/webapp/snippets.py b/vasl_templates/webapp/snippets.py
index 9c63a70..c07f72f 100644
--- a/vasl_templates/webapp/snippets.py
+++ b/vasl_templates/webapp/snippets.py
@@ -112,9 +112,24 @@ def _do_get_template_pack( dname ):
relpath = os.path.relpath( os.path.abspath(fname), dname )
if relpath.startswith( "extras" + os.sep ):
fname_stem = "extras/" + fname_stem
- templates[fname_stem] = fp.read()
+ # FUDGE! In early versions of this program, the vehicles and ordnance templates were different
+ # (e.g. because only vehicles can be radioless, only ordnance can be QSU), but once everything
+ # was handled via generic capabilities, they became the same. We would therefore like to have
+ # a single template file handle both vehicles and ordnance, but the program had been architected
+ # in such a way that vehicles and ordnance snippets are generated from their own templates,
+ # so rather than re-architect the program, we maintain separate templates, that just happen
+ # to be read from the same file. This causes a bit of stuffing around when the code needs to know
+ # what file a template comes from (e.g. loading a template pack), but it's mostly transparent...
+ if fname_stem == "ob_vo":
+ templates["ob_vehicles"] = templates["ob_ordnance"] = fp.read()
+ elif fname_stem == "ob_vo_note":
+ templates["ob_vehicle_note"] = templates["ob_ordnance_note"] = fp.read()
+ elif fname_stem == "ob_ma_notes":
+ templates["ob_vehicles_ma_notes"] = templates["ob_ordnance_ma_notes"] = fp.read()
+ else:
+ templates[fname_stem] = fp.read()
elif extn == ".css":
- css[fname_stem] = fp.read().strip()
+ css[fname_stem] = fp.read()
return nationalities, templates, css
# ---------------------------------------------------------------------
diff --git a/vasl_templates/webapp/static/snippets.js b/vasl_templates/webapp/static/snippets.js
index a127699..7dfb6da 100644
--- a/vasl_templates/webapp/static/snippets.js
+++ b/vasl_templates/webapp/static/snippets.js
@@ -148,46 +148,54 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
} else
params.SNIPPET_ID = template_id ;
+ // set the vehicle/ordnance labels
+ if ( template_id.indexOf( "_vehicles_" ) !== -1 ) {
+ params.VO_TYPE = "Vehicle" ;
+ params.VO_TYPES = "Vehicles" ;
+ } else if ( template_id.indexOf( "_ordnance_" ) !== -1 ) {
+ params.VO_TYPE = "Ordnance" ;
+ params.VO_TYPES = "Ordnance" ;
+ }
+
// set player-specific parameters
if ( template_id === "ob_vehicles_1" ) {
template_id = "ob_vehicles" ;
- params.OB_VEHICLES = params.OB_VEHICLES_1 ;
- params.OB_VEHICLES_WIDTH = params.OB_VEHICLES_WIDTH_1 ;
+ params.OB_VO = params.OB_VEHICLES_1 ;
+ params.OB_VO_WIDTH = params.OB_VEHICLES_WIDTH_1 ;
snippet_save_name = params.PLAYER_1 + " vehicles" ;
} else if ( template_id === "ob_vehicles_2" ) {
template_id = "ob_vehicles" ;
- params.OB_VEHICLES = params.OB_VEHICLES_2 ;
- params.OB_VEHICLES_WIDTH = params.OB_VEHICLES_WIDTH_2 ;
+ params.OB_VO = params.OB_VEHICLES_2 ;
+ params.OB_VO_WIDTH = params.OB_VEHICLES_WIDTH_2 ;
snippet_save_name = params.PLAYER_2 + " vehicles" ;
}
if ( template_id === "ob_ordnance_1" ) {
template_id = "ob_ordnance" ;
- params.OB_ORDNANCE = params.OB_ORDNANCE_1 ;
- params.OB_ORDNANCE_WIDTH = params.OB_ORDNANCE_WIDTH_1 ;
+ params.OB_VO = params.OB_ORDNANCE_1 ;
+ params.OB_VO_WIDTH = params.OB_ORDNANCE_WIDTH_1 ;
snippet_save_name = params.PLAYER_1 + " ordnance" ;
} else if ( template_id === "ob_ordnance_2" ) {
template_id = "ob_ordnance" ;
- params.OB_ORDNANCE = params.OB_ORDNANCE_2 ;
- params.OB_ORDNANCE_WIDTH = params.OB_ORDNANCE_WIDTH_2 ;
+ params.OB_VO = params.OB_ORDNANCE_2 ;
+ params.OB_VO_WIDTH = params.OB_ORDNANCE_WIDTH_2 ;
snippet_save_name = params.PLAYER_2 + " ordnance" ;
}
// set vehicle/ordnance note parameters
function set_vo_note( vo_type ) {
var data = $btn.parent().parent().data( "sortable2-data" ) ;
- var key = (vo_type === "vehicles") ? "VEHICLE" : "ORDNANCE" ;
- params[ key + "_NAME" ] = data.vo_entry.name ;
+ params.VO_NAME = data.vo_entry.name ;
if ( data.vo_note.substr( 0, 7 ) === "http://" ) {
// the vehicle/ordnance note is an image - just include it directly
- params[ key + "_NOTE_HTML" ] = '' ;
+ params.VO_NOTE_HTML = '' ;
} else {
// the vehicle/ordnance is HTML - check if we should show it as HTML or as an image
if ( gUserSettings["vo-notes-as-images"] ) {
// show the vehicle/ordnance note as an image
- params[ key + "_NOTE_HTML" ] = '' ;
+ params.VO_NOTE_HTML = '' ;
} else {
// insert the raw HTML into the snippet
- params[ key + "_NOTE_HTML" ] = data.vo_note ;
+ params.VO_NOTE_HTML = data.vo_note ;
}
}
snippet_save_name = data.vo_entry.name ;
@@ -197,18 +205,6 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
else if ( template_id === "ob_ordnance_note" )
set_vo_note( "ordnance" ) ;
- // install the CSS
- function install_css( key ) {
- if ( gTemplatePack.css[ key ] ) {
- params[ key.toUpperCase() + "_CSS" ] = strReplaceAll(
- gTemplatePack.css[key], "{{IMAGES_BASE_URL}}", params.IMAGES_BASE_URL
- ) ;
- }
- }
- install_css( "vo" ) ;
- install_css( "vo_note" ) ;
- install_css( "ma_note" ) ;
-
// generate snippets for multi-applicable vehicle/ordnance notes
var pos ;
function add_ma_notes( ma_notes, keys, param_name, nat, vo_type ) {
@@ -266,8 +262,7 @@ function make_snippet( $btn, params, extra_params, show_date_warnings )
var vo_type_uc = vo_type.toUpperCase() ;
var postfixes = [ "MA_NOTES", "MA_NOTES_WIDTH", "EXTRA_MA_NOTES", "EXTRA_MA_NOTES_CAPTION" ] ;
for ( var i=0 ; i < postfixes.length ; ++i ) {
- var stem = "OB_" + vo_type_uc + "_" + postfixes[i] ;
- params[ stem ] = params[ stem + "_" + player_no ] ;
+ params[ "OB_" + postfixes[i] ] = params[ "OB_" + vo_type_uc + "_" + postfixes[i] + "_" + player_no ] ;
}
snippet_save_name = params["PLAYER_"+player_no] + (vo_type === "vehicles" ? " vehicle notes" : " ordnance notes") ;
}
@@ -1729,6 +1724,12 @@ function do_load_template_pack( fname, data )
var template_id = fname.substring( 0, fname.length-extn.length ).toLowerCase() ;
if ( extn === ".css" )
template_pack.css[template_id] = data ;
+ else if ( template_id === "ob_vo" )
+ template_pack.templates.ob_vehicles = template_pack.templates.ob_ordnance = data ;
+ else if ( template_id === "ob_vo_note" )
+ template_pack.templates.ob_vehicle_note = template_pack.templates.ob_ordnance_note = data ;
+ else if ( template_id === "ob_ma_notes" )
+ template_pack.templates.ob_vehicles_ma_notes = template_pack.templates.ob_ordnance_ma_notes = data ;
else {
if ( gValidTemplateIds.indexOf( template_id ) === -1 && template_id.substr(0,7) !== "extras/" ) {
unknown_template_ids.push( fname ) ;
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ma_notes.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ma_notes.j2
new file mode 100644
index 0000000..32f1e65
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ma_notes.j2
@@ -0,0 +1,8 @@
+{%for ma_note in OB_MA_NOTES%} [*] {{ma_note}}
+{%endfor%}
+
+{%if OB_EXTRA_MA_NOTES%}
+{%if OB_EXTRA_MA_NOTES_CAPTION%} === {{OB_EXTRA_MA_NOTES_CAPTION}} === {%endif%}
+{%for ma_note in OB_EXTRA_MA_NOTES%} [*] {{ma_note}}
+{%endfor%}
+{%endif%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2
deleted file mode 100644
index ec2f545..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance.j2
+++ /dev/null
@@ -1,6 +0,0 @@
-[{{PLAYER_NAME}}] ; width={{OB_ORDNANCE_WIDTH}}{%for ord in OB_ORDNANCE %}
-[*] {{ord.name}}: #={{ord.note_number}}{%if ord.notes%}
-- notes:{%for n in ord.notes%} "{{n}}"{%endfor%}{%endif%}{%if ord.capabilities%}
-- capabilities:{%for c in ord.capabilities%} "{{c}}"{%endfor%}{%endif%}{%if ord.raw_capabilities%}
-- raw capabilities:{%for c in ord.capabilities%} "{{c}}"{%endfor%}{%endif%}{%if ord.comments%}
-- comments:{%for c in ord.comments%} "{{c}}"{%endfor%}{%endif%}{%endfor%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_ma_notes.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_ma_notes.j2
deleted file mode 100644
index f6f3fd9..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_ma_notes.j2
+++ /dev/null
@@ -1,8 +0,0 @@
-{%for ma_note in OB_ORDNANCE_MA_NOTES%} [*] {{ma_note}}
-{%endfor%}
-
-{%if OB_ORDNANCE_EXTRA_MA_NOTES%}
-{%if OB_ORDNANCE_EXTRA_MA_NOTES_CAPTION%} === {{OB_ORDNANCE_EXTRA_MA_NOTES_CAPTION}} === {%endif%}
-{%for ma_note in OB_ORDNANCE_EXTRA_MA_NOTES%} [*] {{ma_note}}
-{%endfor%}
-{%endif%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_note.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_note.j2
deleted file mode 100644
index b1b3e0a..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_ordnance_note.j2
+++ /dev/null
@@ -1 +0,0 @@
-{{ORDNANCE_NAME}}: {{ORDNANCE_NOTE_HTML}}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicle_note.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicle_note.j2
deleted file mode 100644
index 85cfbce..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicle_note.j2
+++ /dev/null
@@ -1 +0,0 @@
-{{VEHICLE_NAME}}: {{VEHICLE_NOTE_HTML}}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2
deleted file mode 100644
index 20f035b..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles.j2
+++ /dev/null
@@ -1,6 +0,0 @@
-[{{PLAYER_NAME}}] ; width={{OB_VEHICLES_WIDTH}}{%for veh in OB_VEHICLES %}
-[*] {{veh.name}}: #={{veh.note_number}}{%if veh.notes%}
-- notes:{%for n in veh.notes%} "{{n}}"{%endfor%}{%endif%}{%if veh.capabilities%}
-- capabilities:{%for c in veh.capabilities%} "{{c}}"{%endfor%}{%endif%}{%if veh.raw_capabilities%}
-- raw capabilities:{%for c in veh.raw_capabilities%} "{{c}}"{%endfor%}{%endif%}{%if veh.comments%}
-- comments:{%for c in veh.comments%} "{{c}}"{%endfor%}{%endif%}{%endfor%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles_ma_notes.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles_ma_notes.j2
deleted file mode 100644
index 5d9adf9..0000000
--- a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vehicles_ma_notes.j2
+++ /dev/null
@@ -1,8 +0,0 @@
-{%for ma_note in OB_VEHICLES_MA_NOTES%} [*] {{ma_note}}
-{%endfor%}
-
-{%if OB_VEHICLES_EXTRA_MA_NOTES%}
-{%if OB_VEHICLES_EXTRA_MA_NOTES_CAPTION%} === {{OB_VEHICLES_EXTRA_MA_NOTES_CAPTION}} === {%endif%}
-{%for ma_note in OB_VEHICLES_EXTRA_MA_NOTES%} [*] {{ma_note}}
-{%endfor%}
-{%endif%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo.j2
new file mode 100644
index 0000000..ab6ee97
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo.j2
@@ -0,0 +1,6 @@
+[{{PLAYER_NAME}}] ; width={{OB_VO_WIDTH}}{%for vo in OB_VO %}
+[*] {{vo.name}}: #={{vo.note_number}}{%if vo.notes%}
+- notes:{%for n in vo.notes%} "{{n}}"{%endfor%}{%endif%}{%if vo.capabilities%}
+- capabilities:{%for c in vo.capabilities%} "{{c}}"{%endfor%}{%endif%}{%if vo.raw_capabilities%}
+- raw capabilities:{%for c in vo.raw_capabilities%} "{{c}}"{%endfor%}{%endif%}{%if vo.comments%}
+- comments:{%for c in vo.comments%} "{{c}}"{%endfor%}{%endif%}{%endfor%}
diff --git a/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo_note.j2 b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo_note.j2
new file mode 100644
index 0000000..8c782ba
--- /dev/null
+++ b/vasl_templates/webapp/tests/fixtures/data/default-template-pack/ob_vo_note.j2
@@ -0,0 +1 @@
+{{VO_NAME}}: {{VO_NOTE_HTML}}
diff --git a/vasl_templates/webapp/tests/test_template_packs.py b/vasl_templates/webapp/tests/test_template_packs.py
index 533e5a0..95c5cf7 100644
--- a/vasl_templates/webapp/tests/test_template_packs.py
+++ b/vasl_templates/webapp/tests/test_template_packs.py
@@ -5,6 +5,7 @@ import zipfile
import tempfile
import base64
import re
+import random
import pytest
@@ -148,16 +149,29 @@ def test_missing_templates( webapp, webdriver ):
dname = os.path.normpath( os.path.join( os.path.split(__file__)[0], "../data/default-template-pack" ) )
for root,_,fnames in os.walk( dname ):
for fname in fnames:
+ if os.path.splitext( fname )[1] == ".swp":
+ continue
fname = os.path.join( root, fname )
fname2 = os.path.relpath( fname, start=dname )
if fname2.startswith( "extras/" ):
continue
+ if fname2 == "ob_vo":
+ fname2 = random.choice( [ "ob_vehicles", "ob_ordnance" ] )
+ elif fname2 == "ob_vo_note":
+ fname2 = random.choice( [ "ob_vehicles_note", "ob_ordnance_note" ] )
+ elif fname2 == "ob_ma_note":
+ fname2 = random.choice( [ "ob_vehicles_ma_note", "ob_ordnance_ma_note" ] )
files[ fname2 ] = "dummy template" # nb: we don't care about the content
def adjust_template_id( template_id ): #pylint: disable=missing-docstring
- if template_id.startswith( ( "ob_vehicles_", "ob_ordnance_" ) ) and template_id.endswith( ( "_1", "_2" ) ):
- return template_id[:-2]
- return template_id
+ if re.search( r"^ob_(vehicles|ordnance)_\d$", template_id ):
+ return "ob_vo"
+ elif re.search( r"^ob_(vehicle|ordnance)_note_\d$", template_id ):
+ return "ob_vo_note"
+ elif re.search( r"^ob_(vehicles|ordnance)_ma_notes_\d$", template_id ):
+ return "ob_ma_notes"
+ else:
+ return template_id
# upload the template pack, with one file missing each time
for fname in files:
diff --git a/vasl_templates/webapp/tests/utils.py b/vasl_templates/webapp/tests/utils.py
index 7046d07..a0e7f0e 100644
--- a/vasl_templates/webapp/tests/utils.py
+++ b/vasl_templates/webapp/tests/utils.py
@@ -89,7 +89,14 @@ def for_each_template( func ): #pylint: disable=too-many-branches
fname,extn = os.path.splitext( fname )
if extn != ".j2":
continue
- templates_to_test.add( fname )
+ if fname == "ob_vo":
+ templates_to_test.update( [ "ob_vehicles", "ob_ordnance" ] )
+ elif fname == "ob_vo_note":
+ templates_to_test.update( [ "ob_vehicle_note", "ob_ordnance_note" ] )
+ elif fname == "ob_ma_notes":
+ templates_to_test.update( [ "ob_vehicles_ma_notes", "ob_ordnance_ma_notes" ] )
+ else:
+ templates_to_test.add( fname )
# test the standard templates
for tab_id,template_ids in _STD_TEMPLATES.items():