Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
99077f5
Add experimental support to build using Bikeshed
foolip Feb 8, 2025
119d1a9
Quickly hack up the conversion in JS
foolip Mar 4, 2025
a2b84bc
Work towards working <dfn>s and their use
foolip Mar 7, 2025
b03fbd6
Improve cross-linking further (still broken)
foolip Mar 10, 2025
c49c398
Unwrap <pre><code> to just <pre>
foolip Mar 10, 2025
9660bdc
Move <a> simplification to a final pass
foolip Mar 12, 2025
2e7888d
Preserve Wattsi IDs
foolip Mar 12, 2025
78a15b2
Don't use data-x to populate lt, just remove them
foolip Mar 13, 2025
19fc283
Remove "new" from the linking text of constructors
foolip Mar 13, 2025
b140019
Rewrite data-lt to lt
foolip Mar 13, 2025
017385d
Handle data-lt in more places
foolip Mar 13, 2025
0e8e03e
Handle <i data-x> links
foolip Mar 13, 2025
03bfae7
Make Bikeshed find the right <dfn> more often
foolip Mar 14, 2025
330630b
Use noexport="" to silence some Bikeshed warnings
foolip Mar 14, 2025
94ade7e
Use data-x attribute as local-lt to make more links work
foolip Mar 14, 2025
004e014
Fix up document.write/writeln cases
foolip Mar 17, 2025
15d1327
Handle <dfn data-x=""> better
foolip Mar 17, 2025
b4254fc
Lowercase linking texts to detect more clashes
foolip Mar 18, 2025
2dafc45
Use local-lt="xxx-...." to ensure links
foolip Mar 19, 2025
d60175e
Remove getTopicAndSource()
foolip Mar 19, 2025
a266ce4
Update permalink
foolip Mar 19, 2025
5ed37ae
Revert Rust changes (unused)
foolip Sep 4, 2025
cb9f529
Merge remote-tracking branch 'origin/main' into bikeshed-experiment
foolip Sep 4, 2025
233c63a
Strip all markup inside code blocks
foolip Sep 10, 2025
1f6b200
Handle w-nodev and similar attributes
foolip Sep 10, 2025
fa185ea
Merge remote-tracking branch 'origin/main' into bikeshed-experiment
foolip Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ declare -r WATTSI_LATEST=140
# Shared state variables throughout this script
LOCAL_WATTSI=true
WATTSI_RESULT=0
USE_BIKESHED=false
DO_UPDATE=true
DO_LINT=true
DO_HIGHLIGHT=true
Expand All @@ -37,6 +38,7 @@ HTML_GIT_CLONE_OPTIONS=${HTML_GIT_CLONE_OPTIONS:-"--depth=2"}

# This is used by child scripts, and so we export it
export HTML_CACHE
export USE_BIKESHED

# Used specifically when the Dockerfile calls this script
SKIP_BUILD_UPDATE_CHECK=${SKIP_BUILD_UPDATE_CHECK:-false}
Expand Down Expand Up @@ -85,14 +87,16 @@ function main {
exit 0
fi

checkWattsi
ensureHighlighterInstalled
if [[ $USE_BIKESHED != "true" ]]; then
checkWattsi
ensureHighlighterInstalled

doLint
doLint

updateRemoteDataFiles
updateRemoteDataFiles

startHighlightServer
startHighlightServer
fi

processSource "source" "default"

Expand Down Expand Up @@ -146,6 +150,7 @@ function processCommandLineArgs {
echo " $0 help Show this usage statement."
echo
echo "Build options:"
echo " -b|--bikeshed Use Bikeshed instead of Wattsi. (experimental)"
echo " -d|--docker Use Docker to build in a container."
echo " -r|--remote Use the build server."
echo " -s|--serve After building, serve the results on http://localhost:$SERVE_PORT."
Expand Down Expand Up @@ -176,6 +181,9 @@ function processCommandLineArgs {
DO_HIGHLIGHT=false
SINGLE_PAGE_ONLY=true
;;
-b|--bikeshed)
USE_BIKESHED=true
;;
-d|--docker)
USE_DOCKER=true
;;
Expand Down Expand Up @@ -663,27 +671,33 @@ function processSource {
cargo run "${cargo_args[@]}" <"$HTML_SOURCE/$source_location" >"$HTML_TEMP/source-whatwg-complete"
fi

runWattsi "$HTML_TEMP/source-whatwg-complete" "$HTML_TEMP/wattsi-output"
if [[ $WATTSI_RESULT == "0" ]]; then
if [[ $LOCAL_WATTSI != "true" ]]; then
"$QUIET" || grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
fi
if [[ $USE_BIKESHED == "true" ]]; then
echo "BIKESHED!!!"
bikeshed spec --byos "$HTML_TEMP/source-whatwg-complete" "$HTML_TEMP/bikeshed-output" --md-Text-Macro="SHA $HTML_SHA"
exit 0
else
if [[ $LOCAL_WATTSI != "true" ]]; then
"$QUIET" || grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
fi
if [[ $WATTSI_RESULT == "65" ]]; then
echo
echo "There were errors. Running again to show the original line numbers."
echo
runWattsi "$HTML_SOURCE/$source_location" "$HTML_TEMP/wattsi-raw-source-output"
runWattsi "$HTML_TEMP/source-whatwg-complete" "$HTML_TEMP/wattsi-output"
if [[ $WATTSI_RESULT == "0" ]]; then
if [[ $LOCAL_WATTSI != "true" ]]; then
grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
"$QUIET" || grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
fi
else
if [[ $LOCAL_WATTSI != "true" ]]; then
"$QUIET" || grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
fi
if [[ $WATTSI_RESULT == "65" ]]; then
echo
echo "There were errors. Running again to show the original line numbers."
echo
runWattsi "$HTML_SOURCE/$source_location" "$HTML_TEMP/wattsi-raw-source-output"
if [[ $LOCAL_WATTSI != "true" ]]; then
grep -v '^$' "$HTML_TEMP/wattsi-output.txt" # trim blank lines
fi
fi
echo
echo "There were errors. Stopping."
exit "$WATTSI_RESULT"
fi
echo
echo "There were errors. Stopping."
exit "$WATTSI_RESULT"
fi

# Keep the list of files copied from $HTML_SOURCE in sync with `doServerBuild`
Expand Down
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ mod rcdom_with_line_numbers;
mod represents;
mod tag_omission;

const BIKEPLATE: &str = "<pre class=metadata>
Group: WHATWG
H1: HTML
Shortname: html
Abstract: HTML is Bikeshed.
Indent: 1
</pre>";

#[tokio::main]
async fn main() -> io::Result<()> {
// This gives slightly prettier error-printing.
Expand All @@ -35,6 +43,12 @@ async fn run() -> io::Result<()> {
// Find the paths we need.
let cache_dir = path_from_env("HTML_CACHE", ".cache");
let source_dir = path_from_env("HTML_SOURCE", "../html");
let use_bikeshed_str = env::var_os("USE_BIKESHED");
Copy link
Member Author

Choose a reason for hiding this comment

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

It'd probably be less messy to use a --bikeshed command line arg.

let use_bikeshed = use_bikeshed_str.is_some_and(|s| s.eq_ignore_ascii_case("TRUE"));
if use_bikeshed {
eprintln!("BIKESHED MODE");
println!("{}", BIKEPLATE);
}

// Because parsing can jump around the tree a little, it's most reasonable
// to just parse the whole document before doing any processing. Even for
Expand Down