npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

p23r-selection-compiler

v1.0.0

Published

Translating P23R selection expressions to xquery code for a P23R processor or P23R source connector

Downloads

2

Readme

README.md

Author: Jan Gottschick[email protected]

This is a P23R Selection language to Xquery code compiler. P23R Selection is part of the P23R project and described in its specifications, which are available at

http://www.p23r.de or https://entwickler.p23r.de

Usage as a command

The compiler is implemented in Javascript and requires node.js, which is available at

http://nodejs.org

After installing node.js you can install the p23r selection compiler, globally, by

npm install p23r-selection-compiler -g

and start the compiler by

dats2xquery

You can enter the p23r selection source code via stdin and the target code will appear on stdout, e.g. code for the p23r processor

echo "I'm a comment" | dats2xquery processor

will output

(: I'm a comment :)

The following options are available:

Usage:
  dats2xquery [OPTIONS] [infile [outfile]]

Create Xquery code from P23R selection expressions.

Options:
	-s, --start [STRING]   specify a different start rule (Default is start)
	-k, --no-color         Omit color from output
	--debug                Show debug information
	-v, --version          Display the current version
	-h, --help             Display help and usage details

Commands:
connector, processor

You must include a command as part of the options to specify for which p23r component the code should be generated.

Usage inside your code

You can include the p23r selection compiler in your project, too. If you build a server side service using node.js just include p23r-selection-compiler in your package.json file. You can call the command using a relative path to node_modules/p23r-selection-compiler/dats2xquery. Or you use the library the usual way, e.g. in coffeescript

compiler = require 'p23r-selection-compiler'

...
connectorTargetCode = compiler.xqueryForConnector(connectorSourceCode)
processorTargetCode = compiler.xqueryForProcessor(processorSourceCode)

If you like to use the compiler inside your browser code you can load the p23r selection compiler by using bower. Just include p23r-selection-compiler in your bower.json file. Then load the files

  • ../p23r-selection-compiler/dist/lib/js/selectionConnectorLib.js
  • ../p23r-selection-compiler/dist/lib/js/selectionProcessorLib.js

with your web page and call the parser

connectorTargetCode = selectionConnector.parse(connectorSourceCode)
processorTargetCode = selectionProcessor.parse(processorSourceCode)

Errors can be handled in both cases using try and catch, e.g.

try
	connectorTargetCode = selectionConnector.parse(connectorSourceCode)
catch error
	console.log error.name + " in selection at " + error.line + "," + error.column + ": " + error.message

Legal issues

This project is part of the openP23R initiative. All related projects are listed at https://gitlab.com/openp23r/openp23r .

The legal conditions see LICENSE file.

The project is maintained by P23R-Team (a) Fraunhofer FOKUS