vue3-sphinx-xml 0.1.0-beta.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,32 +1,35 @@
1
- ![logo](https://github.com/hsorby/vue-sphinx-xml/raw/main/docs/assets/vue-sphinx-xml-logo.svg)
1
+ ![logo](https://github.com/hsorby/vue3-sphinx-xml/raw/main/docs/assets/vue-sphinx-xml-logo.svg)
2
2
 
3
- # vue-sphinx-xml
3
+ # vue3-sphinx-xml
4
4
 
5
- [![npm](https://img.shields.io/npm/v/vue-sphinx-xml.svg) ![npm](https://img.shields.io/npm/dm/vue-sphinx-xml.svg)](https://www.npmjs.com/package/vue-sphinx-xml)
6
- [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)
5
+ [![npm](https://img.shields.io/npm/v/vue3-sphinx-xml.svg) ![npm](https://img.shields.io/npm/dm/vue3-sphinx-xml.svg)](https://www.npmjs.com/package/vue3-sphinx-xml)
6
+ [![vue3](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://vuejs.org/)
7
7
 
8
- Vue component for displaying Sphinx documentation XML content.
8
+ Vue component for displaying documentation from XML that has been generaterd by [Sphinx](https://www.sphinx-doc.org/).
9
9
 
10
10
  ## Project setup
11
11
 
12
12
  ```
13
- npm install --save vue-sphinx-xml
13
+ npm install --save vue3-sphinx-xml
14
14
  ```
15
15
 
16
16
  ### Module import
17
17
 
18
- vue-sphinx-xml makes use of the vuex store to track data. You must use a vuex store for the component to work.
18
+ vue3-sphinx-xml makes use of the vuex store to track data. You must use a vuex store for the component to work.
19
19
  **⚠️ You need to install the module with the application like so:**
20
20
 
21
21
  ```javascript
22
- import SphinxXml from 'vue-sphinx-xml'
22
+ import store from './store'
23
23
 
24
- Vue.use(SphinxXml, { store })
24
+ import { installVue3SphinxXml } from 'vue3-sphinx-xml'
25
+ import 'vue3-sphinx-xml/dist/style.css'
26
+
27
+ createApp(App).use(store).use(installVue3SphinxXml, { store }).mount('#app')
25
28
  ```
26
29
 
27
- Add the above to your `main.js` application file before the line creating a `new Vue({ ... })` instance (this assumes that a standard layout is followed when creating your application).
30
+ Add the above to your `main.js` application file before the line creating a `createApp(App)` instance (this assumes that a standard layout is followed when creating your application).
28
31
 
29
- vue-sphinx-xml can make use of vue-highlightjs as an optional package.
32
+ vue3-sphinx-xml can make use of vue-highlightjs as an optional package.
30
33
  vue-highlightjs adds code highlighting to any code blocks in the documentation. To make use of vue-highlightjs install the package:
31
34
 
32
35
  ```
@@ -36,13 +39,20 @@ npm install --save vue-highlightjs
36
39
  and edit your `main.js` application file to have the following:
37
40
 
38
41
  ```javascript
39
- import SphinxXml from 'vue-sphinx-xml'
42
+ import store from './store'
43
+
44
+ import { installVue3SphinxXml } from 'vue3-sphinx-xml'
45
+ import 'vue3-sphinx-xml/dist/style.css'
46
+
40
47
  import VueHighlightJS from 'vue-highlightjs'
41
48
 
42
49
  import 'highlight.js/styles/xcode.css'
43
50
 
44
- Vue.use(SphinxXml, { store })
45
- Vue.use(VueHighlightJS)
51
+ createApp(App)
52
+ .use(store)
53
+ .use(installVue3SphinxXml, { store })
54
+ .use(VueHighlightJS)
55
+ .mount('#app')
46
56
  ```
47
57
 
48
58
  The line `import 'highlight.js/styles/xcode.css'` is one of many styles available from highlightjs that may be imported.
@@ -50,26 +60,21 @@ See [highlightjs styles](https://highlightjs.org/static/demo/) for a comprehensi
50
60
 
51
61
  ### Module component
52
62
 
53
- To use the vue-sphinx-xml component import it in a view and set the `baseURL` for the source XML.
63
+ To use the vue3-sphinx-xml component import it in a view and set the `baseURL` for the source XML.
54
64
  Example view `Documentation.vue`:
55
65
 
56
66
  ```javascript
57
67
  <template>
58
68
  <div class="documentation">
59
- <sphinx-page baseURL="/sphinx-xml-files" />
69
+ <sphinx-page :baseURL="/sphinx-xml-files"
70
+ />
60
71
  </div>
61
72
  </template>
62
73
 
63
- <script>
64
- import { SphinxPage } from 'vue-sphinx-xml'
65
-
66
- export default {
67
- name: 'Documentation',
68
- components: {
69
- SphinxPage,
70
- },
71
- }
74
+ <script setup>
75
+ import { SphinxPage } from 'vue3-sphinx-xml'
72
76
  </script>
77
+
73
78
  ```
74
79
 
75
80
  #### SphinxPage API
@@ -86,16 +91,13 @@ export default {
86
91
 
87
92
  ### Module routing
88
93
 
89
- vue-sphinx-xml requires that you use vue-router. To add a vue-sphinx-xml route under `documentation` add the following to `routes` object for vue-router:
94
+ vue3-sphinx-xml requires that you use vue-router. To add a vue3-sphinx-xml route under `documentation` add the following to `routes` object for vue-router:
90
95
 
91
96
  ```javascript
92
97
  {
93
98
  path: '/documentation/:pageName*',
94
99
  name: 'Documentation',
95
- // route level code-splitting
96
- // this generates a separate chunk (documentation.[hash].js) for this route
97
- // which is lazy-loaded when the route is visited.
98
- component: () => import(/* webpackChunkName: "documentation" */ '../views/Documentation.vue')
100
+ component: () => import('../views/Documentation.vue')
99
101
  }
100
102
  ```
101
103
 
@@ -103,7 +105,7 @@ Again assuming standard layout.
103
105
 
104
106
  ### Module math
105
107
 
106
- To render any math in the page vue-sphinx-xml uses Katex.
108
+ To render any math in the page vue3-sphinx-xml uses Katex.
107
109
  Katex is not automatically loaded because it is a large package.
108
110
  To render math with Katex you need to install the following packages:
109
111
 
@@ -125,8 +127,8 @@ Vue.use(VueKatex)
125
127
 
126
128
  ## Examples
127
129
 
128
- For a complete example of a Vue application using vue-sphinx-xml look at https://github.com/hsorby/example-vue-sphinx-xml.
129
- The **main** branch has a basic example of how vue-sphinx-xml may be used and the **multi_version** branch has an example of how vue-sphinx-xml may be used for different versions of Sphinx XML output.
130
+ For a complete example of a Vue application using vue3-sphinx-xml look at https://github.com/hsorby/example-vue3-sphinx-xml.
131
+ The **main** branch has a basic example of how vue3-sphinx-xml may be used and the **multi_version** branch has an example of how vue3-sphinx-xml may be used for different versions of Sphinx XML output.
130
132
 
131
133
  ---
132
134
 
@@ -1 +1 @@
1
- {"version":3,"file":"Footnote.js","sources":["../src/components/templates/Footnote.vue"],"sourcesContent":["<template>\n <div :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'footnote_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nimport { toRefs, ref } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\n\nattrs.value = dataObject(node.value, ['footnote']).attrs // import { h } from 'vue'\n\n// import { sphinxChildren } from '../../mixins/SphinxChildren'\n\n// export default {\n// name: 'Footnote',\n// mixins: [sphinxChildren],\n// render() {\n// return h(\n// 'div', // tag name\n// this.dataObject(['footnote']),\n// this.children.map(child => h(child)), // array of children\n// )\n// },\n// }\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AAEpB,UAAM,QAAQ,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,EAAE;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Footnote.js","sources":["../src/components/templates/Footnote.vue"],"sourcesContent":["<template>\n <div :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'footnote_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nimport { toRefs, ref } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\n\nattrs.value = dataObject(node.value, ['footnote']).attrs // import { h } from 'vue'\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AAEpB,UAAM,QAAQ,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,EAAE;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"FootnoteReference.js","sources":["../src/components/templates/FootnoteReference.vue"],"sourcesContent":["<template>\n <router-link v-if=\"isInternalReference(node)\" :to=\"routeDescription\">\n [{{ node.textContent }}]\n </router-link>\n <a v-else :href=\"node.getAttribute('refuri')\" target=\"_blank\">\n [{{ node.textContent }}]\n </a>\n</template>\n\n<script setup>\nimport { onMounted, toRefs, ref } from 'vue'\nimport { useRoute } from 'vue-router'\n\nimport { useMethods } from '../../composables/methods'\nimport { useBaseReference } from '../../composables/basereference'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst routeDescription = ref({path: '', hash: ''})\nconst { node } = toRefs(props)\nconst route = useRoute()\n\nconst { isInternalReference } = useMethods()\nconst { onReferenceCreated } = useBaseReference(node.value, route, routeDescription)\n\nonMounted(onReferenceCreated)\n\n// import { baseReference } from '../../mixins/BaseReference'\n\n// export default {\n// name: 'FootnoteReference',\n// mixins: [baseReference],\n// }\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,UAAM,mBAAmB,IAAI,EAAC,MAAM,IAAI,MAAM,GAAE,CAAC;AACjD,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,QAAQ,SAAU;AAExB,UAAM,EAAE,wBAAwB,WAAY;AAC5C,UAAM,EAAE,uBAAuB,iBAAiB,KAAK,OAAO,OAAO,gBAAgB;AAEnF,cAAU,kBAAkB;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"FootnoteReference.js","sources":["../src/components/templates/FootnoteReference.vue"],"sourcesContent":["<template>\n <router-link v-if=\"isInternalReference(node)\" :to=\"routeDescription\">\n [{{ node.textContent }}]\n </router-link>\n <a v-else :href=\"node.getAttribute('refuri')\" target=\"_blank\">\n [{{ node.textContent }}]\n </a>\n</template>\n\n<script setup>\nimport { onMounted, toRefs, ref } from 'vue'\nimport { useRoute } from 'vue-router'\n\nimport { useMethods } from '../../composables/methods'\nimport { useBaseReference } from '../../composables/basereference'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst routeDescription = ref({path: '', hash: ''})\nconst { node } = toRefs(props)\nconst route = useRoute()\n\nconst { isInternalReference } = useMethods()\nconst { onReferenceCreated } = useBaseReference(node.value, route, routeDescription)\n\nonMounted(onReferenceCreated)\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,UAAM,mBAAmB,IAAI,EAAC,MAAM,IAAI,MAAM,GAAE,CAAC;AACjD,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,QAAQ,SAAU;AAExB,UAAM,EAAE,wBAAwB,WAAY;AAC5C,UAAM,EAAE,uBAAuB,iBAAiB,KAAK,OAAO,OAAO,gBAAgB;AAEnF,cAAU,kBAAkB;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.js","sources":["../src/components/templates/Legend.vue"],"sourcesContent":["<template>\n <div :class=\"classes\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'container_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nconsole.log(\"***** IN USE *****\")\nimport { toRefs } from 'vue'\n\nimport { useChildren, useClasses } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst { children } = useChildren(node)\nconst { classes } = useClasses(node)\n// import { baseDiv } from '../../mixins/BaseDiv'\n// import { sphinxChildren } from '../../mixins/SphinxChildren'\n\n// export default {\n// name: 'Legend',\n// mixins: [baseDiv, sphinxChildren],\n// computed: {\n// classes() {\n// return ['legend']\n// },\n// },\n// }\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAcA,YAAQ,IAAI,oBAAoB;AAkBhC,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,YAAY,WAAW,IAAI;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Legend.js","sources":["../src/components/templates/Legend.vue"],"sourcesContent":["<template>\n <div :class=\"classes\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'container_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nimport { toRefs } from 'vue'\n\nimport { useChildren, useClasses } from '../../composables/computed'\n\nconsole.log('***** IN USE *****')\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst { children } = useChildren(node)\nconst { classes } = useClasses(node)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,YAAQ,IAAI,oBAAoB;AAchC,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,YAAY,WAAW,IAAI;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LineSingle.js","sources":["../src/components/templates/LineSingle.vue"],"sourcesContent":["<template>\n <div :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'footnote_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nconsole.log('***** IN USE *****')\nimport { toRefs, ref } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\n\nattrs.value = dataObject(node.value, ['line_single']).attrs // import { h } from 'vue'\n// import { h } from 'vue'\n\n// import { sphinxChildren } from '../../mixins/SphinxChildren'\n\n// export default {\n// name: 'LineSingle',\n// mixins: [sphinxChildren],\n// render() {\n// return h(\n// 'div', // tag name\n// this.dataObject(['line_single']),\n// this.children.map(child => h(child)), // array of children\n// )\n// },\n// }\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA,YAAQ,IAAI,oBAAoB;AAmBhC,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AAEpB,UAAM,QAAQ,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,EAAE;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LineSingle.js","sources":["../src/components/templates/LineSingle.vue"],"sourcesContent":["<template>\n <div :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'footnote_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n</template>\n\n<script setup>\nimport { toRefs, ref } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconsole.log('***** IN USE *****')\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\n\nattrs.value = dataObject(node.value, ['line_single']).attrs\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBA,YAAQ,IAAI,oBAAoB;AAehC,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AAEpB,UAAM,QAAQ,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,EAAE;;;;;;;;;;;;;;;;"}
package/dist/Literal.js CHANGED
@@ -29,12 +29,16 @@ const _sfc_main = {
29
29
  const v = dataObject(node.value);
30
30
  const isEmpty = (d) => {
31
31
  for (const i in d) {
32
+ if (d[i].language === "") {
33
+ continue;
34
+ }
32
35
  return false;
33
36
  }
34
37
  return true;
35
38
  };
36
39
  if (!isEmpty(v)) {
37
40
  console.log("Something needs to be done with this:", v);
41
+ console.log(node.value.innerHTML);
38
42
  }
39
43
  return (_ctx, _cache) => {
40
44
  return openBlock(), createElementBlock("code", null, [
@@ -1 +1 @@
1
- {"version":3,"file":"Literal.js","sources":["../src/components/templates/Literal.vue"],"sourcesContent":["<template>\n <code>\n <span class=\"pre\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'code_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </span>\n </code>\n</template>\n\n<script setup>\nimport { toRefs } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst { dataObject } = useMethods()\n\nconst { children } = useChildren(node)\n\nconst v = dataObject(node.value)\nconst isEmpty = (d) => {\n for (const i in d) {\n return false\n }\n\n return true\n}\n\nif (!isEmpty(v)) {\n console.log('Something needs to be done with this:', v)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,eAAe,WAAY;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;AAErC,UAAM,IAAI,WAAW,KAAK,KAAK;AAC/B,UAAM,UAAU,CAAC,MAAM;AACrB,iBAAW,KAAK,GAAG;AACjB,eAAO;AAAA,MACR;AAED,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,QAAQ,CAAC,GAAG;AACf,cAAQ,IAAI,yCAAyC,CAAC;AAAA,IACxD;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Literal.js","sources":["../src/components/templates/Literal.vue"],"sourcesContent":["<template>\n <code>\n <span class=\"pre\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'code_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </span>\n </code>\n</template>\n\n<script setup>\nimport { toRefs } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\nimport { useChildren } from '../../composables/computed'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst { dataObject } = useMethods()\n\nconst { children } = useChildren(node)\n\nconst v = dataObject(node.value)\nconst isEmpty = (d) => {\n for (const i in d) {\n if (d[i].language === '') {\n continue\n }\n return false\n }\n\n return true\n}\n\nif (!isEmpty(v)) {\n console.log('Something needs to be done with this:', v)\n console.log(node.value.innerHTML)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,eAAe,WAAY;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;AAErC,UAAM,IAAI,WAAW,KAAK,KAAK;AAC/B,UAAM,UAAU,CAAC,MAAM;AACrB,iBAAW,KAAK,GAAG;AACjB,YAAI,EAAE,GAAG,aAAa,IAAI;AACxB;AAAA,QACD;AACD,eAAO;AAAA,MACR;AAED,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,QAAQ,CAAC,GAAG;AACf,cAAQ,IAAI,yCAAyC,CAAC;AACtD,cAAQ,IAAI,KAAK,MAAM,SAAS;AAAA,IAClC;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LiteralBlock.js","sources":["../src/components/templates/LiteralBlock.vue"],"sourcesContent":["<template>\n <pre v-highlightjs><code :class=\"sourceLanguage\">{{ sourceCode }}</code></pre>\n</template>\n\n<script setup>\nimport { computed, toRefs } from 'vue'\n\nimport { decodeHTML } from '../../js/utilities'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst sourceLanguage = computed(() => {\n let language = node.value.getAttribute('language')\n if (language === 'console' || language === 'default') {\n language = 'bash'\n } else if (language === 'text') {\n language = 'plaintext'\n }\n return language\n})\n\nconst sourceCode = computed(() => {\n return decodeHTML(node.value.innerHTML)\n})\n// export default {\n// name: 'LiteralBlock',\n// props: {\n// element: {\n// type: undefined,\n// },\n// },\n// computed: {\n// sourceLanguage() {\n// let language = this.element.getAttribute('language')\n// if (language === 'console' || language === 'default') {\n// language = 'bash'\n// } else if (language === 'text') {\n// language = 'plaintext'\n// }\n// return language\n// },\n// sourceCode() {\n// return decodeHTML(this.element.innerHTML)\n// },\n// },\n// }\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,iBAAiB,SAAS,MAAM;AACpC,UAAI,WAAW,KAAK,MAAM,aAAa,UAAU;AACjD,UAAI,aAAa,aAAa,aAAa,WAAW;AACpD,mBAAW;AAAA,MACf,WAAa,aAAa,QAAQ;AAC9B,mBAAW;AAAA,MACZ;AACD,aAAO;AAAA,IACT,CAAC;AAED,UAAM,aAAa,SAAS,MAAM;AAChC,aAAO,WAAW,KAAK,MAAM,SAAS;AAAA,IACxC,CAAC;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LiteralBlock.js","sources":["../src/components/templates/LiteralBlock.vue"],"sourcesContent":["<template>\n <pre v-highlightjs><code :class=\"sourceLanguage\">{{ sourceCode }}</code></pre>\n</template>\n\n<script setup>\nimport { computed, toRefs } from 'vue'\n\nimport { decodeHTML } from '../../js/utilities'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n properties: {\n type: Object,\n },\n})\n\nconst { node } = toRefs(props)\n\nconst sourceLanguage = computed(() => {\n let language = node.value.getAttribute('language')\n if (language === 'console' || language === 'default') {\n language = 'bash'\n } else if (language === 'text') {\n language = 'plaintext'\n }\n return language\n})\n\nconst sourceCode = computed(() => {\n return decodeHTML(node.value.innerHTML)\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,iBAAiB,SAAS,MAAM;AACpC,UAAI,WAAW,KAAK,MAAM,aAAa,UAAU;AACjD,UAAI,aAAa,aAAa,aAAa,WAAW;AACpD,mBAAW;AAAA,MACf,WAAa,aAAa,QAAQ;AAC9B,mBAAW;AAAA,MACZ;AACD,aAAO;AAAA,IACT,CAAC;AAED,UAAM,aAAa,SAAS,MAAM;AAChC,aAAO,WAAW,KAAK,MAAM,SAAS;AAAA,IACxC,CAAC;;;;;;;;;;;;;;"}
package/dist/Reference.js CHANGED
@@ -1,8 +1,8 @@
1
- import { ref, toRefs, onMounted, resolveComponent, unref, openBlock, createBlock, withCtx, createTextVNode, toDisplayString, createElementBlock } from "vue";
1
+ import { ref, toRefs, onMounted, resolveComponent, unref, openBlock, createBlock, withCtx, createTextVNode, toDisplayString, createElementBlock, Fragment, renderList, resolveDynamicComponent } from "vue";
2
2
  import { useRoute } from "vue-router";
3
+ import { u as useChildren } from "./entry.js";
3
4
  import { u as useMethods } from "./methods.js";
4
5
  import { u as useBaseReference } from "./basereference.js";
5
- import "./entry.js";
6
6
  import "@hsorby/vue3-katex";
7
7
  import "katex/dist/katex.min.css";
8
8
  import "vuex";
@@ -27,6 +27,7 @@ const _sfc_main = {
27
27
  const { isInternalReference } = useMethods();
28
28
  const { onReferenceCreated } = useBaseReference(node.value, route, routeDescription);
29
29
  onMounted(onReferenceCreated);
30
+ const { children } = useChildren(node);
30
31
  return (_ctx, _cache) => {
31
32
  const _component_router_link = resolveComponent("router-link");
32
33
  return unref(isInternalReference)(unref(node)) ? (openBlock(), createBlock(_component_router_link, {
@@ -41,7 +42,16 @@ const _sfc_main = {
41
42
  key: 1,
42
43
  href: unref(node).getAttribute("refuri"),
43
44
  target: "_blank"
44
- }, toDisplayString(unref(node).textContent), 9, _hoisted_1));
45
+ }, [
46
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
47
+ return openBlock(), createBlock(resolveDynamicComponent(c.component), {
48
+ key: "sub_link_" + index,
49
+ node: c.node,
50
+ componentName: c.name,
51
+ properties: c.properties
52
+ }, null, 8, ["node", "componentName", "properties"]);
53
+ }), 128))
54
+ ], 8, _hoisted_1));
45
55
  };
46
56
  }
47
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Reference.js","sources":["../src/components/templates/Reference.vue"],"sourcesContent":["<template>\n <router-link v-if=\"isInternalReference(node)\" :to=\"routeDescription\">\n {{ node.textContent }}\n </router-link>\n <a v-else :href=\"node.getAttribute('refuri')\" target=\"_blank\">\n {{ node.textContent }}\n </a>\n</template>\n\n<script setup>\nimport { onMounted, toRefs, ref } from 'vue'\nimport { useRoute } from 'vue-router'\n\nimport { useMethods } from '../../composables/methods'\nimport { useBaseReference } from '../../composables/basereference'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst routeDescription = ref({path: '', hash: ''})\nconst { node } = toRefs(props)\nconst route = useRoute()\n\nconst { isInternalReference } = useMethods()\nconst { onReferenceCreated } = useBaseReference(node.value, route, routeDescription)\n\nonMounted(onReferenceCreated)\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,UAAM,mBAAmB,IAAI,EAAC,MAAM,IAAI,MAAM,GAAE,CAAC;AACjD,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,QAAQ,SAAU;AAExB,UAAM,EAAE,wBAAwB,WAAY;AAC5C,UAAM,EAAE,uBAAuB,iBAAiB,KAAK,OAAO,OAAO,gBAAgB;AAEnF,cAAU,kBAAkB;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Reference.js","sources":["../src/components/templates/Reference.vue"],"sourcesContent":["<template>\n <router-link v-if=\"isInternalReference(node)\" :to=\"routeDescription\">\n {{ node.textContent }}\n </router-link>\n <a v-else :href=\"node.getAttribute('refuri')\" target=\"_blank\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'sub_link_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </a>\n</template>\n\n<script setup>\nimport { onMounted, toRefs, ref } from 'vue'\nimport { useRoute } from 'vue-router'\n\nimport { useChildren } from '../../composables/computed'\nimport { useMethods } from '../../composables/methods'\nimport { useBaseReference } from '../../composables/basereference'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst routeDescription = ref({ path: '', hash: '' })\nconst { node } = toRefs(props)\nconst route = useRoute()\n\nconst { isInternalReference } = useMethods()\nconst { onReferenceCreated } = useBaseReference(\n node.value,\n route,\n routeDescription,\n)\n\nonMounted(onReferenceCreated)\nconst { children } = useChildren(node)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkCA,UAAM,mBAAmB,IAAI,EAAE,MAAM,IAAI,MAAM,IAAI;AACnD,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,QAAQ,SAAU;AAExB,UAAM,EAAE,wBAAwB,WAAY;AAC5C,UAAM,EAAE,uBAAuB,iBAC7B,KAAK,OACL,OACA,gBACF;AAEA,cAAU,kBAAkB;AAC5B,UAAM,EAAE,aAAa,YAAY,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -50,6 +50,9 @@ const _sfc_main = {
50
50
  attrs.value = __spreadProps(__spreadValues({}, tmpDataObject.attrs), {
51
51
  class: classList
52
52
  });
53
+ if (attrs.value.prefix === "") {
54
+ delete attrs.value.prefix;
55
+ }
53
56
  if (node.value.nodeName === "button") {
54
57
  isButton.value = true;
55
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StandardElement.js","sources":["../src/components/templates/StandardElement.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n :=\"attrs\"\n @[isButton&&`click`]=\"buttonClicked\"\n ref=\"componentElement\"\n >\n <component\n v-for=\"(c, index) in children\"\n :key=\"'standard_element_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </component>\n</template>\n\n<script setup>\nimport { defineProps, toRefs, ref } from 'vue'\n\nimport { nodeNameTagNameMap } from '../../js/nodemap'\nimport { useChildren } from '../../composables/computed'\nimport { useMethods } from '../../composables/methods'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\nconst isButton = ref(false)\nconst componentElement = ref(null)\n\nconst transferAttributes = new Set(['div', 'button'])\nconst tag = nodeNameTagNameMap.get(node.value.nodeName)\n\n// if (transferAttributes.has(node.value.nodeName)) {\nconst tmpDataObject = dataObject(node.value, node.value.getAttribute('classes'))\nconst classList = tmpDataObject.class ? tmpDataObject.class.join(' ') : undefined\nattrs.value = {\n ...tmpDataObject.attrs,\n class: classList,\n}\n// }\nif (node.value.nodeName === 'button') {\n isButton.value = true\n}\n\nfunction buttonClicked() {\n if (componentElement.value.getAttribute('aria-selected') === 'false') {\n const parentElement = componentElement.value.parentElement\n let panels = []\n for (const child of parentElement.children) {\n const el = document.getElementById(child.id)\n el.setAttribute(\n 'aria-selected',\n el.getAttribute('aria-selected') === 'true' ? 'false' : 'true',\n )\n panels.push({ id: child.getAttribute('aria-controls') })\n }\n for (const panel of panels) {\n const el = document.getElementById(panel.id)\n if (el.hasAttribute('hidden')) {\n el.removeAttribute('hidden')\n } else {\n el.setAttribute('hidden', '')\n }\n }\n }\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AACpB,UAAM,WAAW,IAAI,KAAK;AAC1B,UAAM,mBAAmB,IAAI,IAAI;AAGjC,UAAM,MAAM,mBAAmB,IAAI,KAAK,MAAM,QAAQ;AAGtD,UAAM,gBAAgB,WAAW,KAAK,OAAO,KAAK,MAAM,aAAa,SAAS,CAAC;AAC/E,UAAM,YAAY,cAAc,QAAQ,cAAc,MAAM,KAAK,GAAG,IAAI;AACxE,UAAM,QAAQ,iCACT,cAAc,QADL;AAAA,MAEZ,OAAO;AAAA,IACT;AAEA,QAAI,KAAK,MAAM,aAAa,UAAU;AACpC,eAAS,QAAQ;AAAA,IACnB;AAEA,6BAAyB;AACvB,UAAI,iBAAiB,MAAM,aAAa,eAAe,MAAM,SAAS;AACpE,cAAM,gBAAgB,iBAAiB,MAAM;AAC7C,YAAI,SAAS,CAAE;AACf,mBAAW,SAAS,cAAc,UAAU;AAC1C,gBAAM,KAAK,SAAS,eAAe,MAAM,EAAE;AAC3C,aAAG,aACD,iBACA,GAAG,aAAa,eAAe,MAAM,SAAS,UAAU,MACzD;AACD,iBAAO,KAAK,EAAE,IAAI,MAAM,aAAa,eAAe,GAAG;AAAA,QACxD;AACD,mBAAW,SAAS,QAAQ;AAC1B,gBAAM,KAAK,SAAS,eAAe,MAAM,EAAE;AAC3C,cAAI,GAAG,aAAa,QAAQ,GAAG;AAC7B,eAAG,gBAAgB,QAAQ;AAAA,UACnC,OAAa;AACL,eAAG,aAAa,UAAU,EAAE;AAAA,UAC7B;AAAA,QACF;AAAA,MACF;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"StandardElement.js","sources":["../src/components/templates/StandardElement.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n :=\"attrs\"\n @[isButton&&`click`]=\"buttonClicked\"\n ref=\"componentElement\"\n >\n <component\n v-for=\"(c, index) in children\"\n :key=\"'standard_element_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </component>\n</template>\n\n<script setup>\nimport { defineProps, toRefs, ref } from 'vue'\n\nimport { nodeNameTagNameMap } from '../../js/nodemap'\nimport { useChildren } from '../../composables/computed'\nimport { useMethods } from '../../composables/methods'\n\nconst props = defineProps({\n node: {\n type: undefined,\n default: null,\n },\n componentName: {\n type: String,\n },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\nconst isButton = ref(false)\nconst componentElement = ref(null)\n\nconst transferAttributes = new Set(['div', 'button'])\nconst tag = nodeNameTagNameMap.get(node.value.nodeName)\n\nconst tmpDataObject = dataObject(node.value, node.value.getAttribute('classes'))\nconst classList = tmpDataObject.class\n ? tmpDataObject.class.join(' ')\n : undefined\nattrs.value = {\n ...tmpDataObject.attrs,\n class: classList,\n}\n\n// An empty prefix attribute causes problems for <ol> elements.\nif (attrs.value.prefix === '') {\n delete attrs.value.prefix\n}\n\nif (node.value.nodeName === 'button') {\n isButton.value = true\n}\n\nfunction buttonClicked() {\n if (componentElement.value.getAttribute('aria-selected') === 'false') {\n const parentElement = componentElement.value.parentElement\n let panels = []\n for (const child of parentElement.children) {\n const el = document.getElementById(child.id)\n el.setAttribute(\n 'aria-selected',\n el.getAttribute('aria-selected') === 'true' ? 'false' : 'true',\n )\n panels.push({ id: child.getAttribute('aria-controls') })\n }\n for (const panel of panels) {\n const el = document.getElementById(panel.id)\n if (el.hasAttribute('hidden')) {\n el.removeAttribute('hidden')\n } else {\n el.setAttribute('hidden', '')\n }\n }\n }\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAC7B,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,EAAE,eAAe,WAAY;AACnC,UAAM,QAAQ,IAAI,EAAE;AACpB,UAAM,WAAW,IAAI,KAAK;AAC1B,UAAM,mBAAmB,IAAI,IAAI;AAGjC,UAAM,MAAM,mBAAmB,IAAI,KAAK,MAAM,QAAQ;AAEtD,UAAM,gBAAgB,WAAW,KAAK,OAAO,KAAK,MAAM,aAAa,SAAS,CAAC;AAC/E,UAAM,YAAY,cAAc,QAC5B,cAAc,MAAM,KAAK,GAAG,IAC5B;AACJ,UAAM,QAAQ,iCACT,cAAc,QADL;AAAA,MAEZ,OAAO;AAAA,IACT;AAGA,QAAI,MAAM,MAAM,WAAW,IAAI;AAC7B,aAAO,MAAM,MAAM;AAAA,IACrB;AAEA,QAAI,KAAK,MAAM,aAAa,UAAU;AACpC,eAAS,QAAQ;AAAA,IACnB;AAEA,6BAAyB;AACvB,UAAI,iBAAiB,MAAM,aAAa,eAAe,MAAM,SAAS;AACpE,cAAM,gBAAgB,iBAAiB,MAAM;AAC7C,YAAI,SAAS,CAAE;AACf,mBAAW,SAAS,cAAc,UAAU;AAC1C,gBAAM,KAAK,SAAS,eAAe,MAAM,EAAE;AAC3C,aAAG,aACD,iBACA,GAAG,aAAa,eAAe,MAAM,SAAS,UAAU,MACzD;AACD,iBAAO,KAAK,EAAE,IAAI,MAAM,aAAa,eAAe,GAAG;AAAA,QACxD;AACD,mBAAW,SAAS,QAAQ;AAC1B,gBAAM,KAAK,SAAS,eAAe,MAAM,EAAE;AAC3C,cAAI,GAAG,aAAa,QAAQ,GAAG;AAC7B,eAAG,gBAAgB,QAAQ;AAAA,UACnC,OAAa;AACL,eAAG,aAAa,UAAU,EAAE;AAAA,UAC7B;AAAA,QACF;AAAA,MACF;AAAA,IACH;;;;;;;;;;;;;;;;;;;;;;;"}