[devdocsgjs/wip/andyholmes/gjs-scraper] feat(gjs-scraper): implement crude cross-link support




commit 5e51a79b3de91805ca0a789613b7b562ee61f666
Author: Andy Holmes <andrew g r holmes gmail com>
Date:   Mon Sep 12 18:04:59 2022 -0700

    feat(gjs-scraper): implement crude cross-link support
    
    Enabled limited cross-linking from GJS docs by replacing the known host
    with a relative path (i.e. `../`).

 lib/docs/scrapers/gnome/gjs_scraper.rb | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/lib/docs/scrapers/gnome/gjs_scraper.rb b/lib/docs/scrapers/gnome/gjs_scraper.rb
index 4be5b590..c0967219 100644
--- a/lib/docs/scrapers/gnome/gjs_scraper.rb
+++ b/lib/docs/scrapers/gnome/gjs_scraper.rb
@@ -30,6 +30,9 @@ module Docs
     options[:title] = 'GJS'
     options[:skip_links] = true
 
+    # Transform absolute URIs into relative URIs
+    options[:fix_urls] = ->(url) { url.gsub!(/^https:\/\/gjs-docs.gnome.org/, '..') }
+
     options[:attribution] = <<-HTML
       &copy; 2022 GJS Contributors<br>
       Licensed under the MIT License.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]