Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Describe relations with and between specs #211

Merged
merged 9 commits into from
Jun 6, 2021
53 changes: 53 additions & 0 deletions docs/architecture.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@startuml
'https://plantuml.com/component-diagram
'to update the SVG after changing this file run
'docs/puml.sh
skinparam componentStyle rectangle

frame "lib/dom.js" {
cloud "Spec:DOM" {
[DOMException]
[DOMImplementation]
interface Document
interface Element
interface Node
}
component XMLSerializer [
XMLSerializer
Spec:DOM-Parsing
]
}

frame "lib/dom-parser.js" {
component DOMParser [
DOMParser
Spec:HTML
]

component DOMHandler [
DOMHandler
Spec:SAX
]
}

frame "lib/sax.js" {
component XMLReader [
XMLReader
Spec:SAX
]
[ParseError]
}

DOMParser -d-> DOMHandler: new
DOMParser -r-> XMLReader: new
XMLReader --> DOMHandler: using
XMLReader --> ParseError: throw
DOMHandler --> DOMImplementation: new
DOMHandler --> Document: using
DOMImplementation -d-> Document: new
Document -r-> Node: new
Document -l-> Element: new
Document -d-> DOMException: throw
XMLSerializer -u-> Node: visit

@enduml
26 changes: 26 additions & 0 deletions docs/architecture.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions docs/puml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -eu
if [[ ! -d docs ]] ; then
echo "execute from the root directory" && exit 1
fi

export PLANTUML_VERSION=1.2021.4

function svg {
if [[ -f "docs/$1.puml" ]] ; then
echo "updating docs/$1.svg"
< "docs/$1.puml" docker run --rm -i karfau/plantuml:$PLANTUML_VERSION -pipe -tsvg -nometadata > "docs/$1.svg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For people like me who don't have so much extra horsepower to run Docker on my laptop, do you think it will work if I would use Ubuntu on the cloud? Would you recommend any resources if I need to install or configure anything?

Copy link
Member Author

@karfau karfau Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternatives to using docker are

  • either have java installed and download the plantuml.jar and use the command < "docs/$1.puml" java -jar path/to/plantuml.jar -pipe ... instead. I added this as an option to the script, but depending on some OS dependencies (e.g. graphviz) versions the output can differ (this is what happened when I tried it locally).
  • or use the web interface http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000 (but I think it includes metadata which causes the generated to change every time)

Or we could of course also use some other format for creating images/diagrams for documentation purposes. This is just the one that supports many styles and I know how to use it.

else
echo "missing file 'docs/$1.puml'"
fi
}

svg architecture
svg specs
72 changes: 72 additions & 0 deletions docs/specs.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@startuml
'https://plantuml.com/object-diagram
'to update the SVG after changing this file run
'docs/puml.sh

title "References between relevant specs"

note "About spec status: [[https://www.w3.org/2020/Process-20200915/#rec-track The W3C Recommendation Track]]" as status

map "W3C DOM Parsing and Serialization [[https://www.w3.org/standards/history/DOM-Parsing history]]" as DOMParsing {
[[https://w3c.github.io/DOM-Parsing/ latest]] => Editors Draft
**[[https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/ 2016]]** => Working Draft
[[https://www.w3.org/TR/2014/CR-DOM-Parsing-20140617/ 2014]] => Outdated Candidate Recommendation
}

map "Document Object Model (DOM) [[https://www.w3.org/standards/history/dom history]]" as DOM {
[[https://dom.spec.whatwg.org/ latest]] => Living Standard
**[[https://dom.spec.whatwg.org/review-drafts/2019-06/ Level 4 (2020)]]** => DOM Recommendation
[[https://www.w3.org/TR/DOM-Level-3-Core/ Level 3 Core (2004)]] => Recommendation (**[[https://dom.spec.whatwg.org/#historical has outdated parts!]]**, [[https://www.w3.org/standards/history/DOM-Level-3-Core history]])
**[[https://www.w3.org/TR/DOM-Level-2-HTML/ Level 2 HTML (2003)]]** => Superseded Recommendation
**[[https://www.w3.org/TR/DOM-Level-2-Core/ Level 2 Core (2000)]]** => Superseded Recommendation
}

map "Hyper Text Markup Language (HTML)" as HTML {
[[https://html.spec.whatwg.org/ latest]] => Living Standard
[[https://html.spec.whatwg.org/review-drafts/2020-01/ HTML5 (2020)]] => Recommendation ([[https://www.w3.org/standards/history/html history]])
[[https://www.w3.org/TR/html401/ HTML4.01 (1999)]] => Recommendation ([[https://www.w3.org/standards/history/html401 history]])
[[https://www.w3.org/TR/html401/ HTML4.01 (1999)]] => Superseded Recommendation ([[https://www.w3.org/standards/history/html401 history]])
[[https://www.w3.org/TR/xhtml1/ XHTML 1.0 (2002)]] => Superseded Recommendation [[https://www.w3.org/standards/history/xhtml1 history]]
[[https://www.w3.org/TR/xhtml1/ XHTML 1.0 (2002)]] => Superseded Recommendation [[https://www.w3.org/standards/history/xhtml1 history]]

}

map "Extensible Markup Language (XML)" as XML {
[[https://www.w3.org/TR/xml11/ 1.1 (2006)]] => Recommendation [[https://www.w3.org/standards/history/xml11 history]]
[[https://www.w3.org/TR/xml/ 1.0 (2008)]] => Recommendation [[https://www.w3.org/standards/history/xml history]]
}

map "Namespaces in XML" as XMLNS {
[[https://www.w3.org/TR/xml-names11/ 1.1 (2006)]] => Recommendation
[[https://www.w3.org/TR/REC-xml-names/ 1.0 (2009)]] => Recommendation
}

map "WebIDL [[https://www.w3.org/standards/history/WebIDL-1 history]]" as WebIDL {
[[https://heycam.github.io/webidl/ latest]] => Editors Draft
[[https://www.w3.org/TR/WebIDL-1/ Level 1 (2016)]] => Recommendation
}

map "[[http://www.saxproject.org/ Simple API for XML (SAX)]]" as SAX {

}

DOM <--> HTML
DOM --> WebIDL
DOM --> XML

DOMParsing --> DOM
DOMParsing <--> HTML
DOMParsing --> XML
DOMParsing --> WebIDL

HTML --> XML
HTML --> XMLNS

SAX --> XML
SAX --> XMLNS

XMLNS --> XML



@enduml
13 changes: 13 additions & 0 deletions docs/specs.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"parser",
"javascript",
"DOMParser",
"XMLSerializer"
"XMLSerializer",
"ponyfill"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

],
"author": "jindw <jindw@xidea.org> (http://www.xidea.org)",
"homepage": "https://github.com/xmldom/xmldom",
Expand Down