Skip to content

Commit 226d53c

Browse files
committed
Merge
2 parents 7d85495 + b514dc0 commit 226d53c

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

lmfdb/groups/abstract/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1969,14 +1969,17 @@ def render_abstract_group(label, data=None):
19691969

19701970
bread = get_bread([(gp.label_compress(), "")])
19711971
learnmore_gp_picture = ('Picture description', url_for(".picture_page"))
1972+
code = gp.code_snippets()
1973+
if code and len(code['prompt']) == 0: # no codes
1974+
code = None
19721975

19731976
return render_template(
19741977
"abstract-show-group.html",
19751978
title=title,
19761979
bread=bread,
19771980
info=info,
19781981
gp=gp,
1979-
code=gp.code_snippets(),
1982+
code=code,
19801983
properties=gp.properties(),
19811984
friends=friends,
19821985
learnmore=learnmore_list_add(*learnmore_gp_picture),

lmfdb/groups/abstract/templates/abstract-show-group.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
</p>
2323
{% endif %}
2424

25-
<p>{{ place_code('code_description', is_top_snippet=True) }}</p>
25+
<p>
26+
{{ place_code('code_description', is_top_snippet=True) }}
27+
</p>
2628

2729
<h2>Group information</h2>
2830
<p>
@@ -204,7 +206,9 @@ <h2>Minimal presentations</h2>
204206
{% if not (gp.live() and gp.abelian) %}
205207

206208
<h2>Constructions</h2>
207-
{% if code %}<div align="right" style="float: left;">
209+
210+
{% if code %}
211+
<div align="right" style="float: left;">
208212
{{CodeSnippet(code).show_commands_box() | safe}}
209213
</div><br><br>
210214
{% endif %}

lmfdb/groups/abstract/web_groups.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,7 +2999,7 @@ def code_snippets(self):
29992999
if lang not in code['code_description']:
30003000
code['code_description'][lang] = 'G := SmallGroup('+gap_id[0]+', '+gap_id[1]+');'
30013001
if 'sage_gap' not in code['code_description']:
3002-
code['code_description']['sage_gap'] = 'G = gap.SmallGroup('+gap_id[0]+', '+gap_id[1]+')'
3002+
code['code_description']['sage_gap'] = 'G = libgap.SmallGroup('+gap_id[0]+', '+gap_id[1]+')'
30033003
# Otherwise, check if group is abelian (then can define as product of cyclic groups from its primary decomposition)
30043004
if self.abelian:
30053005
for lang in ['magma', 'gap']:
@@ -3033,30 +3033,35 @@ def code_snippets(self):
30333033
# then unfortunately not all the default code snippets in Sage and Magma will work correctly!
30343034
# As a (hopefully temporary) solution, we hide the code snippets which will not work with our implemention of G in the top code snippet
30353035
# TODO: Find a better solution for this (would it be worth converting G to a permutation group within the top code snippet?)
3036-
if ("MatrixGroup" in code['code_description']['sage']) and ("permutation" not in code['code_description']['sage']):
3036+
if 'sage' in code['code_description'] and "MatrixGroup" in code['code_description']['sage'] and "permutation" not in code['code_description']['sage']:
30373037
# Must disable all code snippets which do not work with MatrixGroup in Sage
30383038
for c in ['composition_factors', 'is_cyclic', 'is_elementary_abelian', 'is_pgroup', 'abelianization', 'schur_multiplier',
30393039
'commutator', 'frattini_subgroup', 'fitting_subgroup', 'socle', 'derived_series', 'lower_central_series', 'upper_central_series']:
30403040
if c in code:
30413041
code[c].pop('sage', None)
3042-
if ("AbelianGroup" in code['code_description']['sage']) and ("permutation" not in code['code_description']['sage']):
3042+
if 'sage' in code['code_description'] and "AbelianGroup" in code['code_description']['sage'] and "permutation" not in code['code_description']['sage']:
30433043
# Must disable all code snippets which do not work with AbelianGroup in Sage
30443044
for c in ['composition_factors', 'is_elementary_abelian', 'is_nilpotent', 'is_perfect', 'is_pgroup', 'is_polycyclic', 'is_solvable', 'is_supersolvable',
30453045
'abelianization', 'schur_multiplier', 'center', 'commutator', 'frattini_subgroup', 'fitting_subgroup', 'socle',
30463046
'derived_series', 'lower_central_series', 'upper_central_series']:
30473047
if c in code:
30483048
code[c].pop('sage', None)
3049-
if ("MatrixGroup" in code['code_description']['magma']) and ("permutation" not in code['code_description']['magma']):
3049+
if 'magma' in code['code_description'] and "MatrixGroup" in code['code_description']['magma'] and "permutation" not in code['code_description']['magma']:
30503050
# Must disable all code snippets which do not work with MatrixGroup in Magma
30513051
for c in ['socle']:
30523052
if c in code:
30533053
code[c].pop('magma', None)
3054-
if ("AbelianGroup" in code['code_description']['magma']) and ("permutation" not in code['code_description']['magma']):
3054+
if 'magma' in code['code_description'] and "AbelianGroup" in code['code_description']['magma'] and "permutation" not in code['code_description']['magma']:
30553055
# Must disable all code snippets which do not work with AbelianGroup in Magma
30563056
for c in ['radical', 'socle']:
30573057
if c in code:
30583058
code[c].pop('magma', None)
30593059

3060+
# Hides code snippets for language lang if no top code snippet has been defined for lang
3061+
for lang in list(code['prompt']):
3062+
if lang not in code['code_description']:
3063+
code['prompt'].pop(lang, None)
3064+
30603065
for prop in code:
30613066
for lang in code[prop]:
30623067
code[prop][lang] = code[prop][lang].format(**data)

0 commit comments

Comments
 (0)