The CommonMark\CQL class

(cmark >= 1.1.0)

Einführung

CommonMark Query Language is a DSL for describing how to travel through a CommonMark Node tree implemented as a parser and compiler for a small set of instructions, and a virtual machine for executing those instructions.

Paths:

In it's most simplistic form, a CQL query combines the following paths and / to describe how to travel through a tree:

  • firstChild
  • lastChild
  • previous
  • next
  • parent
For example, /firstChild/lastChild would travel to the last child node of the first child node.

Loops

CQL can be instructed to loop, for example through the children of, or siblings to a particular node, by using the path children, or siblings. For example, /firstChild/children will travel to all the children of the first child node.

Subqueries

CQL can be instructed how to travel by using a subquery like [/firstChild]. For example, /firstChild/children[/firstChild] will travel to the first child node of all the children of the first child node.

Loop Constraints

While looping, CQL can be instructed to constrict the travelled path to nodes of particular type. For example /children(BlockQuote) will travel to the children of a node where the type is BlockQuote. The following types are recognized (case insensitively):

  • BlockQuote
  • List
  • Item
  • CodeBlock
  • HtmlBlock
  • CustomBlock
  • Paragraph
  • Heading
  • ThematicBreak
  • Text
  • SoftBreak
  • LineBreak
  • Code
  • HtmlInline
  • CustomInline
  • Emphasis
  • Strong
  • Link
  • Image
Types may be used as a union, for example /children(BlockQuote|List) will travel to the children of a node where the type is BlockQuote or List. Types, or unions of types, may be also negated. For example /children(~BlockQuote) will travel to the children of a node where the type is not BlockQuote, and /children(~BlockQuote|Paragraph) will travel to the children of a node where the type is not BlockQuote or Paragraph

Path Constraints

CQL can be instructed to create a loop to travel to a node of a particular type, at a particular path. For example, /firstChild(BlockQuote) will travel to the first child node where the type is BlockQuote. Note that like other loops for children and siblings, this kind of path can only be followed by a subquery.

Implementation Notes

While CQL has been implemented as part of the PHP CommonMark extension, it stands separately from PHP and does not use PHP's virtual machine or internal representation of values.

Klassenbeschreibung

class CommonMark\CQL {
/* Constructor */
public __construct(string $query)
/* Methoden */
public __invoke(CommonMark\Node $root, callable $handler)
}

Inhaltsverzeichnis

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Warum soll ich float meiden? Siehe https://www.linkedin.com/pulse/css-float-vs-grid-flexbox-sachin-tiwari Falls es mit Englisch nicht so klappt: ...

Geschrieben von scatello am 18.05.2024 05:57:56
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Also den Fehler habe ich gefunden und abgestellt. Warum soll ich float meiden?

Geschrieben von Malchor am 17.05.2024 20:54:01
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Dein HTML-Code ist definitiv kaputt und float solltest du auch vergessen. Beschäftige dich mit Flex-Box oder Grid

Geschrieben von scatello am 17.05.2024 20:43:50
Forum: PHP Developer Forum
Daten einer Abfrage mit Hilfe von Thumbnails nebeneinander ausgeben

Da ich viele unterschiedliche Tabellen benötige mache ich das so umständlich. Aber ist das der Grund warum das Floaten nicht funktioniert?

Geschrieben von Malchor am 17.05.2024 17:15:03
Forum: PHP Developer Forum