Giter Site home page Giter Site logo

pdml-lang / pdml-lang.github.io Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 38.33 MB

PDML website (including all docs)

Home Page: https://pdml-lang.dev/

License: GNU General Public License v2.0

Shell 0.84% Batchfile 0.51% Promela 21.69% HTML 61.54% CSS 8.76% JavaScript 6.66%

pdml-lang.github.io's Introduction

PDML website

This repository contains the files to create and serve www.pdml-lang.dev.

The following root directories are used:

  • work: contains the source files needed to create the target files in directory docs.

  • docs: contains the target website files used by the web server.

  • creator: contains the static website creator (PSWC).

Usage And Dependencies

Documents stored in directory work/docs are written in PML. To convert these PML documents to HTML you need to install PMLC, and then execute bin/create_HTML.cmd in each document's root directory.

To create the website you need Java version 17 or higher to be installed on your system. You can then execute creator/create_website.cmd. This command will read files in directory work, and write files into directory docs.

Help And Discussions

Please use GitHub Discussions.

Issues

Please use GitHub Issues to post an issue.

pdml-lang.github.io's People

Contributors

pml-lang avatar ppl-lang avatar pdml-lang avatar

Stargazers

Shelby Landen avatar

Watchers

Alexey Zaharchenko avatar Liam OBrien avatar  avatar

pdml-lang.github.io's Issues

Serving from 'docs/' Folder to Include Site Sources

I noticed that you're serving the GHPages directly from the repo root.

You might consider to switch to using the docs/ folder instead, which would allow the rest of the repository to contain the PML source files, assets, etc. to build the static HTML website, instead.

While this wouldn't affect how the online website is viewed, it would allow users to contribute to it by submitting changes to the PML sources, or other assets. E.g. the repository could contain Sass sources to generate the stylesheets, and use Rake to manage building the website, its assets and any required tests and validation.

The PML source repositories for the various docs (specs, examples, articles, etc.) could be integrate via Git submodules, which would make working with website sources a very smooth experience.

You'd still have the same static HTML contents the docs/ folder, but with the benefits of having all the source files in the same repository.

Hyphens in Node Names

The article Suggestion For a Better XML/HTML Syntax states in the section titled Comments

an element name cannot contain hyphens (-).

Does this mean hyphens aren't allowed in the middle of names either?

[- Comment -]
[custom-element
  some text
]

Today's HTML component authors must use multi-word names separated by hyphens to not conflict with any official HTML single-word element, existing or not.

How does this come into play in PDML, especially if used as an alternative to write Web documents?

Whitespace Open Rules and Editors' Syntaxes

@pdml-lang, I've started working on a PDML syntax for Sublime Text:

https://github.com/tajmone/Sublime-PDML

The repo is just a skeleton, and I'm working on the actual syntax locally for now.

I have some practical questions to help me clarify some parsing issues which are not clear to me. Since this repository has no Discussions, I'm creating an Issue (might be worth enabling Discussions though, since it's a standard/spec, and people might like to share their implementation, etc.).

Whitespace Open Rules

In Basic PDML Specification » Whitespace it says:

There are no whitespace handling rules defined in basic PDML.

Whitespace is preserved when a PDML document is parsed.

and:

Applications reading PDML documents (or customized PDML parsers) are free to implement any appropriate whitespace handling rules, such as:

  • skip whitespace nodes
  • trim leading and/or trailing whitespace in text nodes
  • replace whitespace sequences with a single space (similar to HTML)

Which, if I've understood correctly, is a way to keep the standard open to different applications, according to domain-specific needs — i.e. the Basic PDML Spec lies the foundations for a versatile data and markup scheme, leaving some details open on purpose in order not to preclude any specific use.

Editor Syntaxes vs Open Rules

But when implementing an editor syntax, whitespace can indeed become a problem, since the syntax needs whitespace handling rules in order to work.

Let me illustrate the problem using actual examples from the PDML website...

Whitespace Is Preserved

Again, quoting Basic PDML Specification » Whitespace:

Whitespace is preserved when a PDML document is parsed.

Consider the following PDML snippet:

[a  foo   [b]
    2 [c] [d]
]

