Skip to content

Commit 921e1f5

Browse files
authored
Merge pull request #804 from ypriverol/feat/yaml-driven-template-docs
Feat/yaml driven template docs
2 parents 32484e4 + dbfb270 commit 921e1f5

24 files changed

+4233
-3100
lines changed

.github/workflows/build-docs.yml

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
1820

1921
- name: Setup Ruby
2022
uses: ruby/setup-ruby@v1
@@ -26,6 +28,9 @@ jobs:
2628
gem install asciidoctor
2729
gem install asciidoctor-diagram
2830
31+
- name: Install Python dependencies
32+
run: pip install pyyaml jinja2
33+
2934
- name: Set output directory based on branch
3035
id: set-output-dir
3136
run: |
@@ -37,45 +42,14 @@ jobs:
3742
echo "base_url=/dev" >> $GITHUB_OUTPUT
3843
fi
3944
40-
- name: Create output directory
41-
run: mkdir -p ${{ steps.set-output-dir.outputs.output_dir }}
42-
43-
- name: Build AsciiDoc documentation
44-
run: |
45-
chmod +x scripts/build-asciidoc.sh
46-
./scripts/build-asciidoc.sh ${{ steps.set-output-dir.outputs.output_dir }}
47-
48-
- name: Copy static assets
49-
run: |
50-
chmod +x scripts/copy-assets.sh
51-
./scripts/copy-assets.sh ${{ steps.set-output-dir.outputs.output_dir }}
52-
53-
- name: Build SDRF Explorer index
54-
run: |
55-
python3 site/build-sdrf-index.py
56-
cp site/sdrf-data.json ${{ steps.set-output-dir.outputs.output_dir }}/
57-
58-
- name: Inject navigation headers
59-
run: |
60-
python3 scripts/inject-headers.py ${{ steps.set-output-dir.outputs.output_dir }}
61-
62-
- name: Transform SDRF links to viewer
63-
run: |
64-
python3 scripts/transform-links.py ${{ steps.set-output-dir.outputs.output_dir }}
65-
66-
- name: Transform SDRF example tables
67-
run: |
68-
python3 scripts/transform-sdrf-tables.py ${{ steps.set-output-dir.outputs.output_dir }}
69-
70-
- name: Build search index
45+
- name: Build documentation site
7146
run: |
72-
python3 site/build-search-index.py . ${{ steps.set-output-dir.outputs.output_dir }}/search-index.json
73-
74-
- name: Add version banner for dev branch
75-
if: github.ref_name == 'dev'
76-
run: |
77-
chmod +x scripts/add-dev-banner.sh
78-
./scripts/add-dev-banner.sh ${{ steps.set-output-dir.outputs.output_dir }}
47+
chmod +x scripts/build-docs.sh
48+
if [ "${{ github.ref_name }}" == "dev" ]; then
49+
./scripts/build-docs.sh ${{ steps.set-output-dir.outputs.output_dir }} --dev
50+
else
51+
./scripts/build-docs.sh ${{ steps.set-output-dir.outputs.output_dir }}
52+
fi
7953
8054
- name: Checkout gh-pages branch for merging
8155
if: github.ref_name == 'dev'

