diff --git a/docs/source/_static/luadoc.css b/docs/source/_static/luadoc.css index 1a65a46944..83bfdf78b7 100644 --- a/docs/source/_static/luadoc.css +++ b/docs/source/_static/luadoc.css @@ -2,34 +2,15 @@ font-family: 'JetBrains Mono', monospace; } -#luadoc pre.example { - background-color: hsl(var(--accent)) !important; - padding: 10px; - margin: 10px 0 10px 0; - overflow-x: auto; -} - #luadoc pre.example code { - color: black; - background-color: hsl(var(--accent)) !important; - border: none; white-space: pre; - padding: 0px; } -@media (prefers-color-scheme: dark) { - #luadoc pre.example, - #luadoc pre.example code { - background-color: hsl(var(--muted)); - color: #ffffff; - } -} - -#luadoc code { +#luadoc code:not([class*="language-"]) { background-color: unset; } -#luadoc pre { +#luadoc pre:not([class*="language-"]) { background-color: inherit; color: inherit; border: none; diff --git a/docs/source/_static/prism-dark.css b/docs/source/_static/prism-dark.css new file mode 100644 index 0000000000..293a0d1267 --- /dev/null +++ b/docs/source/_static/prism-dark.css @@ -0,0 +1,156 @@ +@media (prefers-color-scheme: dark) { + + /** + * Github Dark theme for Prism.js + * Based on Github: https://github.com + * @author Katorly + */ + /* General */ + pre[class*="language-"], + code[class*="language-"] { + color: #c9d1d9; + font-size: 13px; + text-shadow: none; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + } + + pre[class*="language-"]::selection, + code[class*="language-"]::selection, + pre[class*="language-"]::mozselection, + code[class*="language-"]::mozselection { + text-shadow: none; + background: #234879; + } + + @media print { + + pre[class*="language-"], + code[class*="language-"] { + text-shadow: none; + } + } + + pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + background: #161b22; + } + + :not(pre)>code[class*="language-"] { + padding: .1em .3em; + border-radius: .3em; + color: #c9d1d9; + background: #343942; + } + + /* Line highlighting */ + pre[data-line] { + position: relative; + } + + pre[class*="language-"]>code[class*="language-"] { + position: relative; + z-index: 1; + } + + .line-highlight { + position: absolute; + left: 0; + right: 0; + padding: inherit 0; + margin-top: 1em; + background: #2f2a1e; + box-shadow: inset 5px 0 0 #674c16; + z-index: 0; + pointer-events: none; + line-height: inherit; + white-space: pre; + } + + /* Tokens */ + .namespace { + opacity: .7; + } + + .token.comment, + .token.prolog, + .token.doctype, + .token.cdata { + color: #8b949e; + } + + .token.punctuation { + color: #c9d1d9; + } + + .token.property, + .token.tag, + .token.boolean, + .token.number, + .token.constant, + .token.symbol, + .token.deleted { + color: #79c0ff; + } + + .token.selector, + .token.attr-name, + .token.string, + .token.char, + .token.builtin, + .token.inserted { + color: #a5d6ff; + } + + .token.operator, + .token.entity, + .token.url, + .language-css .token.string, + .style .token.string { + color: #a5d6ff; + background: #161b22; + } + + .token.atrule, + .token.attr-value, + .token.keyword { + color: #a5d6ff; + } + + .token.function { + color: #d2a8ff; + } + + .token.regex, + .token.important, + .token.variable { + color: #a8daff; + } + + .token.important, + .token.bold { + font-weight: bold; + } + + .token.italic { + font-style: italic; + } + + .token.entity { + cursor: help; + } +} \ No newline at end of file diff --git a/docs/source/_static/prism.css b/docs/source/_static/prism.css new file mode 100644 index 0000000000..088a96cb6c --- /dev/null +++ b/docs/source/_static/prism.css @@ -0,0 +1,152 @@ +/** + * Github Light theme for Prism.js + * Based on Github: https://github.com + * @author Katorly + */ +/* General */ +pre[class*="language-"], +code[class*="language-"] { + color: #24292f; + font-size: 13px; + text-shadow: none; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::selection, +code[class*="language-"]::selection, +pre[class*="language-"]::mozselection, +code[class*="language-"]::mozselection { + text-shadow: none; + background: #9fc6e9; +} + +@media print { + + pre[class*="language-"], + code[class*="language-"] { + text-shadow: none; + } +} + +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + background: #f6f8fa; +} + +:not(pre)>code[class*="language-"] { + padding: .1em .3em; + border-radius: .3em; + color: #24292f; + background: #eff1f3; +} + +/* Line highlighting */ +pre[data-line] { + position: relative; +} + +pre[class*="language-"]>code[class*="language-"] { + position: relative; + z-index: 1; +} + +.line-highlight { + position: absolute; + left: 0; + right: 0; + padding: inherit 0; + margin-top: 1em; + background: #fff8c5; + box-shadow: inset 5px 0 0 #eed888; + z-index: 0; + pointer-events: none; + line-height: inherit; + white-space: pre; +} + +/* Tokens */ +.namespace { + opacity: .7; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: #6e7781; +} + +.token.punctuation { + color: #24292f; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #0550ae; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #0a3069; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #0550ae; +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #cf222e; +} + +.token.function { + color: #8250df; +} + +.token.regex, +.token.important, +.token.variable { + color: #0a3069; +} + +.token.important, +.token.bold { + font-weight: bold; +} + +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} \ No newline at end of file diff --git a/docs/source/_static/prism.js b/docs/source/_static/prism.js new file mode 100644 index 0000000000..fa92d07899 --- /dev/null +++ b/docs/source/_static/prism.js @@ -0,0 +1,7 @@ +/* PrismJS 1.30.0 +https://prismjs.com/download#themes=prism&languages=json+lua+yaml&plugins=toolbar */ +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=g.reach);A+=w.value.length,w=w.next){var P=w.value;if(n.length>e.length)return;if(!(P instanceof i)){var E,S=1;if(y){if(!(E=l(b,A,e,m))||E.index>=e.length)break;var L=E.index,O=E.index+E[0].length,C=A;for(C+=w.value.length;L>=C;)C+=(w=w.next).value.length;if(A=C-=w.value.length,w.value instanceof i)continue;for(var j=w;j!==n.tail&&(Cg.reach&&(g.reach=W);var I=w.prev;if(_&&(I=u(n,I,_),A+=_.length),c(n,I,S),w=u(n,I,new i(f,p?a.tokenize(N,p):N,k,N)),M&&u(n,w,M),S>1){var T={cause:f+","+d,reach:W};o(e,n,t,w.prev,A,T),g&&T.reach>g.reach&&(g.reach=T.reach)}}}}}}function s(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function u(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function c(e,n,t){for(var r=n.next,a=0;a"+i.content+""},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(n){var t=JSON.parse(n.data),r=t.language,i=t.code,l=t.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),l&&e.close()}),!1),a):a;var g=a.util.currentScript();function f(){a.manual||a.highlightAll()}if(g&&(a.filename=g.src,g.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var h=document.readyState;"loading"===h||"interactive"===h&&g&&g.defer?document.addEventListener("DOMContentLoaded",f):window.requestAnimationFrame?window.requestAnimationFrame(f):window.setTimeout(f,16)}return a}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); +Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json; +Prism.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}; +!function(e){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,t="(?:"+r.source+"(?:[ \t]+"+n.source+")?|"+n.source+"(?:[ \t]+"+r.source+")?)",a="(?:[^\\s\\x00-\\x08\\x0e-\\x1f!\"#%&'*,\\-:>?@[\\]`{|}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*".replace(//g,(function(){return"[^\\s\\x00-\\x08\\x0e-\\x1f,[\\]{}\\x7f-\\x84\\x86-\\x9f\\ud800-\\udfff\\ufffe\\uffff]"})),d="\"(?:[^\"\\\\\r\n]|\\\\.)*\"|'(?:[^'\\\\\r\n]|\\\\.)*'";function o(e,n){n=(n||"").replace(/m/g,"")+"m";var r="([:\\-,[{]\\s*(?:\\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\\]|\\}|(?:[\r\n]\\s*)?#))".replace(/<>/g,(function(){return t})).replace(/<>/g,(function(){return e}));return RegExp(r,n)}e.languages.yaml={scalar:{pattern:RegExp("([\\-:]\\s*(?:\\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\\S[^\r\n]*(?:\\2[^\r\n]+)*)".replace(/<>/g,(function(){return t}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp("((?:^|[:\\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\\s*:\\s)".replace(/<>/g,(function(){return t})).replace(/<>/g,(function(){return"(?:"+a+"|"+d+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:o("\\d{4}-\\d\\d?-\\d\\d?(?:[tT]|[ \t]+)\\d\\d?:\\d{2}:\\d{2}(?:\\.\\d*)?(?:[ \t]*(?:Z|[-+]\\d\\d?(?::\\d{2})?))?|\\d{4}-\\d{2}-\\d{2}|\\d\\d?:\\d{2}(?::\\d{2}(?:\\.\\d*)?)?"),lookbehind:!0,alias:"number"},boolean:{pattern:o("false|true","i"),lookbehind:!0,alias:"important"},null:{pattern:o("null|~","i"),lookbehind:!0,alias:"important"},string:{pattern:o(d),lookbehind:!0,greedy:!0},number:{pattern:o("[+-]?(?:0x[\\da-f]+|0o[0-7]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?|\\.inf|\\.nan)","i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(Prism); +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e=[],t={},n=function(){};Prism.plugins.toolbar={};var a=Prism.plugins.toolbar.registerButton=function(n,a){var r;r="function"==typeof a?a:function(e){var t;return"function"==typeof a.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){a.onClick.call(this,e)}))):"string"==typeof a.url?(t=document.createElement("a")).href=a.url:t=document.createElement("span"),a.className&&t.classList.add(a.className),t.textContent=a.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=r)},r=Prism.plugins.toolbar.hook=function(a){var r=a.element.parentNode;if(r&&/pre/i.test(r.nodeName)&&!r.parentNode.classList.contains("code-toolbar")){var o=document.createElement("div");o.classList.add("code-toolbar"),r.parentNode.insertBefore(o,r),o.appendChild(r);var i=document.createElement("div");i.classList.add("toolbar");var l=e,d=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(a.element);d&&(l=d.map((function(e){return t[e]||n}))),l.forEach((function(e){var t=e(a);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),i.appendChild(n)}})),o.appendChild(i)}};a("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,a,r=t.getAttribute("data-label");try{a=document.querySelector("template#"+r)}catch(e){}return a?n=a.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=r),n}})),Prism.hooks.add("complete",r)}}(); diff --git a/docs/source/_static/theme-override.css b/docs/source/_static/theme-override.css index 5155f0f519..3d1a9280da 100644 --- a/docs/source/_static/theme-override.css +++ b/docs/source/_static/theme-override.css @@ -53,11 +53,17 @@ } #content .highlight { - background-color: hsl(var(--accent)) !important; + background-color: #f6f8fa !important; border-radius: 0.25rem; font-variant-ligatures: none; } +@media (prefers-color-scheme: dark) { + #content .highlight { + background-color: #161b22 !important; + } +} + /* Disables the saturation filter on project icon in dark mode */ .dark\:invert { --tw-invert: none !important; diff --git a/docs/source/conf.py b/docs/source/conf.py index 555ea49dfe..73d195ae1b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -168,10 +168,16 @@ html_theme_options = asdict(ThemeOptions( html_permalinks_icon = Icons.permalinks_icon +html_js_files = [ + 'prism.js' +] + html_css_files = [ "theme-override.css", "luadoc.css", - "figures.css" + "figures.css", + "prism.css", + "prism-dark.css", ] # Add any paths that contain custom themes here, relative to this directory. diff --git a/docs/source/install_luadocumentor_in_docker.sh b/docs/source/install_luadocumentor_in_docker.sh index 7eb22103db..388ba8b739 100755 --- a/docs/source/install_luadocumentor_in_docker.sh +++ b/docs/source/install_luadocumentor_in_docker.sh @@ -33,7 +33,7 @@ PATH=$PATH:~/luarocks/bin echo "Install openmwluadocumentor" git clone https://gitlab.com/ptmikheev/openmw-luadocumentor.git cd openmw-luadocumentor -git checkout c3252620eb5f6cd740dadfcb374a20b23b36f1fd +git checkout 122e4f55c5f2dd62076135211e03edfb8dec3a55 luarocks make luarocks/openmwluadocumentor-0.2.0-1.rockspec cd ~ rm -r openmw-luadocumentor diff --git a/docs/source/reference/lua-scripting/index_interfaces.rst b/docs/source/reference/lua-scripting/index_interfaces.rst index 4d9f6e9cff..02a202ed20 100644 --- a/docs/source/reference/lua-scripting/index_interfaces.rst +++ b/docs/source/reference/lua-scripting/index_interfaces.rst @@ -12,13 +12,13 @@ Interfaces Animation Camera Controls + Crimes GamepadControls ItemUsage MWUI Settings SkillProgression UI - Crimes **Interfaces of built-in scripts** diff --git a/docs/source/reference/lua-scripting/tables/aux_packages.rst b/docs/source/reference/lua-scripting/tables/aux_packages.rst index d51949e1b2..202f5219c2 100644 --- a/docs/source/reference/lua-scripting/tables/aux_packages.rst +++ b/docs/source/reference/lua-scripting/tables/aux_packages.rst @@ -8,12 +8,12 @@ * - :doc:`calendar ` - |bdg-ctx-all| - Game time calendar - * - :doc:`util ` - - |bdg-ctx-all| - - Miscellaneous utils * - :doc:`time ` - |bdg-ctx-all| - Timers and game time utils * - :doc:`ui ` - |bdg-ctx-menu| |bdg-ctx-player| - User interface utils + * - :doc:`util ` + - |bdg-ctx-all| + - Miscellaneous utils diff --git a/docs/source/reference/lua-scripting/tables/interfaces.rst b/docs/source/reference/lua-scripting/tables/interfaces.rst index bdf8104678..8496d01029 100644 --- a/docs/source/reference/lua-scripting/tables/interfaces.rst +++ b/docs/source/reference/lua-scripting/tables/interfaces.rst @@ -8,36 +8,36 @@ * - :doc:`Activation ` - |bdg-ctx-global| - Allows to extend or override built-in activation mechanics. - * - :doc:`ItemUsage ` - - |bdg-ctx-global| - - Allows to extend or override built-in item usage mechanics. - * - :doc:`Crimes ` - - |bdg-ctx-global| - - Commit crimes. * - :doc:`AI ` - |bdg-ctx-local| - Control basic AI of NPCs and creatures. * - :doc:`AnimationController ` - |bdg-ctx-local| - Control animations of NPCs and creatures. - * - :doc:`SkillProgression ` - - |bdg-ctx-local| - - Control, extend, and override skill progression of the player. * - :doc:`Camera ` - |bdg-ctx-player| - Allows to alter behavior of the built-in camera script without overriding the script completely. * - :doc:`Controls ` - |bdg-ctx-player| - Allows to alter behavior of the built-in script that handles player controls. + * - :doc:`Crimes ` + - |bdg-ctx-global| + - Commit crimes. * - :doc:`GamepadControls ` - |bdg-ctx-player| - Allows to alter behavior of the built-in script that handles player gamepad controls. - * - :doc:`UI ` - - |bdg-ctx-player| - - High-level UI modes interface. Allows to override parts of the interface. - * - :doc:`Settings ` - - |bdg-ctx-global| |bdg-ctx-menu| |bdg-ctx-player| - - Save, display and track changes of setting values. + * - :doc:`ItemUsage ` + - |bdg-ctx-global| + - Allows to extend or override built-in item usage mechanics. * - :doc:`MWUI ` - |bdg-ctx-menu| |bdg-ctx-player| - Morrowind-style UI templates. + * - :doc:`Settings ` + - |bdg-ctx-global| |bdg-ctx-menu| |bdg-ctx-player| + - Save, display and track changes of setting values. + * - :doc:`SkillProgression ` + - |bdg-ctx-local| + - Control, extend, and override skill progression of the player. + * - :doc:`UI ` + - |bdg-ctx-player| + - High-level UI modes interface. Allows to override parts of the interface. diff --git a/docs/source/reference/lua-scripting/tables/packages.rst b/docs/source/reference/lua-scripting/tables/packages.rst index 290b7d3507..b39336b3ac 100644 --- a/docs/source/reference/lua-scripting/tables/packages.rst +++ b/docs/source/reference/lua-scripting/tables/packages.rst @@ -5,24 +5,51 @@ * - Package - Context - Description - * - :doc:`core ` - - |bdg-ctx-all| - - Functions that are common for both global and local scripts + * - :doc:`ambient ` + - |bdg-ctx-menu| |bdg-ctx-player| + - Controls background sounds for given player. + * - :doc:`animation ` + - |bdg-ctx-local| + - Animation controls * - :doc:`async ` - |bdg-ctx-all| - Timers and callbacks. - * - :ref:`interfaces