According to the above example, node [a is parsed as:

{space}foo{space}{space}{space}

which indicates that leading- and trailing-spaces in a text node are preserved (separator space excluded).

Whitespace Is Ignored

In PDML Examples » Tree we find the following example:

[config
    [color orange]
    [size
        [width 1618]
        [height 1000]
    ]
]

where it says:

Node config has two child nodes: color and size. Node size has two child nodes too: width and height.

According to this example, all whitespace between parent and child nodes is simply ignored.

This seems to indicate that there is indeed an implicit whitespace handling rule at play here, i.e. that a text node can't be whitespace only!

If that wasn't the case, then the above example should produce various text nodes too, interpreting any whitespace between the parent nodes and their children as text nodes with spaces only:

  • config:
    • text:
    • color:
      • text: orange
    • text:
    • size:
      • text:
      • width:
        • text: 1618
      • text:
      • height:
        • text: 1000
    • text:

Do you see my point? According to the EBNF grammar and the railroad diagrams, a separator consists of a single whitespace entity (optional in some cases, like [node1[node2), and everything else is to be considered a text node — which the first of the two examples seems to confirm.

From the standpoint of an editor syntax (based on RegExs definitions) we need a clear rule regarding this.

Impressions…

I get the impression that the second example wishes to illustrate how trees with various levels of nodes nesting can be prettified by using indentation to provide visual cues to structure.

On the other hand, the first example seems to emphasize how PDML parsing is rules-free when it comes to handling literal text, which allows its use for handling raw strings snippets in a lossy-less manner — e.g. when handling code styled listings, where indentation matters.

But you can see that there's a grey area in-between these two extremes, when it comes to whitespace only nodes (e.g. indentation snippets, or sequences on newlines, etc.) — we can either honour them or ignore them, but can't do both at the same time.

Even though the principle of openness stands (i.e. that these details should be handled by the specific applications), editors support needs an explicit rule for this, lest it becomes an opinionated implementation of the Basic PDML syntax.

Proposals

Personally, I think it makes sense to treat whitespace in-between nodes as noise, unless there's some text, in which case we should preserve trailing and leading space entities (mandatory separator excluded), and then leave it to the user to decide whether to trim the spaces on the edges or not, either in the editor or in the final application.

One could add extra functionality to the package, e.g. to trim all leading- and trailing-whitespace from text nodes — but this also means that prettying PDML trees can only be done safely when dealing with trees where text nodes don't span across multiple lines (and when the proposed whitespace-only rule is in place).

What's your advice and guidance on this? how should the syntax handle the whitespace problem.

Also, do you see two potentially different types of the trees when dealing with pretty-formatting (as in JSON) as compared to text nodes spanning across multiple lines?

I guess these type of problems are solved through extension of the Basic PDML, e.g. by introducing specific operators to handle multi-line strings and their whitespace (like for HereDocs, or YAML's use of the pipe | in string blocks).

But right now that we're trying to build some basic editors' support for PDML, we need to address the question in practical terms.

Possible Error in PML Docs

In https://pml-lang.dev/docs/user_manual, the Anatomy > Attributes section says

Attribute assignments are separated by a space

The Text Processing > Lenient Parsing section says

Quotes around attribute values can be omitted if the value does not contain:

  • whitespace (' ', '\t', '\r\n', '\n')
  • any of the following characters: [ ] ( ) " '

So far, so good.

However, the Text Processing > Whitespace Handling > Attributes section, which is not a part of the Lenient Parsing section, shows an example of how you can separate attributes with new lines.

[tag (
    attribute1 = something
    attribute2 = 400
)]

That's the same as:

[tag (\nattribute1 = something\nattribute2 = 400\n)]

That looks like the mentioned Lenient Parsing, but I'm not 100% certain. More importantly though, the Text Processing > Escape Characters > Attributes section then says

Escape sequences are not supported in unquoted attribute values.

And the example:

... assign the value C:\temp\test.txt to attribute path, i.e. path = C:\temp\test.txt

So, given the whitespace rules explained in earlier sections (or maybe just the Lenient Parsing section), this would be interpreted as

path = C:    emp    est.txt)

producing three attributes; path, emp, and est.txt because \t is whitespace.

Is that example only valid in non-lenient parsing, and would need to be quoted in lenient parsing?

Fix Node Name RegEx

In Basic PDML Specification » Name it says:

A node name must match the regex [a-zA-Z_][a-zA-Z1-9_-\.]*.

Please fix the RegEx to [a-zA-Z_][a-zA-Z1-9_\.-]*, otherwise the - is interpreted as a range operator (i.e. from _ to .) which results in an invalid RegEx expression in most engines.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.