vue3-sphinx-xml 0.3.1 → 0.3.3

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.
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { toRefs, openBlock, createElementBlock, mergeProps, unref, Fragment, renderList, createBlock, resolveDynamicComponent } from "vue";
20
+ import { toRefs, computed, ref, openBlock, createElementBlock, mergeProps, unref, Fragment, renderList, createBlock, resolveDynamicComponent } from "vue";
21
21
  import { u as useMethods } from "./methods.js";
22
22
  import { u as useClasses, a as useChildren } from "./entry.js";
23
23
  import "@hsorby/vue3-katex";
@@ -42,7 +42,7 @@ const _sfc_main = {
42
42
  setup(__props) {
43
43
  const props = __props;
44
44
  const { node } = toRefs(props);
45
- const { extractId } = useMethods();
45
+ const { dataObject, extractId } = useMethods();
46
46
  const { classes } = useClasses(node);
47
47
  const { id } = extractId(node.value);
48
48
  const { children } = useChildren(node);
@@ -50,11 +50,12 @@ const _sfc_main = {
50
50
  return ["admonition", ...classes.value];
51
51
  });
52
52
  const result = dataObject(node.value, combinedClasses.value);
53
+ const attrs = ref({});
53
54
  attrs.value = __spreadProps(__spreadValues({}, result.attrs), {
54
55
  class: result.class.join(" ")
55
56
  });
56
57
  return (_ctx, _cache) => {
57
- return openBlock(), createElementBlock("div", mergeProps({ id: unref(id) }, _ctx.attrs), [
58
+ return openBlock(), createElementBlock("div", mergeProps({ id: unref(id) }, attrs.value), [
58
59
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
59
60
  return openBlock(), createBlock(resolveDynamicComponent(c.component), {
60
61
  key: "admonition_component_" + index,
@@ -1 +1 @@
1
- {"version":3,"file":"Admonition.js","sources":["../src/components/templates/Admonition.vue"],"sourcesContent":["<template>\n <div :id=\"id\" :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'admonition_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 { useMethods } from '../../composables/methods'\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 { extractId } = useMethods()\nconst { classes } = useClasses(node)\n\nconst { id } = extractId(node.value)\n\nconst { children } = useChildren(node)\n\nconst combinedClasses = computed(() => {\n return ['admonition', ...classes.value]\n})\n\nconst result = dataObject(node.value, combinedClasses.value)\nattrs.value = {\n ...result.attrs,\n class: result.class.join(' '),\n }\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,cAAc,WAAY;AAClC,UAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,UAAM,EAAE,OAAO,UAAU,KAAK,KAAK;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;AAErC,UAAM,kBAAkB,SAAS,MAAM;AACrC,aAAO,CAAC,cAAc,GAAG,QAAQ,KAAK;AAAA,IACxC,CAAC;AAED,UAAM,SAAS,WAAW,KAAK,OAAO,gBAAgB,KAAK;AAC3D,UAAM,QAAQ,iCACP,OAAO,QADA;AAAA,MAEV,OAAO,OAAO,MAAM,KAAK,GAAG;AAAA,IAC7B;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Admonition.js","sources":["../src/components/templates/Admonition.vue"],"sourcesContent":["<template>\n <div :id=\"id\" :=\"attrs\">\n <component\n v-for=\"(c, index) in children\"\n :key=\"'admonition_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 { computed, toRefs, ref } from 'vue'\n\nimport { useMethods } from '../../composables/methods'\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 { dataObject, extractId } = useMethods()\nconst { classes } = useClasses(node)\n\nconst { id } = extractId(node.value)\n\nconst { children } = useChildren(node)\n\nconst combinedClasses = computed(() => {\n return ['admonition', ...classes.value]\n})\n\nconst result = dataObject(node.value, combinedClasses.value)\n\nconst attrs = ref({})\nattrs.value = {\n ...result.attrs,\n class: result.class.join(' '),\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,YAAY,cAAc,WAAY;AAC9C,UAAM,EAAE,YAAY,WAAW,IAAI;AAEnC,UAAM,EAAE,OAAO,UAAU,KAAK,KAAK;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;AAErC,UAAM,kBAAkB,SAAS,MAAM;AACrC,aAAO,CAAC,cAAc,GAAG,QAAQ,KAAK;AAAA,IACxC,CAAC;AAED,UAAM,SAAS,WAAW,KAAK,OAAO,gBAAgB,KAAK;AAE3D,UAAM,QAAQ,IAAI,EAAE;AACpB,UAAM,QAAQ,iCACT,OAAO,QADE;AAAA,MAEZ,OAAO,OAAO,MAAM,KAAK,GAAG;AAAA,IAC9B;;;;;;;;;;;;;;;;"}
@@ -27,7 +27,7 @@ const _sfc_main = {
27
27
  createElementVNode("div", null, [
28
28
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
29
29
  return openBlock(), createBlock(resolveDynamicComponent(c.component), {
30
- key: "section_component_" + index,
30
+ key: "blockquote_component_" + index,
31
31
  node: c.node,
32
32
  componentName: c.name,
33
33
  properties: c.properties
@@ -1 +1 @@
1
- {"version":3,"file":"BlockQuote.js","sources":["../src/components/templates/BlockQuote.vue"],"sourcesContent":["<template>\n <blockquote>\n <div>\n <component\n v-for=\"(c, index) in children\"\n :key=\"'section_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n </blockquote>\n</template>\n\n<script setup>\nimport { toRefs } from 'vue'\n\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 { children } = useChildren(node)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,aAAa,YAAY,IAAI;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"BlockQuote.js","sources":["../src/components/templates/BlockQuote.vue"],"sourcesContent":["<template>\n <blockquote>\n <div>\n <component\n v-for=\"(c, index) in children\"\n :key=\"'blockquote_component_' + index\"\n :is=\"c.component\"\n :node=\"c.node\"\n :componentName=\"c.name\"\n :properties=\"c.properties\"\n />\n </div>\n </blockquote>\n</template>\n\n<script setup>\nimport { toRefs } from 'vue'\n\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 { children } = useChildren(node)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,aAAa,YAAY,IAAI;;;;;;;;;;;;;;;;;;"}
package/dist/Literal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { toRefs, openBlock, createElementBlock, createElementVNode, Fragment, renderList, unref, createBlock, resolveDynamicComponent } from "vue";
1
+ import { toRefs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, unref, createBlock, resolveDynamicComponent } from "vue";
2
2
  import { u as useMethods } from "./methods.js";
3
3
  import { a as useChildren } from "./entry.js";
4
4
  import "@hsorby/vue3-katex";
@@ -25,6 +25,7 @@ const _sfc_main = {
25
25
  const { node } = toRefs(props);
26
26
  const { dataObject } = useMethods();
27
27
  const { children } = useChildren(node);
28
+ const classes = ref(["literal", "notranslate"]);
28
29
  const v = dataObject(node.value);
29
30
  const isEmpty = (d) => {
30
31
  for (const i in d) {
@@ -36,11 +37,14 @@ const _sfc_main = {
36
37
  return true;
37
38
  };
38
39
  if (!isEmpty(v)) {
39
- console.log("Something needs to be done with this:", v);
40
- console.log(node.value.innerHTML);
40
+ if (v.attrs && v.attrs.role) {
41
+ classes.value.push(v.attrs.role);
42
+ }
41
43
  }
42
44
  return (_ctx, _cache) => {
43
- return openBlock(), createElementBlock("code", null, [
45
+ return openBlock(), createElementBlock("code", {
46
+ class: normalizeClass(classes.value)
47
+ }, [
44
48
  createElementVNode("span", _hoisted_1, [
45
49
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
46
50
  return openBlock(), createBlock(resolveDynamicComponent(c.component), {
@@ -51,7 +55,7 @@ const _sfc_main = {
51
55
  }, null, 8, ["node", "componentName", "properties"]);
52
56
  }), 128))
53
57
  ])
54
- ]);
58
+ ], 2);
55
59
  };
56
60
  }
57
61
  };
@@ -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 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
+ {"version":3,"file":"Literal.js","sources":["../src/components/templates/Literal.vue"],"sourcesContent":["<template>\n <code :class=\"classes\">\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, 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)\n\nconst { dataObject } = useMethods()\n\nconst { children } = useChildren(node)\n\nconst classes = ref(['literal', 'notranslate'])\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 if (v.attrs && v.attrs.role) {\n classes.value.push(v.attrs.role)\n }\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,UAAU,IAAI,CAAC,WAAW,aAAa,CAAC;AAE9C,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,UAAI,EAAE,SAAS,EAAE,MAAM,MAAM;AAC3B,gBAAQ,MAAM,KAAK,EAAE,MAAM,IAAI;AAAA,MAChC;AAAA,IACH;;;;;;;;;;;;;;;;;;;;"}
package/dist/Warning.js CHANGED
@@ -1,4 +1,4 @@
1
- import { toRefs, openBlock, createElementBlock, unref, Fragment, renderList, createBlock, resolveDynamicComponent } from "vue";
1
+ import { toRefs, openBlock, createElementBlock, unref, createBlock, resolveDynamicComponent, withCtx, Fragment, renderList, createTextVNode } from "vue";
2
2
  import { u as useMethods } from "./methods.js";
3
3
  import { a as useChildren } from "./entry.js";
4
4
  import "@hsorby/vue3-katex";
@@ -7,7 +7,7 @@ import "vue-router";
7
7
  import "axios";
8
8
  import "path-to-regexp";
9
9
  const _hoisted_1 = ["id"];
10
- const _hoisted_2 = ["id"];
10
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode("Warning");
11
11
  const _sfc_main = {
12
12
  props: {
13
13
  node: {
@@ -23,21 +23,22 @@ const _sfc_main = {
23
23
  },
24
24
  setup(__props) {
25
25
  const props = __props;
26
- const { node } = toRefs(props);
26
+ const { node, properties } = toRefs(props);
27
27
  const { extractId } = useMethods();
28
28
  const { id } = extractId(node.value);
29
29
  const { children } = useChildren(node);
30
+ const tagName = "h" + properties.value.depth;
30
31
  return (_ctx, _cache) => {
31
32
  return openBlock(), createElementBlock("div", {
32
33
  id: unref(id),
33
34
  class: "admonition warning"
34
35
  }, [
35
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.extraIds, (s, index) => {
36
- return openBlock(), createElementBlock("span", {
37
- key: "id_span_" + index,
38
- id: s
39
- }, null, 8, _hoisted_2);
40
- }), 128)),
36
+ (openBlock(), createBlock(resolveDynamicComponent(tagName), null, {
37
+ default: withCtx(() => [
38
+ _hoisted_2
39
+ ]),
40
+ _: 1
41
+ })),
41
42
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (c, index) => {
42
43
  return openBlock(), createBlock(resolveDynamicComponent(c.component), {
43
44
  key: "warning_component_" + index,
@@ -1 +1 @@
1
- {"version":3,"file":"Warning.js","sources":["../src/components/templates/Warning.vue"],"sourcesContent":["<template>\n <div :id=\"id\" class=\"admonition warning\">\n <span v-for=\"(s, index) in extraIds\" :key=\"'id_span_' + index\" :id=\"s\" />\n <component\n v-for=\"(c, index) in children\"\n :key=\"'warning_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 { 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 { extractId } = useMethods()\nconst { id } = extractId(node.value)\n\nconst { children } = useChildren(node)\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAM,EAAE,SAAS,OAAO,KAAK;AAE7B,UAAM,EAAE,cAAc,WAAY;AAClC,UAAM,EAAE,OAAO,UAAU,KAAK,KAAK;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Warning.js","sources":["../src/components/templates/Warning.vue"],"sourcesContent":["<template>\n <div :id=\"id\" class=\"admonition warning\">\n <component :is=\"tagName\">Warning</component>\n <component\n v-for=\"(c, index) in children\"\n :key=\"'warning_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 { 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, properties } = toRefs(props)\n\nconst { extractId } = useMethods()\nconst { id } = extractId(node.value)\n\nconst { children } = useChildren(node)\nconst tagName = 'h' + properties.value.depth\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAM,EAAE,MAAM,eAAe,OAAO,KAAK;AAEzC,UAAM,EAAE,cAAc,WAAY;AAClC,UAAM,EAAE,OAAO,UAAU,KAAK,KAAK;AAEnC,UAAM,EAAE,aAAa,YAAY,IAAI;AACrC,UAAM,UAAU,MAAM,WAAW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/entry.js CHANGED
@@ -45336,6 +45336,18 @@ function defineChildComponent(name, node) {
45336
45336
  properties = {
45337
45337
  text: node.nodeValue
45338
45338
  };
45339
+ } else if (node.nodeName === "warning") {
45340
+ let parentNode = node.parentNode;
45341
+ let depth = 0;
45342
+ while (parentNode) {
45343
+ if (parentNode.nodeName === "section") {
45344
+ depth += 1;
45345
+ }
45346
+ parentNode = parentNode.parentNode;
45347
+ }
45348
+ properties = {
45349
+ depth
45350
+ };
45339
45351
  } else if (node.nodeName === "title") {
45340
45352
  let parentNode = node.parentNode;
45341
45353
  let depth = 0;