sync: Allow Markdown in flag help

This commit is contained in:
nemunaire 2022-01-21 08:45:07 +01:00
parent 5a79343af8
commit 252ff33b83
3 changed files with 10 additions and 2 deletions

View File

@ -211,7 +211,7 @@ angular.module("FICApp")
</button>
</div>
</div>
<small class="form-text text-muted" ng-if="!$ctrl.key.found && $ctrl.key.help.length > 0" ng-bind="$ctrl.key.help"></small>
<small class="form-text text-muted" ng-if="!$ctrl.key.found && $ctrl.key.help.length > 0" ng-bind-html="$ctrl.key.help"></small>
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="$ctrl.key.found" title="Flag trouvé à {{ $ctrl.key.found | date:'mediumTime'}}"></span>
</div>
`

View File

@ -265,6 +265,14 @@ func buildExerciceFlag(i Importer, exercice *fic.Exercice, flag ExerciceFlag, nl
}
}
if len(flag.Help) > 0 {
if mdhelp, err := ProcessMarkdown(i, flag.Help, exercice.Path); err != nil {
errs = append(errs, fmt.Sprintf("%q: flag #%d: unable to parse property help as Markdown: %s", path.Base(exercice.Path), nline+1), err.Error())
} else {
flag.Help = mdhelp[3 : len(mdhelp)-4]
}
}
if flag.Type == "key" || strings.HasPrefix(flag.Type, "number") || flag.Type == "text" || flag.Type == "ucq" || flag.Type == "radio" || flag.Type == "vector" {
addedFlag, choices, berrs := buildKeyFlag(exercice, flag, nline+1, "Flag")
if len(berrs) > 0 {

View File

@ -195,7 +195,7 @@
{/if}
{/each}
{#if flag.help}
<small class="form-text text-muted">{flag.help}</small>
<small class="form-text text-muted">{@html flag.help}</small>
{/if}
{:else}
<Icon