DEVELOPMENT.md

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,30 @@ This guide explains how to build and maintain the SDRF-Proteomics documentation
88
proteomics-metadata-standard/
99
├── scripts/ # Build and utility scripts
1010
│ ├── build-docs.sh # Main build script (local & CI/CD)
11-
│ ├── build-asciidoc.sh # AsciiDoc build helper
12-
│ ├── copy-assets.sh # Asset copying helper
11+
│ ├── build_template_pages.py # Generate per-template HTML from YAML
12+
│ ├── build_index_templates.py # Generate index.html template section
13+
│ ├── resolve_templates.py # Template inheritance resolver
1314
│ ├── inject-headers.py # Navigation header injection
14-
│ ├── transform-links.py # SDRF link transformation
15+
│ ├── transform-links.py # .adoc→.html link transformation
1516
│ ├── transform-sdrf-tables.py # SDRF example table styling
17+
│ ├── build_sdrf_builder_data.py # SDRF builder JSON data compiler
1618
│ └── add-dev-banner.sh # Dev version banner
1719
├── sdrf-proteomics/ # Main specification source
1820
│ ├── README.adoc # Main specification (AsciiDoc)
19-
│ ├── tool-support.adoc # Tool support page
20-
│ ├── metadata-guidelines/ # General metadata guidelines
21-
│ │ ├── sample-metadata.adoc
21+
│ ├── TOOLS.adoc # Tool support page
22+
│ ├── TEMPLATES.adoc # Templates guide
23+
│ ├── SAMPLE-GUIDELINES.adoc # Sample metadata guidelines
24+
│ ├── metadata-guidelines/ # Detailed metadata guidelines
25+
│ │ ├── data-analysis-metadata.adoc
2226
│ │ └── sdrf-terms.tsv
23-
│ ├── templates/ # All templates (core + specialized)
24-
│ │ ├── human/ # Human template (includes clinical metadata)
25-
│ │ ├── vertebrates/ # Non-human vertebrates
26-
│ │ ├── invertebrates/ # Invertebrates (Drosophila, C. elegans)
27-
│ │ ├── plants/ # Plant organisms
28-
│ │ ├── ms-proteomics/ # MS proteomics template (base for MS experiments)
29-
│ │ ├── cell-lines/ # Cell line experiments
30-
│ │ ├── crosslinking/ # XL-MS experiments
31-
│ │ ├── immunopeptidomics/ # Immunopeptidomics
32-
│ │ └── ...
27+
│ ├── sdrf-templates/ # YAML template definitions (submodule)
3328
│ └── images/ # Specification images
3429
├── site/ # Website assets and build scripts
3530
│ ├── css/style.css # Main stylesheet
3631
│ ├── js/search.js # Search functionality
32+
│ ├── js/sdrf-builder.js # Interactive SDRF builder logic
3733
│ ├── index.html # Homepage
38-
│ ├── quickstart.html # Quick start guide
34+
│ ├── quickstart.html # Quick start guide + interactive builder
3935
│ ├── sdrf-explorer.html # SDRF dataset explorer
4036
│ ├── sdrf-terms.html # Terms reference page
4137
│ ├── build-sdrf-index.py # Builds dataset index
@@ -88,7 +84,7 @@ The easiest way to build the documentation is using the provided build script. T
8884

