diff --git a/packages/ui-default/templates/components/problem.html b/packages/ui-default/templates/components/problem.html index 92a17700c..d6048a8aa 100644 --- a/packages/ui-default/templates/components/problem.html +++ b/packages/ui-default/templates/components/problem.html @@ -1,16 +1,15 @@ -{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, small=false, alphabetic=false) %} +{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, show_pid=true, small=false, alphabetic=false) %} {%- if not invalid -%} {% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %} {% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %} {%- endif -%} -{%- if pdoc.pid and pdoc.pid.includes('-') -%}{{ pdoc.pid.split('-')[0] }}#{%- endif -%} -{%- if tdoc and alphabetic -%} - {{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }} -{%- else -%} - {{ (pdoc.pid.split('-')[1] if pdoc.pid.includes('-') else pdoc.pid) if pdoc.pid else ('P'+pdoc.docId) }} -{%- endif -%} -{%- if not small -%} {{ pdoc.title }}{%- endif -%} +{% if show_pid %} +{%- if tdoc and alphabetic -%}{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) }} +{%- elif pdoc.pid and pdoc.pid.includes('-') -%}{{ pdoc.pid.split('-').join('#') }} +{%- else -%}{{ pdoc.pid|default(pdoc.docId) }}{%- endif -%} +{% endif %} +{%- if not small -%}{% if show_pid %} {% endif %}{{ pdoc.title }}{%- endif -%} {%- if not invalid -%} {%- endif -%} diff --git a/packages/ui-default/templates/partials/homepage/recent_problems.html b/packages/ui-default/templates/partials/homepage/recent_problems.html index d17fd7b13..f3ba5fb9c 100644 --- a/packages/ui-default/templates/partials/homepage/recent_problems.html +++ b/packages/ui-default/templates/partials/homepage/recent_problems.html @@ -8,7 +8,7 @@
- {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} + {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false, show_pid=false) }} {{ datetimeSpan(pdoc._id)|safe }}
{%- endfor -%} diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index 7335a5a47..a8bd0bde8 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -45,7 +45,13 @@ {% endif %} - #{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) if tdoc else pdoc.pid|default(pdoc.docId) }}. {{ pdoc.title }} + {%- if tdoc -%} + {{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) }} + {%- elif pdoc.pid and pdoc.pid.includes('-') -%} + {{ pdoc.pid.split('-').join('#') }} + {%- else -%} + #{{ pdoc.pid|default(pdoc.docId) }} + {%- endif -%}. {{ pdoc.title }} {% if tdoc and tdoc.pids|length <= 26 %}