Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.vue « code « cells « notebook « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 98b6cdd0944b97126b6073a1ae2cfad59399b38c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script>
import Prism from '../../lib/highlight';
import Prompt from '../prompt.vue';

export default {
  name: 'CodeOutput',
  components: {
    Prompt,
  },
  props: {
    count: {
      type: Number,
      required: false,
      default: 0,
    },
    codeCssClass: {
      type: String,
      required: false,
      default: '',
    },
    type: {
      type: String,
      required: true,
    },
    rawCode: {
      type: String,
      required: true,
    },
  },
  computed: {
    code() {
      return this.rawCode;
    },
    promptType() {
      const type = this.type.split('put')[0];

      return type.charAt(0).toUpperCase() + type.slice(1);
    },
  },
  mounted() {
    Prism.highlightElement(this.$refs.code);
  },
};
</script>

<template>
  <div :class="type">
    <prompt :type="promptType" :count="count" />
    <pre ref="code" :class="codeCssClass" class="language-python" v-text="code"></pre>
  </div>
</template>