diff --git a/htmlcc/parser.py b/htmlcc/parser.py
index 3c7ad94..f19e91e 100644
--- a/htmlcc/parser.py
+++ b/htmlcc/parser.py
@@ -144,6 +144,10 @@ class Parser:
# Output as %d
variable = variable[:-len('%d')].rstrip()[:-1].rstrip()
self.emitter.output_variable_formatted('%d', variable)
+ elif variable.endswith('%ld') and variable[:-len('%ld')].rstrip().endswith('|'):
+ # Output as %ld
+ variable = variable[:-len('%ld')].rstrip()[:-1].rstrip()
+ self.emitter.output_variable_formatted('%ld', variable)
else:
# No filter - output as text
self.emitter.output_variable_as_text(variable)