8985
1. **Converts AsciiDoc to HTML** using Asciidoctor with proper styling options
9086
2. **Copies static assets** (CSS, JavaScript, images)
91-
3. **Copies static HTML pages** (index.html, quickstart.html, sdrf-explorer.html, sdrf-terms.html)
87+
3. **Copies static HTML pages** (index.html, quickstart.html, sdrf-explorer.html, sdrf-editor.html, sdrf-terms.html)
9288
4. **Builds SDRF Explorer index** from annotated-projects
9389
5. **Injects navigation headers** into all generated HTML pages
9490
6. **Transforms SDRF links** to use the SDRF Explorer viewer
@@ -345,7 +341,6 @@ To force an immediate update, the specification website needs to be rebuilt:
345341
| File | Purpose |
346342
|------|---------|
347343
| `site/sdrf-editor.html` | Editor page (loads Angular app from jsDelivr) |
348-
| `scripts/copy-assets.sh` | Copies editor page during build |
349344
| `scripts/inject-headers.py` | Adds Editor link to navigation |
350345
351346
### Testing Editor Changes Locally
@@ -361,6 +356,32 @@ npm run build -- --configuration=production
361356
# (temporarily change jsDelivr URLs to local paths for testing)
362357
```
363358

359+
## Interactive SDRF Builder
360+
361+
The quickstart page (`/quickstart.html`) includes an interactive SDRF template builder that helps users create custom SDRF templates by answering questions.
362+
363+
### How It Works
364+
365+
1. **Build time:** `scripts/build_sdrf_builder_data.py` resolves all YAML templates and sdrf-terms.tsv into `sdrf-builder-data.json`
366+
2. **Runtime:** `site/js/sdrf-builder.js` loads the JSON and renders a branching questionnaire
367+
3. Users select technology, organism, experiment type, review columns, and download a TSV
368+
369+
### Builder Files
370+
371+
| File | Purpose |
372+
|------|---------|
373+
| `scripts/build_sdrf_builder_data.py` | Compiles YAML templates + terms into JSON |
374+
| `site/js/sdrf-builder.js` | Builder UI logic (vanilla JS) |
375+
| `site/quickstart.html` | Page with simplified intro + builder scaffold |
376+
| `site/css/style.css` | Builder-specific styles (`.builder-*`, `.option-*`) |
377+
378+
### Updating the Builder
379+
380+
When templates change (new columns, new templates):
381+
1. The build script automatically recompiles `sdrf-builder-data.json`
382+
2. No JS changes needed unless new template layers or combination rules are added
383+
3. New templates appear automatically in the appropriate step
384+
364385
## Contributing
365386

366387
1. Make changes to the appropriate AsciiDoc or HTML files

scripts/build-asciidoc.sh

Lines changed: 0 additions & 83 deletions
This file was deleted.

scripts/build-docs.sh

Lines changed: 29 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -109,53 +109,24 @@ echo "Building tool support page..."
109109
asciidoctor \
110110
-D "$OUTPUT_DIR" \
111111
$ASCIIDOCTOR_OPTS \
112-
-o tool-support.html \
113-
sdrf-proteomics/tool-support.adoc
112+
-o tools.html \
113+
sdrf-proteomics/TOOLS.adoc
114114

115-
# Build metadata guidelines
116-
echo "Building metadata guidelines..."
115+
# Build sample guidelines page
116+
echo "Building sample guidelines page..."
117117
asciidoctor \
118-
-D "$OUTPUT_DIR/metadata-guidelines" \
119-
-a stylesheet=../css/style.css \
120-
-a linkcss \
121-
-a toc=left \
122-
-a toclevels=3 \
123-
-a sectanchors \
124-
-a sectlinks \
125-
--backend=html5 \
126-
-o sample-metadata.html \
127-
sdrf-proteomics/metadata-guidelines/sample-metadata.adoc
128-
129-
# Check if human-sample-metadata.adoc exists and build it
130-
if [ -f "sdrf-proteomics/metadata-guidelines/human-sample-metadata.adoc" ]; then
131-
echo "Building human sample metadata guidelines..."
132-
asciidoctor \
133-
-D "$OUTPUT_DIR/metadata-guidelines" \
134-
-a stylesheet=../css/style.css \
135-
-a linkcss \
136-
-a toc=left \
137-
-a toclevels=3 \
138-
-a sectanchors \
139-
-a sectlinks \
140-
--backend=html5 \
141-
-o human-sample-metadata.html \
142-
sdrf-proteomics/metadata-guidelines/human-sample-metadata.adoc
143-
fi
118+
-D "$OUTPUT_DIR" \
119+
$ASCIIDOCTOR_OPTS \
120+
-o sample-guidelines.html \
121+
sdrf-proteomics/SAMPLE-GUIDELINES.adoc
144122

145123
# Build templates guide
146124
if [ -f "sdrf-proteomics/TEMPLATES.adoc" ]; then
147125
echo "Building templates guide..."
148126
asciidoctor \
149127
-D "$OUTPUT_DIR" \
150-
-a stylesheet=css/style.css \
151-
-a linkcss \
152-
-a toc=left \
153-
-a toclevels=3 \
154-
-a sectanchors \
155-
-a sectlinks \
156-
-a source-highlighter=highlight.js \
157-
--backend=html5 \
158-
-o TEMPLATES.html \
128+
$ASCIIDOCTOR_OPTS \
129+
-o templates.html \
159130
sdrf-proteomics/TEMPLATES.adoc
160131
fi
161132

@@ -176,25 +147,10 @@ if [ -f "sdrf-proteomics/metadata-guidelines/data-analysis-metadata.adoc" ]; the
176147
sdrf-proteomics/metadata-guidelines/data-analysis-metadata.adoc
177148
fi
178149

179-
# Build template documentation
180-
echo "Building templates..."
181-
for dir in sdrf-proteomics/templates/*/; do
182-
if [ -f "${dir}README.adoc" ]; then
183-
template_name=$(basename "$dir")
184-
echo " Building template: $template_name"
185-
asciidoctor \
186-
-D "$OUTPUT_DIR/templates" \
187-
-a stylesheet=../css/style.css \
188-
-a linkcss \
189-
-a toc=left \
190-
-a toclevels=3 \
191-
-a sectanchors \
192-
-a sectlinks \
193-
--backend=html5 \
194-
-o "${template_name}.html" \
195-
"${dir}README.adoc"
196-
fi
197-
done
150+
# Build template pages from YAML definitions
151+
echo "Building template pages from YAML..."
152+
python3 scripts/build_template_pages.py \
153+
sdrf-proteomics/sdrf-templates "$OUTPUT_DIR/templates"
198154

199155
# Copy assets
200156
echo "Copying assets..."
@@ -204,6 +160,7 @@ cp site/css/style.css "$OUTPUT_DIR/css/"
204160

205161
# Copy JavaScript
206162
cp site/js/search.js "$OUTPUT_DIR/js/"
163+
cp site/js/sdrf-builder.js "$OUTPUT_DIR/js/"
207164

208165
# Copy images
209166
cp -r sdrf-proteomics/images/* "$OUTPUT_DIR/images/" 2>/dev/null || true
@@ -215,9 +172,16 @@ cp site/index.html "$OUTPUT_DIR/"
215172
cp site/sdrf-terms.html "$OUTPUT_DIR/"
216173
cp site/quickstart.html "$OUTPUT_DIR/"
217174
cp site/sdrf-explorer.html "$OUTPUT_DIR/"
175+
cp site/sdrf-editor.html "$OUTPUT_DIR/"
218176

219-
# Copy SDRF terms TSV
220-
cp sdrf-proteomics/metadata-guidelines/sdrf-terms.tsv "$OUTPUT_DIR/"
177+
# Copy SDRF terms TSV (if present) — also create TERMS.tsv alias for AsciiDoc links
178+
cp sdrf-proteomics/metadata-guidelines/sdrf-terms.tsv "$OUTPUT_DIR/" 2>/dev/null || true
179+
cp sdrf-proteomics/TERMS.tsv "$OUTPUT_DIR/TERMS.tsv" 2>/dev/null || true
180+
181+
# Auto-generate index.html template section from YAML
182+
echo "Updating index template section..."
183+
python3 scripts/build_index_templates.py \
184+
sdrf-proteomics/sdrf-templates "$OUTPUT_DIR/index.html"
221185

222186
# Build SDRF Explorer index
223187
echo "Building SDRF Explorer index..."
@@ -236,6 +200,11 @@ python3 scripts/transform-links.py "$OUTPUT_DIR"
236200
echo "Transforming SDRF example tables..."
237201
python3 scripts/transform-sdrf-tables.py "$OUTPUT_DIR"
238202

203+
# Build SDRF builder data
204+
echo "Building SDRF builder data..."
205+
python3 scripts/build_sdrf_builder_data.py \
206+
sdrf-proteomics/sdrf-templates "$OUTPUT_DIR/sdrf-builder-data.json"
207+
239208
# Build search index
240209
echo "Building search index..."
241210
python3 site/build-search-index.py . "$OUTPUT_DIR/search-index.json"

0 commit comments

Comments
 (0)