[mod] tidy
This commit is contained in:
parent
b0e18a87ac
commit
529b57d628
8 changed files with 19 additions and 29 deletions
|
@ -1,6 +1,5 @@
|
|||
import module namespace hnd="lsp/handlers" at "../webapp/lsp/handlers.xqm";
|
||||
import module namespace syms="lsp/symbols" at "../webapp/lsp/providers/documentSymbols.xqm";
|
||||
import module namespace lsp-diags = 'lsp-diags' at "../webapp/lsp/providers/diagnostics.xqm";
|
||||
declare variable $src:="sample.docs/parse-pdfbox.xml";
|
||||
declare variable $parse:=doc($src)/*;
|
||||
|
||||
hnd:diags($parse )
|
||||
declare variable $text:=unparsed-text("sample.docs/pdfbox3-bad.xqm");
|
||||
lsp-diags:list("file",$text,$parse )
|
||||
|
|
|
@ -34,7 +34,7 @@ declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|||
|
||||
declare namespace RandomAccessReadBuffer="java:org.apache.pdfbox.io.RandomAccessReadBuffer";
|
||||
declare namespace RandomAccessReadBufferedFile = "java:org.apache.pdfbox.io.RandomAccessReadBufferedFile";
|
||||
declare namespace PDRectangle="org.apache.pdfbox.pdmodel.common.PDRectangle";
|
||||
declare namespace PDRectangle="java:org.apache.pdfbox.pdmodel.common.PDRectangle";
|
||||
|
||||
declare namespace File ="java:java.io.File";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
xquery version '3.1';
|
||||
(:~
|
||||
A BaseX 10.7+ interface to pdfbox3 https://pdfbox.apache.org/ ,
|
||||
requires pdfbox jars on classpath, in lib/custom or xar
|
||||
@note following the java source the terms outline and bookmark
|
||||
refer to the same concept. Also label and (page)range are used interchangably
|
||||
|
@ -287,7 +288,6 @@ as map(*)*{
|
|||
|
||||
return if(exists($outline))
|
||||
then pdfbox:outline($pdf,PDOutlineItem:getFirstChild($outline))
|
||||
else ()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -364,7 +364,6 @@ as item()?
|
|||
then PDDocument:getDocumentCatalog($pdf)
|
||||
=>PDDocumentCatalog:getPages()
|
||||
=>PDPageTree:indexOf($page)
|
||||
else ()
|
||||
};
|
||||
|
||||
(:~ Return new PDF doc with pages from $start to $end as xs:base64Binary, (1 based)
|
||||
|
@ -436,7 +435,7 @@ as xs:string?{
|
|||
return string-join(($page,
|
||||
if(empty($style)) then "-" else $style,
|
||||
if(($start eq 1)) then "" else $start,
|
||||
if(exists($prefix)) then '*' || $prefix else () (:TODO double " :)
|
||||
if(exists($prefix)) then '*' || $prefix (:TODO double " :)
|
||||
))
|
||||
};
|
||||
|
|
@ -7,6 +7,7 @@ import module namespace docs="lsp/docs" at "docs.xqm";
|
|||
import module namespace rpc = 'rpc' at 'jsonrpc.xqm';
|
||||
import module namespace lspt = 'lsp-typedefs' at 'lsp-typedefs.xqm';
|
||||
import module namespace pos="lsp/position" at "position.xqm";
|
||||
import module namespace syms="lsp/symbols" at "providers/documentSymbols.xqm";
|
||||
|
||||
declare variable $lsp-text:methods:=map{
|
||||
"textDocument/didOpen": lsp-text:didOpen#1,
|
||||
|
|
|
@ -5,7 +5,7 @@ import module namespace hnd="lsp/handlers" at "../handlers.xqm";
|
|||
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
|
||||
|
||||
declare function syms:list($parse as element(),$syms as lspt:DocumentSymbol* :=() )
|
||||
{
|
||||
as lspt:DocumentSymbol*{
|
||||
let $actions as hnd:actionMap :={
|
||||
"ContextValueDecl": syms:action#2,
|
||||
"VarDecl": syms:VarDecl#2,
|
||||
|
@ -18,6 +18,7 @@ declare function syms:list($parse as element(),$syms as lspt:DocumentSymbol* :=(
|
|||
return $result?result
|
||||
};
|
||||
|
||||
(:~ just trace :)
|
||||
declare function syms:action($parse as element(),$state as hnd:Result )
|
||||
as hnd:Result{
|
||||
hnd:Result($state?result,true()) ,message(name($parse),"ACTION: ")
|
||||
|
|
|
@ -172,7 +172,7 @@
|
|||
<button type="button" class="btn-close" aria-label="Close"
|
||||
onclick="$('popHelp').hidePopover(); "></button>
|
||||
</header>
|
||||
<div id=popHelpInfo" class="modal-body">
|
||||
<div id="popHelpInfo" class="modal-body">
|
||||
TODO
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -30,18 +30,7 @@ class ListComponent extends HTMLElement {
|
|||
get data() {
|
||||
return this.#data;
|
||||
}
|
||||
select(e) {
|
||||
this.#shadow.querySelectorAll('li.selected').forEach(item => { item.className = ''; });
|
||||
e.currentTarget.className = 'selected';
|
||||
console.log('Item clicked:', item, listItem);
|
||||
// You can dispatch a custom event here if needed.
|
||||
this.dispatchEvent(new CustomEvent('itemSelected', {
|
||||
detail: item,
|
||||
bubbles: true,
|
||||
composed: true
|
||||
}));
|
||||
|
||||
}
|
||||
/* Render the list items #data */
|
||||
render() {
|
||||
const list = document.createElement('ul');
|
||||
|
@ -52,10 +41,10 @@ class ListComponent extends HTMLElement {
|
|||
this.#shadow.querySelectorAll('li.selected').forEach(item => { item.className = ''; });
|
||||
e.currentTarget.className = 'selected';
|
||||
const i=e.currentTarget.getAttribute("data-index")
|
||||
console.log('Item index clicked:', i);
|
||||
console.log('Item index clicked:', i,this.#data[i]);
|
||||
// You can dispatch a custom event here if needed.
|
||||
this.dispatchEvent(new CustomEvent('itemSelected', {
|
||||
detail: i,
|
||||
detail: this.#data[i],
|
||||
bubbles: true,
|
||||
composed: true
|
||||
}));
|
||||
|
@ -76,7 +65,8 @@ class ListComponent extends HTMLElement {
|
|||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
@import url("../codicon@0.0.40/codicon.css");
|
||||
ul { list-style-type: none; padding:0;margin:0; }
|
||||
ul { list-style-type: none; padding:0;margin:0;max-height:80cqh;overflow: auto;
|
||||
background-color: #f8f9fa;font-size: 80%;}
|
||||
li { padding: 0 0 0 2px; border-bottom: 1px solid #ccc; cursor: pointer; width:100%; }
|
||||
li:not(.selected) :hover { background-color: #ccc; }
|
||||
.selected { background-color: #0d6efd;color: #ffff;}
|
||||
|
|
|
@ -93,9 +93,9 @@ $("cmd").onclick = e => {
|
|||
|
||||
};
|
||||
|
||||
$("symList").onclick = e => {
|
||||
console.log("SYM CLICK");
|
||||
};
|
||||
$("symList").addEventListener("itemSelected", e => {
|
||||
console.log("SYM itemSelected",e.detail);
|
||||
});
|
||||
|
||||
$("lint").onclick = async e => {
|
||||
console.log("word", view.state.wordAt(1));
|
||||
|
|
Loading…
Add table
Reference in a new issue