diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index a4e07fc..2a53e2e 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -1,6 +1,5 @@ # Builds the docs and deploys them to GitHub pages. - -name: Pages +name: Build and deploy to Github Pages # Controls when the workflow will run on: @@ -18,27 +17,46 @@ permissions: pages: write id-token: write -# A workflow run is made up of one or more jobs that can run sequentially or in parallel +# Workflow run composed of build and deploy jobs jobs: + # Builds and uploads artifact for GitHib pages build: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + + # Checks out git repository - uses: actions/checkout@v4 - # Runs a single command using the runners shell - - name: Run a one-line script - run: | + # Builds tools and generates md docs under ./site + - name: Build tools and generate md docs + run: | ./tools/build.sh + # Builds static html web pages with jekyll under ./site + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + - name: Install bundler and gems for jekyll + run: | + cd site + gem install bundler + bundle install --jobs 4 --retry 3 + - name: Build static html web page with jekyll + run: | + cd site + ls Gemfile + bundle exec jekyll build + + # Creates and uploads the build artifact from ./site - uses: actions/upload-pages-artifact@v3 with: - path: site + path: site/_site + # Deploys artifact to GitHub pages deploy: needs: build runs-on: ubuntu-latest @@ -47,4 +65,4 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v5 diff --git a/.gitignore b/.gitignore index 6d4a4cd..dbf3506 100644 --- a/.gitignore +++ b/.gitignore @@ -7,8 +7,8 @@ generated/xcore/contab/netex.html templates/README.md~ tools/schematron_builder/__pycache__/template2schematron.cpython-313.pyc __pycache__ +**/__pycache__/ netex_rg_ch.egg-info dist/ -site/ build/ -netex_rg_ch_test.egg-info/ \ No newline at end of file +site/ diff --git a/docs/06_stops.md b/docs/06_stops.md index 54daa11..5d5638a 100644 --- a/docs/06_stops.md +++ b/docs/06_stops.md @@ -2,10 +2,10 @@ In this chapter: - [SiteFrame](#siteframe) -- [StopPlace](#StopPlace) -- [Quay](#Quay) -- [TopographicPlace](#TopographicPlace) -- [Centroid](#Centroid) +- [StopPlace](#stopplace) +- [Quay](#quay) +- [TopographicPlace](#topographicplace) +- [Centroid](#centroid) ## SiteFrame *→ [Glossary definition](A4_annex_glossary.md#siteframe)* @@ -13,7 +13,7 @@ In this chapter: ### Purpose A `SiteFrame` contains the physical infrastructure model for public transport — `StopPlace`s, `Quay`s, and topographic context. It defines the spatial elements that passengers interact with and that other frames reference for stop assignments. -```mermaid +```mermaid! classDiagram %% Styles classDef frame fill:#FFF8E1,stroke:#FFB300; @@ -70,7 +70,7 @@ classDiagram `SiteFrame` is independent of other frames but provides the physical stop infrastructure that `ServiceFrame` references through `PassengerStopAssignments`. `TimetableFrame` indirectly depends on `SiteFrame` through the `JourneyPattern` stop sequence. `SiteFrame` is typically wrapped in a `CompositeFrame` within a `PublicationDelivery`. ## StopPlace -*→ [Glossary definition](A4_annex_glossary.md#StopPlace)* +*→ [Glossary definition](A4_annex_glossary.md#stopplace)* ### Purpose A named physical or virtual location where passengers can board or alight from public transport, containing one or more `Quays`. diff --git a/docs/README.md b/docs/index.md similarity index 100% rename from docs/README.md rename to docs/index.md diff --git a/jekyll/.gitignore b/jekyll/.gitignore new file mode 100644 index 0000000..918de83 --- /dev/null +++ b/jekyll/.gitignore @@ -0,0 +1,6 @@ +_site +.sass-cache +.jekyll-cache +.jekyll-metadata +vendor +Gemfile.lock diff --git a/jekyll/404.html b/jekyll/404.html new file mode 100644 index 0000000..3a16ab5 --- /dev/null +++ b/jekyll/404.html @@ -0,0 +1,25 @@ +--- +permalink: /404.html +layout: page +--- + + + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
diff --git a/jekyll/Gemfile b/jekyll/Gemfile new file mode 100644 index 0000000..a779496 --- /dev/null +++ b/jekyll/Gemfile @@ -0,0 +1,35 @@ +source "https://rubygems.org" +# Hello! This is where you manage which Jekyll version is used to run. +# When you want to use a different version, change it below, save the +# file and run `bundle install`. Run Jekyll with `bundle exec`, like so: +# +# bundle exec jekyll serve +# +# This will help ensure the proper Jekyll version is running. +# Happy Jekylling! +# gem "jekyll", "~> 4.4.1" +# This is the default theme for new Jekyll sites. You may change this to anything you like. +gem "minima", "~> 2.5" +# If you want to use GitHub Pages, remove the "gem "jekyll"" above and +# uncomment the line below. To upgrade, run `bundle update github-pages`. +gem "github-pages", group: :jekyll_plugins +# If you have any plugins, put them here! +group :jekyll_plugins do +# gem "jekyll-feed", "~> 0.12" + gem 'jekyll-titles-from-headings' + # gem 'jekyll-mermaid-prebuild' +end + +# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem +# and associated library. +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" +end + +# Performance-booster for watching directories on Windows +gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin] + +# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem +# do not have a Java counterpart. +gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] diff --git a/jekyll/Gemfile.lock b/jekyll/Gemfile.lock new file mode 100644 index 0000000..b842ec1 --- /dev/null +++ b/jekyll/Gemfile.lock @@ -0,0 +1,456 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (8.1.3) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.9.0) + public_suffix (>= 2.0.2, < 8.0) + base64 (0.3.0) + bigdecimal (4.1.2) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + colorator (1.1.0) + commonmarker (0.23.12) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + csv (3.3.5) + dnsruby (1.73.1) + base64 (>= 0.2) + logger (~> 1.6) + simpleidn (~> 0.2.1) + drb (2.2.3) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.18.0) + ffi (>= 1.15.0) + logger + eventmachine (1.2.7) + execjs (2.10.1) + faraday (2.14.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.3) + net-http (~> 0.5) + ffi (1.17.4) + ffi (1.17.4-aarch64-linux-gnu) + ffi (1.17.4-aarch64-linux-musl) + ffi (1.17.4-arm-linux-gnu) + ffi (1.17.4-arm-linux-musl) + ffi (1.17.4-arm64-darwin) + ffi (1.17.4-x86-linux-gnu) + ffi (1.17.4-x86-linux-musl) + ffi (1.17.4-x86_64-darwin) + ffi (1.17.4-x86_64-linux-gnu) + ffi (1.17.4-x86_64-linux-musl) + forwardable-extended (2.6.0) + gemoji (4.1.0) + github-pages (232) + github-pages-health-check (= 1.18.2) + jekyll (= 3.10.0) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.5.1) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.16.1) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.13.0) + kramdown (= 2.4.0) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.4) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.16.2, < 2.0) + rouge (= 3.30.0) + terminal-table (~> 1.4) + webrick (~> 1.8) + github-pages-health-check (1.18.2) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) + typhoeus (~> 1.3) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.8.1) + i18n (1.14.8) + concurrent-ruby (~> 1.0) + jekyll (3.10.0) + addressable (~> 2.4) + colorator (~> 1.0) + csv (~> 3.0) + em-websocket (~> 0.5) + i18n (>= 0.7, < 2) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + webrick (>= 1.0) + jekyll-avatar (0.8.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.2.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.12) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.5.1) + commonmarker (>= 0.23.7, < 1.1.0) + jekyll (>= 3.9, < 4.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 5.0) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.16.1) + jekyll (>= 3.4, < 5.0) + octokit (>= 4, < 7, != 4.4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) + json (2.19.7) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.10.0) + logger + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + mercenary (0.3.6) + mini_portile2 (2.8.9) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) + net-http (0.9.1) + uri (>= 0.11.1) + nokogiri (1.19.3) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + nokogiri (1.19.3-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.3-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.19.3-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.3-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.19.3-arm64-darwin) + racc (~> 1.4) + nokogiri (1.19.3-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.19.3-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.19.3-x86_64-linux-musl) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + prism (1.9.0) + public_suffix (5.1.1) + racc (1.8.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rexml (3.4.4) + rouge (3.30.0) + rubyzip (2.4.1) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.9.3) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.4.1) + simpleidn (0.2.3) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + typhoeus (1.6.0) + ethon (>= 0.18.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (1.8.0) + uri (1.1.1) + webrick (1.9.2) + +PLATFORMS + aarch64-linux-android + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-androideabi + arm-linux-gnu + arm-linux-gnueabihf + arm-linux-musl + arm-linux-musleabihf + arm64-darwin + riscv64-linux-android + riscv64-linux-gnu + riscv64-linux-musl + ruby + x86-linux-gnu + x86-linux-musl + x86_64-darwin + x86_64-linux-android + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + github-pages + http_parser.rb (~> 0.6.0) + jekyll-titles-from-headings + minima (~> 2.5) + tzinfo (>= 1, < 3) + tzinfo-data + wdm (~> 0.1) + +CHECKSUMS + activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e + addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd + bundler (4.0.12) sha256=7f8b757d28dfb636e7b24fba2344ac6dd13b5b24f4b46d62573d483f211825ac + coffee-script (2.4.1) sha256=82fe281e11b93c8117b98c5ea8063e71741870f1c4fbb27177d7d6333dd38765 + coffee-script-source (1.12.2) sha256=e12b16fd8927fbbf8b87cb2e9a85a6cf457c6881cc7ff8b1af15b31f70da07a4 + colorator (1.1.0) sha256=e2f85daf57af47d740db2a32191d1bdfb0f6503a0dfbc8327d0c9154d5ddfc38 + commonmarker (0.23.12) sha256=da2d2f89c7c7b51c42c6e69ace3ab5df39497683f86e83aca7087c671d523ccd + concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab + connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a + csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f + dnsruby (1.73.1) sha256=6cf327f5fe2768deadb5e3f3e899ff1ae110aefcef43fef32e1e55e71289e992 + drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 + em-websocket (0.5.3) sha256=f56a92bde4e6cb879256d58ee31f124181f68f8887bd14d53d5d9a292758c6a8 + ethon (0.18.0) sha256=b598afc9f30448cb068b850714b7d6948e941476095d04f90a4ac65b8d6efcb2 + eventmachine (1.2.7) sha256=994016e42aa041477ba9cff45cbe50de2047f25dd418eba003e84f0d16560972 + execjs (2.10.1) sha256=abe0ae028467eb8e30c10814eb934d07876a691aae7e803d813b7ce5a75e73f1 + faraday (2.14.2) sha256=73ccb9994a9e8648f010e32eca2ae82e41c57860aa10932cda29418b9e0223ad + faraday-net_http (3.4.3) sha256=9db13becec9312f345a769eeeecf9049c9287d54c0ae053d7235228993a4eec1 + ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf + ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df + ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39 + ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564 + ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95 + ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b + ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf + ffi (1.17.4-x86-linux-musl) sha256=fbeec0fc7c795bcf86f623bb18d31ea1820f7bd580e1703a3d3740d527437809 + ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496 + ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d + ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e + forwardable-extended (2.6.0) sha256=1bec948c469bbddfadeb3bd90eb8c85f6e627a412a3e852acfd7eaedbac3ec97 + gemoji (4.1.0) sha256=734434020cbe964ea9d19086798797a47d23a170892de0ce55b74aa65d2ddc1a + github-pages (232) sha256=2b40493d7327627e4ce45c47f4a9d4394e5eaa151f9d29bb924ff424c3132287 + github-pages-health-check (1.18.2) sha256=df893d4f5a4161477e8525b993dbe1c1eb63fbb86fb07b6e80996fd37a18843d + html-pipeline (2.14.3) sha256=8a1d4d7128b2141913387cac0f8ba898bb6812557001acc0c2b46910f59413a0 + http_parser.rb (0.8.1) sha256=9ae8df145b39aa5398b2f90090d651c67bd8e2ebfe4507c966579f641e11097a + i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5 + jekyll (3.10.0) sha256=c4213b761dc7dfe7d499eb742d0476a02d8503e440c2610e19774ee7f0db8d90 + jekyll-avatar (0.8.0) sha256=ea736277c2de54a21300122096700517972a722d5c68ca83f8723b4999abfd4b + jekyll-coffeescript (1.2.2) sha256=894e71c2071a834e76eb7e8044944440a0c81c2c7092532fed1503b13d331110 + jekyll-commonmark (1.4.0) sha256=1731e658fe09ce040271e6878f83ad45bbf8d17b10ad03bf343546cca30f4844 + jekyll-commonmark-ghpages (0.5.1) sha256=d56722f23393e45625e6e1bac6d3c64bb5f5cdf6ca547338160536d61c27a4a4 + jekyll-default-layout (0.1.5) sha256=c626be4e4a5deafca123539da2cd22ff873be350cafd4da134039efdf24320af + jekyll-feed (0.17.0) sha256=689aab16c877949bb9e7a5c436de6278318a51ecb974792232fd94d8b3acfcc3 + jekyll-gist (1.5.0) sha256=495b6483552a3e2975a2752964ea7acddd545bc6e13ce2be15a50cec8d4c9f0f + jekyll-github-metadata (2.16.1) sha256=4cf29988bdaf24774a7bc07fae71e54424ddfaa2895f742d8fa3036d0db65b4c + jekyll-include-cache (0.2.1) sha256=c7d4b9e551732a27442cb2ce853ba36a2f69c66603694b8c1184c99ab1a1a205 + jekyll-mentions (1.6.0) sha256=39e801024cb6f2319b3f78a29999d0068ef5f68bc5202b8757d5354fef311ed9 + jekyll-optional-front-matter (0.3.2) sha256=ecdc061d711472469fcf04da617653b553e914c038a17df3b6a5f6f92aeb761b + jekyll-paginate (1.1.0) sha256=880aadf4b02529a93541d508c5cbb744f014cbfc071d0263a31f25ec9066eb64 + jekyll-readme-index (0.3.0) sha256=d74cc4de46b2d350229be7409495149e656a31fb5a5fe3fe6135dbf7435e1e32 + jekyll-redirect-from (0.16.0) sha256=6635cae569ef9b0f90ffb71ec014ba977177fafb44d32a2b0526288d4d9be6db + jekyll-relative-links (0.6.1) sha256=d11301f57b39e94b6c04fff2a3b145fe2f6a27be631a403e2542fa2e1548dd6d + jekyll-remote-theme (0.4.3) sha256=d3fde726484fb3df04de9e347baf75aaa3d5bfea771a330412e0c52608e54b40 + jekyll-sass-converter (1.5.2) sha256=53773669e414dc3bb070113befacb808576025a28cfa4a4accc682e90a9c1101 + jekyll-seo-tag (2.8.0) sha256=3f2ed1916d56f14ebfa38e24acde9b7c946df70cb183af2cb5f0598f21ae6818 + jekyll-sitemap (1.4.0) sha256=0de08c5debc185ea5a8f980e1025c7cd3f8e0c35c8b6ef592f15c46235cf4218 + jekyll-swiss (1.0.0) sha256=c299a855dca881fe868f21545c5489be50ddfbc0d54a80e8dbeb5a2ddc4888a3 + jekyll-theme-architect (0.2.0) sha256=7275d3dcaa6b34fcf92f2fe5cee92d49d66706d3b523003b1e67e9c668ff0440 + jekyll-theme-cayman (0.2.0) sha256=3c5f14f9c72a8eb03ecc74f9a3e5ecbbc55f9381339978b42dec216921865f2a + jekyll-theme-dinky (0.2.0) sha256=720b257091f0de3aa9394b25fd97d1b2b12cfaf00e060aff170f60e218a32c7c + jekyll-theme-hacker (0.2.0) sha256=816bf9f992ded0b1e1e69d8dece2574e8480efb5e9f84a2e1ac83bd717b8f78a + jekyll-theme-leap-day (0.2.0) sha256=921ea8305ae0285a881c9aa9dbe2375ed6f404b4f90067458e596891ef5ac7d1 + jekyll-theme-merlot (0.2.0) sha256=cbf2b21b62423561ca5b62e406dbb08f085e3a45daa7b3b4b9b3f24d08ded545 + jekyll-theme-midnight (0.2.0) sha256=009ff367350e83ff6095d98837bb411adb07b59a76f59f1d4a33ef927bb391de + jekyll-theme-minimal (0.2.0) sha256=a225210c35573ad2c9e57b81f16f678ca6c314394ec692502ccc6189d7e52d82 + jekyll-theme-modernist (0.2.0) sha256=4be775bc5edd53864c5e40c000c34db0dfd82dac800cff50371ef11da66dfbcf + jekyll-theme-primer (0.6.0) sha256=ce27282798217eb0957ba01ab3bf12996476348b625736fa8448f7a1b8a307b3 + jekyll-theme-slate (0.2.0) sha256=5e40909de712bbbefbc7a29f17c55bffa326c222f0a13ee1656229a7d43c3439 + jekyll-theme-tactile (0.2.0) sha256=b7861b48aed5b2385d7a146b13f31cb6f37afe3107f4a6b93b1c932b2d242652 + jekyll-theme-time-machine (0.2.0) sha256=bc3490a7eccfc24ca671780c9d4f531500936a361690020b19defe6105d74fe2 + jekyll-titles-from-headings (0.5.3) sha256=77366754e361ea7b5d87881f5b1380835f5ce910c240a4d9ac2d7afe86d28481 + jekyll-watch (2.2.1) sha256=bc44ed43f5e0a552836245a54dbff3ea7421ecc2856707e8a1ee203a8387a7e1 + jemoji (0.13.0) sha256=5d4c3e8e2cbbb2b73997c31294f6f70c94e4d4fade039373e86835bcf5529e7c + json (2.19.7) sha256=fe432c8639f6efff69f9d73b518a3705d9581ab93156f981ea72806e1e5bcc3e + kramdown (2.4.0) sha256=b62e5bcbd6ea20c7a6730ebbb2a107237856e14f29cebf5b10c876cc1a2481c5 + kramdown-parser-gfm (1.1.0) sha256=fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729 + liquid (4.0.4) sha256=4fcfebb1a045e47918388dbb7a0925e7c3893e58d2bd6c3b3c73ec17a2d8fdb3 + listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + mercenary (0.3.6) sha256=2a084b18f5692c86a633e185d5311ba6d11fc46c802eb414ae05368178078a82 + mini_portile2 (2.8.9) sha256=0cd7c7f824e010c072e33f68bc02d85a00aeb6fce05bb4819c03dfd3c140c289 + minima (2.5.1) sha256=520e52bc631fb16cbb8100660f6caa44f97859e2fa7e397d508deb18739567be + minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1 + net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996 + nokogiri (1.19.3) sha256=78312cbac32a40c812780d9678221b79d51288eec00054c1a8d15f7ce05960e8 + nokogiri (1.19.3-aarch64-linux-gnu) sha256=46b89e5d7b9e844c2ee360794240c6ea2a4e6fa0c5892a4ed487db621224b639 + nokogiri (1.19.3-aarch64-linux-musl) sha256=8392dfdcd21be7a94dbbe9ccc138dea01b97b24cb2dc02a114ca98bfb1d9a0b7 + nokogiri (1.19.3-arm-linux-gnu) sha256=3919d5ffc334ad778a4a9eb88fda7dcb8b1fb58c8a52ac640c6dcd2f038e774f + nokogiri (1.19.3-arm-linux-musl) sha256=9ce1cb6346bb9c67b1550eb537aa183ead91e4b6eadb2f36ade02d8dd2a79fb6 + nokogiri (1.19.3-arm64-darwin) sha256=71b9bd424b1b7abc18b05052a1a3cfd3627abdca62be280854cc411791357e42 + nokogiri (1.19.3-x86_64-darwin) sha256=77f3fba57d46c53ab31e62fc6c28f705109d1bf6264356c76f132b2be5728d4d + nokogiri (1.19.3-x86_64-linux-gnu) sha256=2f5078620fe12e83669b5b17311b32532a8153d02eee7ad06948b926d6080976 + nokogiri (1.19.3-x86_64-linux-musl) sha256=248c906d2166eca5efb56d52fdee5f9a1f51d69a72e2b64fdac647b4ce39ea3f + octokit (4.25.1) sha256=c02092ee82dcdfe84db0e0ea630a70d32becc54245a4f0bacfd21c010df09b96 + pathutil (0.16.2) sha256=e43b74365631cab4f6d5e4228f812927efc9cb2c71e62976edcb252ee948d589 + prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 + public_suffix (5.1.1) sha256=250ec74630d735194c797491c85e3c6a141d7b5d9bd0b66a3fa6268cf67066ed + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe + rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rouge (3.30.0) sha256=a3d353222aa72e49e2c86726c0bcfd719f82592f57d494474655f48e669eceb6 + rubyzip (2.4.1) sha256=8577c88edc1fde8935eb91064c5cb1aef9ad5494b940cf19c775ee833e075615 + safe_yaml (1.0.5) sha256=a6ac2d64b7eb027bdeeca1851fe7e7af0d668e133e8a88066a0c6f7087d9f848 + sass (3.7.4) sha256=808b0d39053aa69068df939e24671fe84fd5a9d3314486e1a1457d0934a4255d + sass-listen (4.0.0) sha256=ae9dcb76dd3e234329e5ba6e213f48e532c5a3e7b0b4d8a87f13aaca0cc18377 + sawyer (0.9.3) sha256=0d0f19298408047037638639fe62f4794483fb04320269169bd41af2bdcf5e41 + securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1 + simpleidn (0.2.3) sha256=08ce96f03fa1605286be22651ba0fc9c0b2d6272c9b27a260bc88be05b0d2c29 + terminal-table (1.8.0) sha256=13371f069af18e9baa4e44d404a4ada9301899ce0530c237ac1a96c19f652294 + typhoeus (1.6.0) sha256=bacc41c23e379547e29801dc235cd1699b70b955a1ba3d32b2b877aa844c331d + tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b + unicode-display_width (1.8.0) sha256=0292132d364d59fcdd83f144910c48b3c8332b28a14c5c04bb093dd165600488 + uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6 + webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 + +BUNDLED WITH + 4.0.12 diff --git a/jekyll/_config.yml b/jekyll/_config.yml new file mode 100644 index 0000000..ddc6c2b --- /dev/null +++ b/jekyll/_config.yml @@ -0,0 +1,54 @@ +# Jekyll config file +# +# For technical reasons, this file is *NOT* reloaded automatically when you use +# 'bundle exec jekyll serve'. If you change this file, please restart the server process. +# +# Site settings +# These are used to personalize your new site. If you look in the HTML files, +# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. +# You can create any custom variable you would like, and they will be accessible +# in the templates via {{ site.myvariable }}. + +title: DRAFT Swiss profile 2.0 for NeTEx 2.0 +email: info.fachbus@sbb.ch +description: >- # this means to ignore newlines until "baseurl:" + This document describes the realisation specifications for the data transfer between SKI and the public transport in + Switzerland, based on the official NeTEx standard. +baseurl: /netexRgTest # the subpath of your site, e.g. /blog +domain: opentdatach.github.io +url: https://opentdatach.github.io # the base hostname & protocol for your site, e.g. http://example.com + +# Build settings +theme: minima +plugins: + - jekyll-titles-from-headings +# - jekyll-mermaid-prebuild + +titles_from_headings: + enabled: true + strip_title: true + collections: true + +# markdown: GFM +# plugins: +# - jekyll-feed + +# Exclude from processing. +# The following items will not be processed, by default. +# Any item listed under the `exclude:` key here will be automatically added to +# the internal "default list". +# +# Excluded items can be processed by explicitly listing the directories or +# their entries' file path in the `include:` list. +# +# exclude: +# - .sass-cache/ +# - .jekyll-cache/ +# - gemfiles/ +# - Gemfile +# - Gemfile.lock +# - node_modules/ +# - vendor/bundle/ +# - vendor/cache/ +# - vendor/gems/ +# - vendor/ruby/ diff --git a/jekyll/_includes/header.html b/jekyll/_includes/header.html new file mode 100644 index 0000000..64f06fc --- /dev/null +++ b/jekyll/_includes/header.html @@ -0,0 +1,21 @@ + diff --git a/jekyll/_posts/2026-05-29-welcome-to-jekyll.markdown b/jekyll/_posts/2026-05-29-welcome-to-jekyll.markdown new file mode 100644 index 0000000..13215d5 --- /dev/null +++ b/jekyll/_posts/2026-05-29-welcome-to-jekyll.markdown @@ -0,0 +1,29 @@ +--- +layout: post +title: "Welcome to Jekyll!" +date: 2026-05-29 20:35:41 +0200 +categories: jekyll update +--- +You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. + +Jekyll requires blog post files to be named according to the following format: + +`YEAR-MONTH-DAY-title.MARKUP` + +Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is the file extension representing the format used in the file. After that, include the necessary front matter. Take a look at the source for this post to get an idea about how it works. + +Jekyll also offers powerful support for code snippets: + +{% highlight ruby %} +def print_hi(name) + puts "Hi, #{name}" +end +print_hi('Tom') +#=> prints 'Hi, Tom' to STDOUT. +{% endhighlight %} + +Check out the [Jekyll docs][jekyll-docs] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll Talk][jekyll-talk]. + +[jekyll-docs]: https://jekyllrb.com/docs/home +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll-talk]: https://talk.jekyllrb.com/ diff --git a/jekyll/_posts/2026-06-01-Welcome-NeTEx-RG-ch-2.0.md b/jekyll/_posts/2026-06-01-Welcome-NeTEx-RG-ch-2.0.md new file mode 100644 index 0000000..246b8f7 --- /dev/null +++ b/jekyll/_posts/2026-06-01-Welcome-NeTEx-RG-ch-2.0.md @@ -0,0 +1,7 @@ +--- +layout: post +title: "Welcome to first draft documentation generated with Jekyll" +date: 2026-06-01 12:00:00 +0200 +categories: NeTEx +--- +Welcome to the first draft documentation generated with Jekyll and minima theme. diff --git a/jekyll/about.markdown b/jekyll/about.markdown new file mode 100644 index 0000000..8b4e0b2 --- /dev/null +++ b/jekyll/about.markdown @@ -0,0 +1,18 @@ +--- +layout: page +title: About +permalink: /about/ +--- + +This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/) + +You can find the source code for Minima at GitHub: +[jekyll][jekyll-organization] / +[minima](https://github.com/jekyll/minima) + +You can find the source code for Jekyll at GitHub: +[jekyll][jekyll-organization] / +[jekyll](https://github.com/jekyll/jekyll) + + +[jekyll-organization]: https://github.com/jekyll diff --git a/pyproject.toml b/pyproject.toml index 14a83c4..1ee9524 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [build-system] -requires = ["setuptools>=70","markdown","pygments"] +requires = ["setuptools>=70","markdown","pygments","lxml"] build-backend = "setuptools.build_meta" [project] -name = "netex-rg-ch-test" -version = "0.1.2" -description = "Testing tools to help building the NeTEx RG." +name = "netex-rg-ch" +version = "0.1.3" +description = "Tools to build docs for NeTEx RG CH." requires-python = ">=3.13" dependencies = [ "lxml","pyschematron","pygments","build","pip","markdown" diff --git a/tools/README.md b/tools/README.md index be6e7f6..d043a87 100644 --- a/tools/README.md +++ b/tools/README.md @@ -32,19 +32,32 @@ uv sync #### Windows -Run the following following commands in the project root directory: +Create the virtual environment directory `venv` running the following command in the project root directory (needs `uv`, see [Install the uv package manager](#install-the-uv-package-manager) above): ``` shell uv venv -.venv\bin\activate.bat +``` + +It may respond like this, or similar: +``` +Using CPython 3.14.6 +Creating virtual environment at: .venv +Activate with: .venv\Scripts\activate +``` + +Run the activation script to activate the virtual environment as proposed in the output above. Then, do the sync to download +the project dependencies: + +``` shell uv sync ``` + ### Install build module > This can be skipped as the `build` module is now part of the build dependencies. Make sure you have an up-to-date version of `pip` and of module `build` used to run the build: -``` +``` shell python -m ensurepip python -m pip install --upgrade pip build ``` @@ -52,9 +65,13 @@ python -m pip install --upgrade pip build If everything is setup correctly, you should be able to the build from your project root directory: +``` shell +uv run python -m build ``` -python -m build -``` + +### Configure PyCharm with uv Python Interpreter + +In the PyCharm settings you may configure the Python interpreter with `uv` based on the `.venv` directory of the project. ## Tool Scripts @@ -118,8 +135,9 @@ The package manager `uv` simplifies the build and installation of scripts for th Components of the build automation: - [pyproject.toml](../pyproject.toml) is configured with `setuptools` (https://setuptools.pypa.io/en/latest/) - docs can be generated running `python -m build` -- `setup.py` in the root project acts as the interface for the build - - here we can add tools to be run during the build. +- `setup.py` in the root project acts as the interface for the build system + - runs `tools.toolchain` from `tools/toolchain.py` to generate the docs + - here we can add tools to be run during the build. - The build writes all output to directory `site`, excluded from git ### Github Action diff --git a/tools/configuration.py b/tools/configuration.py index 2141932..ca97766 100644 --- a/tools/configuration.py +++ b/tools/configuration.py @@ -6,8 +6,12 @@ DOCS_DIR = PROJECT_DIR.joinpath("../docs") TEMPLATES_DIR = PROJECT_DIR.joinpath("../templates") -# Generated documents -GENERATED_DIR = PROJECT_DIR.joinpath("../site") -GENERATED_DOCS_DIR = GENERATED_DIR.joinpath("docs") +JEKYLL_DIR = PROJECT_DIR.joinpath("../jekyll") XSD_FILE_PATH = PROJECT_DIR.joinpath("../xsd/xsd/NeTEx_publication.xsd") + +# Generated documents +SITE_DIR = PROJECT_DIR.joinpath("../site") +SITE_TABLES_DIR = SITE_DIR.joinpath("tables") + + diff --git a/tools/expand_docs/expand_docs.py b/tools/expand_docs/expand_docs.py index 0333390..ae0d8cf 100644 --- a/tools/expand_docs/expand_docs.py +++ b/tools/expand_docs/expand_docs.py @@ -6,7 +6,10 @@ import shutil import argparse import re -from tools.configuration import DOCS_DIR, GENERATED_DOCS_DIR +from tools.configuration import DOCS_DIR, SITE_DIR + +TABLE_MD_LINK_TARGET_PATTERN = re.compile(r'(\[.*])\((.*(\.)md).*\)') +TABLE_MD_LINK_TARGET_REPLACEMENT = r'\1(./tables/\2)' def copy_media_folder(input_folder, output_folder): """Copy media folder from input to output.""" @@ -51,6 +54,8 @@ def include_markdown_table(match, base_folder): for line in lines: if line.startswith('|') or line.startswith('---'): in_table = True + # correct md link target + line = TABLE_MD_LINK_TARGET_PATTERN.sub(TABLE_MD_LINK_TARGET_REPLACEMENT,line) table_lines.append(line) elif in_table: break @@ -94,7 +99,7 @@ def expand_docs(input_dir: str, output_dir: str): def main(): parser = argparse.ArgumentParser(description='Expand documentation by including examples and tables.') parser.add_argument('--docs', default=DOCS_DIR, help=f"Input documentation folder (default = {DOCS_DIR})") - parser.add_argument('--out', default=GENERATED_DOCS_DIR, help=f"Output folder (default = {GENERATED_DOCS_DIR})") + parser.add_argument('--out', default=SITE_DIR, help=f"Output folder (default = {SITE_DIR})") args = parser.parse_args() expand_docs(args.docs, args.out) diff --git a/tools/md2html/md2html.py b/tools/md2html/md2html.py index 5c5c78d..a40a77a 100644 --- a/tools/md2html/md2html.py +++ b/tools/md2html/md2html.py @@ -1,11 +1,10 @@ import argparse import os import re - import markdown from pygments.formatters import HtmlFormatter -from tools.configuration import GENERATED_DOCS_DIR +from tools.configuration import SITE_DIR MD_LINK_PATTERN = re.compile(r'(\[.*\])(\(.*\.)(md)(.*\))') MD_LINK_REPLACEMENT = r'\1\2html\4' @@ -66,7 +65,7 @@ def generate_html_files(src_dir: str): def main(): parser = argparse.ArgumentParser(description='Generate HTML files from Markdown files.') - parser.add_argument('--dir', default=GENERATED_DOCS_DIR, help=f"Folder to search for md files (default = {GENERATED_DOCS_DIR})") + parser.add_argument('--dir', default=SITE_DIR, help=f"Folder to search for md files (default = {SITE_DIR})") args = parser.parse_args() generate_html_files(args.dir) diff --git a/tools/md_builder/__pycache__/md_builder.cpython-313.pyc b/tools/md_builder/__pycache__/md_builder.cpython-313.pyc deleted file mode 100644 index 361d315..0000000 Binary files a/tools/md_builder/__pycache__/md_builder.cpython-313.pyc and /dev/null differ diff --git a/tools/md_builder/md_builder.py b/tools/md_builder/md_builder.py index 4aae0e5..79c7635 100644 --- a/tools/md_builder/md_builder.py +++ b/tools/md_builder/md_builder.py @@ -5,22 +5,10 @@ with type information from XSD schemas. """ -import os -import sys import argparse +import os from lxml import etree -from collections import defaultdict -import re - - -def parse_args(): - """Parse command line arguments""" - parser = argparse.ArgumentParser(description='Generate markdown documentation from NeTEx templates') - parser.add_argument('-i', '--input', required=True, help='Input folder containing XML templates') - parser.add_argument('-o', '--output', required=True, help='Output folder for markdown files') - parser.add_argument('-x', '--xsd', required=True, help='XSD schema file for type information') - return parser.parse_args() - +from tools.configuration import TEMPLATES_DIR, XSD_FILE_PATH, SITE_TABLES_DIR def load_xsd_type_info(xsd_path): """Load type and cardinality information from XSD""" @@ -529,7 +517,7 @@ def process_element(element, level=0): return None -def generate_markdown_table(data, filename, xsd_type_info): +def generate_markdown_table(data, filename, xsd_path: str, xsd_type_info): """Generate markdown table from parsed data""" if not data: return '' @@ -695,7 +683,7 @@ def check_referenced_files_exist(data, template_dir): return True -def process_ch_profile_templates(input_dir, output_dir, xsd_type_info): +def process_ch_profile_templates(input_dir: str, output_dir: str, xsd_path: str, xsd_type_info): """Process ch-profile template files and generate MD files""" ch_profile_files = [f for f in os.listdir(input_dir) if f.startswith('ch-profile_') and f.endswith('.xml')] @@ -713,7 +701,7 @@ def process_ch_profile_templates(input_dir, output_dir, xsd_type_info): # Generate markdown content element_name = os.path.splitext(xml_file)[0] - markdown_content = generate_markdown_table(data, element_name, xsd_type_info) + markdown_content = generate_markdown_table(data, element_name, xsd_path, xsd_type_info) # Write to file with open(md_path, 'w', encoding='utf-8') as f: @@ -724,44 +712,40 @@ def process_ch_profile_templates(input_dir, output_dir, xsd_type_info): print(f"No data extracted from ch-profile template {xml_file}") -def main(): - args = parse_args() - +def build_markdown_tables(input_path: str, output_path: str, xsd_path: str): + # Load XSD type information - print(f"Loading XSD from {args.xsd}") - xsd_type_info = load_xsd_type_info(args.xsd) + print(f"Loading XSD from {xsd_path}") + xsd_type_info = load_xsd_type_info(xsd_path) print(f"Loaded {len(xsd_type_info)} type definitions") - - # Store XSD path for metadata extraction - xsd_path = args.xsd - + # Create output directory - os.makedirs(args.output, exist_ok=True) + os.makedirs(output_path, exist_ok=True) # Process ch-profile templates first - process_ch_profile_templates(args.input, args.output, xsd_type_info) + process_ch_profile_templates(input_path, output_path, xsd_path, xsd_type_info) # Process all XML files in input directory - xml_files = [f for f in os.listdir(args.input) if f.endswith('.xml') and not f.startswith('ch-profile_')] + xml_files = [f for f in os.listdir(input_path) if f.endswith('.xml') and not f.startswith('ch-profile_')] for xml_file in xml_files: print(f"Processing {xml_file}") - file_path = os.path.join(args.input, xml_file) + file_path = os.path.join(input_path, xml_file) # Parse template data = parse_template_file(file_path, xsd_type_info) if data: # Check for missing referenced files - check_referenced_files_exist(data, args.input) + check_referenced_files_exist(data, input_path) # Generate markdown filename (remove .xml, add .md) md_filename = os.path.splitext(xml_file)[0] + '.md' - md_path = os.path.join(args.output, md_filename) + md_path = os.path.join(output_path, md_filename) # Generate markdown content element_name = os.path.splitext(xml_file)[0] - markdown_content = generate_markdown_table(data, element_name, xsd_type_info) + markdown_content = generate_markdown_table(data, element_name, xsd_path, xsd_type_info) # Write to file with open(md_path, 'w', encoding='utf-8') as f: @@ -773,6 +757,17 @@ def main(): print(f"Processed {len(xml_files)} files") +def parse_args(): + """Parse command line arguments""" + parser = argparse.ArgumentParser(description='Generate markdown documentation from NeTEx templates') + parser.add_argument('-i', '--input', default=TEMPLATES_DIR, help=f'Input folder containing XML templates (Default = {TEMPLATES_DIR})') + parser.add_argument('-o', '--output', default=SITE_TABLES_DIR, help=f'Output folder for markdown files (Default = {SITE_TABLES_DIR})') + parser.add_argument('-x', '--xsd', default=XSD_FILE_PATH, help=f'XSD schema file for type information (Default = {XSD_FILE_PATH})') + return parser.parse_args() + +def main(): + args = parse_args() + build_markdown_tables(args.input, args.output, args.xsd) if __name__ == '__main__': main() \ No newline at end of file diff --git a/tools/toolchain.py b/tools/toolchain.py index e3f4dc3..987b3ef 100644 --- a/tools/toolchain.py +++ b/tools/toolchain.py @@ -1,17 +1,35 @@ -import argparse +import os import shutil +from pathlib import Path -from tools.configuration import DOCS_DIR, GENERATED_DOCS_DIR +from tools.configuration import DOCS_DIR, SITE_DIR, XSD_FILE_PATH, SITE_TABLES_DIR, TEMPLATES_DIR, JEKYLL_DIR from tools.expand_docs.expand_docs import expand_docs -from tools.md2html.md2html import generate_html_files +from tools.md_builder.md_builder import build_markdown_tables +def clean(dir: str): + dir_path = Path(dir) + if dir_path.exists(): + shutil.rmtree(dir) + os.makedirs(dir, exist_ok=True) + +def copy_jekyll_files(): + src = Path(JEKYLL_DIR) + dst = Path(SITE_DIR) + shutil.copytree(src, dst, dirs_exist_ok=True) + +def generate_docs(): + expand_docs(DOCS_DIR, SITE_DIR) + # generate_html_files(SITE_DIR) + +def generate_tables(): + build_markdown_tables(TEMPLATES_DIR, SITE_TABLES_DIR, XSD_FILE_PATH) + # generate_html_files(SITE_TABLES_DIR) def main(): - parser = argparse.ArgumentParser(description='Run tools to generate documents.') - parser.add_argument('--target', default="docs", help=f"Target to generate (default: docs)") - args = parser.parse_args() - expand_docs(DOCS_DIR, GENERATED_DOCS_DIR) - generate_html_files(GENERATED_DOCS_DIR) + clean(SITE_DIR) + copy_jekyll_files() + generate_docs() + generate_tables() if __name__ == '__main__': main() diff --git a/tools/validation/xml_validator.py b/tools/validation/xml_validator.py index 0e29206..dd4b4ec 100644 --- a/tools/validation/xml_validator.py +++ b/tools/validation/xml_validator.py @@ -8,8 +8,7 @@ import os import sys from lxml import etree -#from tools.configuration import XSD_FILE_PATH -XSD_FILE_PATH ="../xsd/xsd/NeTEx_publication.xsd" +from tools.configuration import XSD_FILE_PATH def load_schema(xsd_path): try: @@ -89,7 +88,7 @@ def main(): if os.path.isdir(args.xml): validate_folder(args.xml, args.xsd) else: - schema = load_schema(xsd_path) + schema = load_schema(XSD_FILE_PATH) if not schema: exit validate_xml(args.xml, schema) diff --git a/uv.lock b/uv.lock index a938274..5bafd80 100644 --- a/uv.lock +++ b/uv.lock @@ -239,8 +239,8 @@ wheels = [ ] [[package]] -name = "netex-rg-ch-test" -version = "0.1.2" +name = "netex-rg-ch" +version = "0.1.3" source = { editable = "." } dependencies = [ { name = "build" },