Title: [292678] trunk
Revision
292678
Author
[email protected]
Date
2022-04-09 01:35:06 -0700 (Sat, 09 Apr 2022)

Log Message

[GTK][WPE] Missing inter-module documentation links
https://bugs.webkit.org/show_bug.cgi?id=239016

Reviewed by Michael Catanzaro.

Add JS snippets to be used in the gi-docgen output to setup links to
other modules. Take advantage of being able to compute the documentation
API version suffix from the currently loaded page URL, which avoids having
a number of templates depending on the API version and having to deal with
the documentation API version being sometimes different than the actual API
version of the library. The URLs for GTK3 vs. GTK4 documentation cannot be
handled in the same way, and instead the JS snippet is also a template
expanded by CMake to allows using the ${GTK_API_VERSION} variable there.

.:

* Source/cmake/FindGIDocgen.cmake: Add a new CONTENT_TEMPLATES option
to GI_DOCGEN(), which allows setting up files to be expanded as CMake
@ONLY templates and then be used as documentation content files.

Source/_javascript_Core:

* API/glib/docs/jsc.toml.in: Use added urlmap.js file.
* API/glib/docs/urlmap.js: Added.

Source/WebKit:

* PlatformGTK.cmake: Set urlmap.js as documentation content template.
* gtk/urlmap.js.in: Added.
* gtk/webkit2gtk-webextension.toml.in: Use urlmap.js from added template.
* gtk/webkit2gtk.toml.in: Ditto.
* wpe/urlmap.js: Added.
(const.baseURLApiLevelSuffix):
* wpe/wpewebextension.toml.in: Use added urlmap.js file.
* wpe/wpewebkit.toml.in: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (292677 => 292678)


--- trunk/ChangeLog	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/ChangeLog	2022-04-09 08:35:06 UTC (rev 292678)
@@ -1,3 +1,23 @@
+2022-04-09  Adrian Perez de Castro  <[email protected]>
+
+        [GTK][WPE] Missing inter-module documentation links
+        https://bugs.webkit.org/show_bug.cgi?id=239016
+
+        Reviewed by Michael Catanzaro.
+
+        Add JS snippets to be used in the gi-docgen output to setup links to
+        other modules. Take advantage of being able to compute the documentation
+        API version suffix from the currently loaded page URL, which avoids having
+        a number of templates depending on the API version and having to deal with
+        the documentation API version being sometimes different than the actual API
+        version of the library. The URLs for GTK3 vs. GTK4 documentation cannot be
+        handled in the same way, and instead the JS snippet is also a template
+        expanded by CMake to allows using the ${GTK_API_VERSION} variable there.
+
+        * Source/cmake/FindGIDocgen.cmake: Add a new CONTENT_TEMPLATES option
+        to GI_DOCGEN(), which allows setting up files to be expanded as CMake
+        @ONLY templates and then be used as documentation content files.
+
 2022-04-08  Elliott Williams  <[email protected]>
 
         Unreviewed, reverting r292591.

Modified: trunk/Source/_javascript_Core/API/glib/docs/jsc.toml.in (292677 => 292678)


--- trunk/Source/_javascript_Core/API/glib/docs/jsc.toml.in	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/_javascript_Core/API/glib/docs/jsc.toml.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -21,3 +21,6 @@
 
 [source-location]
 base_url = "https://github.com/WebKit/WebKit/tree/main"
+
+[extra]
+urlmap_file = "urlmap.js"

Added: trunk/Source/_javascript_Core/API/glib/docs/urlmap.js (0 => 292678)


--- trunk/Source/_javascript_Core/API/glib/docs/urlmap.js	                        (rev 0)
+++ trunk/Source/_javascript_Core/API/glib/docs/urlmap.js	2022-04-09 08:35:06 UTC (rev 292678)
@@ -0,0 +1,4 @@
+baseURLs = [
+  ["GLib", "https://docs.gtk.org/glib/"],
+  ["GObject", "https://docs.gtk.org/gobject/"],
+]

Modified: trunk/Source/_javascript_Core/ChangeLog (292677 => 292678)


--- trunk/Source/_javascript_Core/ChangeLog	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-04-09 08:35:06 UTC (rev 292678)
@@ -1,3 +1,22 @@
+2022-04-09  Adrian Perez de Castro  <[email protected]>
+
+        [GTK][WPE] Missing inter-module documentation links
+        https://bugs.webkit.org/show_bug.cgi?id=239016
+
+        Reviewed by Michael Catanzaro.
+
+        Add JS snippets to be used in the gi-docgen output to setup links to
+        other modules. Take advantage of being able to compute the documentation
+        API version suffix from the currently loaded page URL, which avoids having
+        a number of templates depending on the API version and having to deal with
+        the documentation API version being sometimes different than the actual API
+        version of the library. The URLs for GTK3 vs. GTK4 documentation cannot be
+        handled in the same way, and instead the JS snippet is also a template
+        expanded by CMake to allows using the ${GTK_API_VERSION} variable there.
+
+        * API/glib/docs/jsc.toml.in: Use added urlmap.js file.
+        * API/glib/docs/urlmap.js: Added.
+
 2022-04-08  Elliott Williams  <[email protected]>
 
         [Xcode] Avoid targeting 32-bit iOS and Mac architectures

Modified: trunk/Source/WebKit/ChangeLog (292677 => 292678)


--- trunk/Source/WebKit/ChangeLog	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/ChangeLog	2022-04-09 08:35:06 UTC (rev 292678)
@@ -1,3 +1,28 @@
+2022-04-09  Adrian Perez de Castro  <[email protected]>
+
+        [GTK][WPE] Missing inter-module documentation links
+        https://bugs.webkit.org/show_bug.cgi?id=239016
+
+        Reviewed by Michael Catanzaro.
+
+        Add JS snippets to be used in the gi-docgen output to setup links to
+        other modules. Take advantage of being able to compute the documentation
+        API version suffix from the currently loaded page URL, which avoids having
+        a number of templates depending on the API version and having to deal with
+        the documentation API version being sometimes different than the actual API
+        version of the library. The URLs for GTK3 vs. GTK4 documentation cannot be
+        handled in the same way, and instead the JS snippet is also a template
+        expanded by CMake to allows using the ${GTK_API_VERSION} variable there.
+
+        * PlatformGTK.cmake: Set urlmap.js as documentation content template.
+        * gtk/urlmap.js.in: Added.
+        * gtk/webkit2gtk-webextension.toml.in: Use urlmap.js from added template.
+        * gtk/webkit2gtk.toml.in: Ditto.
+        * wpe/urlmap.js: Added.
+        (const.baseURLApiLevelSuffix):
+        * wpe/wpewebextension.toml.in: Use added urlmap.js file.
+        * wpe/wpewebkit.toml.in: Ditto.
+
 2022-04-09  Sihui Liu  <[email protected]>
 
         Move canAccessStorage() check from SecurityOrigin to ScriptExecutionContext

Modified: trunk/Source/WebKit/PlatformGTK.cmake (292677 => 292678)


--- trunk/Source/WebKit/PlatformGTK.cmake	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2022-04-09 08:35:06 UTC (rev 292678)
@@ -726,7 +726,9 @@
         UIProcess/API/gtk
     NO_IMPLICIT_SOURCES
 )
-GI_DOCGEN(WebKit2 gtk/webkit2gtk.toml.in)
+GI_DOCGEN(WebKit2 gtk/webkit2gtk.toml.in
+    CONTENT_TEMPLATES gtk/urlmap.js
+)
 
 GI_INTROSPECT(WebKit2WebExtension ${WEBKITGTK_API_VERSION} webkit2/webkit-web-extension.h
     TARGET WebKit
@@ -757,4 +759,6 @@
         WebProcess/InjectedBundle/API/glib/DOM
     NO_IMPLICIT_SOURCES
 )
-GI_DOCGEN(WebKit2WebExtension gtk/webkit2gtk-webextension.toml.in)
+GI_DOCGEN(WebKit2WebExtension gtk/webkit2gtk-webextension.toml.in
+    CONTENT_TEMPLATES gtk/urlmap.js
+)

Added: trunk/Source/WebKit/gtk/urlmap.js.in (0 => 292678)


--- trunk/Source/WebKit/gtk/urlmap.js.in	                        (rev 0)
+++ trunk/Source/WebKit/gtk/urlmap.js.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -0,0 +1,15 @@
+const baseURLApiLevelSuffix = (function (uri) {
+  const slashPos = uri.lastIndexOf("/");
+  const dashPos = uri.lastIndexOf("-", slashPos);
+  return uri.substring(dashPos, slashPos + 1);
+})(window.location.href);
+baseURLs = [
+  ["GLib", "https://docs.gtk.org/glib/"],
+  ["GObject", "https://docs.gtk.org/gobject/"],
+  ["Gio", "https://docs.gtk.org/gio/"],
+  ["Gdk", "https://docs.gtk.org/gdk@GTK_API_VERSION@/"],
+  ["Gtk", "https://docs.gtk.org/gtk@GTK_API_VERSION@/"],
+  ["_javascript_Core", "../_javascript_coregtk" + baseURLApiLevelSuffix],
+  ["WebKit2", "../webkit2gtk" + baseURLApiLevelSuffix],
+  ["WebKit2WebExtension", "../webkit2gtk-web-extension" + baseURLApiLevelSuffix],
+]

Modified: trunk/Source/WebKit/gtk/webkit2gtk-webextension.toml.in (292677 => 292678)


--- trunk/Source/WebKit/gtk/webkit2gtk-webextension.toml.in	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/gtk/webkit2gtk-webextension.toml.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -31,3 +31,6 @@
 
 [source-location]
 base_url = "https://github.com/WebKit/WebKit/tree/main"
+
+[extra]
+urlmap_file = "urlmap.js"

Modified: trunk/Source/WebKit/gtk/webkit2gtk.toml.in (292677 => 292678)


--- trunk/Source/WebKit/gtk/webkit2gtk.toml.in	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/gtk/webkit2gtk.toml.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -36,3 +36,6 @@
 
 [source-location]
 base_url = "https://github.com/WebKit/WebKit/tree/main"
+
+[extra]
+urlmap_file = "urlmap.js"

Added: trunk/Source/WebKit/wpe/urlmap.js (0 => 292678)


--- trunk/Source/WebKit/wpe/urlmap.js	                        (rev 0)
+++ trunk/Source/WebKit/wpe/urlmap.js	2022-04-09 08:35:06 UTC (rev 292678)
@@ -0,0 +1,13 @@
+const baseURLApiLevelSuffix = (function (uri) {
+  const slashPos = uri.lastIndexOf("/");
+  const dashPos = uri.lastIndexOf("-", slashPos);
+  return uri.substring(dashPos, slashPos + 1);
+})(window.location.href);
+baseURLs = [
+  ["GLib", "https://docs.gtk.org/glib/"],
+  ["GObject", "https://docs.gtk.org/gobject/"],
+  ["Gio", "https://docs.gtk.org/gio/"],
+  ["WPEJavaScriptCore", "../wpe-_javascript_core" + baseURLApiLevelSuffix],
+  ["WPEWebExtension", "../wpe-web-extension" + baseURLApiLevelSuffix],
+  ["WPEWebKit", "../wpe-webkit" + baseURLApiLevelSuffix],
+]

Modified: trunk/Source/WebKit/wpe/wpewebextension.toml.in (292677 => 292678)


--- trunk/Source/WebKit/wpe/wpewebextension.toml.in	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/wpe/wpewebextension.toml.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -31,3 +31,6 @@
 
 [source-location]
 base_url = "https://github.com/WebKit/WebKit/tree/main"
+
+[extra]
+urlmap_file = "urlmap.js"

Modified: trunk/Source/WebKit/wpe/wpewebkit.toml.in (292677 => 292678)


--- trunk/Source/WebKit/wpe/wpewebkit.toml.in	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/WebKit/wpe/wpewebkit.toml.in	2022-04-09 08:35:06 UTC (rev 292678)
@@ -31,3 +31,6 @@
 
 [source-location]
 base_url = "https://github.com/WebKit/WebKit/tree/main"
+
+[extra]
+urlmap_file = "urlmap.js"

Modified: trunk/Source/cmake/FindGIDocgen.cmake (292677 => 292678)


--- trunk/Source/cmake/FindGIDocgen.cmake	2022-04-09 08:28:32 UTC (rev 292677)
+++ trunk/Source/cmake/FindGIDocgen.cmake	2022-04-09 08:35:06 UTC (rev 292678)
@@ -123,7 +123,8 @@
 
   .. code-block:: cmake
 
-    GI_DOCGEN(<namespace> <toml-file>)
+    GI_DOCGEN(<namespace> <toml-file>
+              [CONTENT_TEMPLATES <file...>])
 
    Configures generating documentation for a GObject-Introspection
    ``<namespace>``, which needs to have been previously configured using
@@ -136,6 +137,11 @@
 
    __ https://gnome.pages.gitlab.gnome.org/gi-docgen/project-configuration.html
 
+   ``CONTENT_TEMPLATES`` can be used to list files, for each of them a
+   template with the ``.in`` suffix will be expanded using the
+   command:`configure_file` in ``@ONLY`` mode. The ``.in`` sufix must
+   not be present.
+
    Documentation is generated in the ``Documentation/<pkgname>-<nsversion>/``
    subdirectory by the ``doc-<namespace>`` target added by the command.
    Additionally, a ``doc-check-<namespace>`` target is created as well,
@@ -147,6 +153,11 @@
 
 #]=======================================================================]
 function(GI_DOCGEN namespace toml)
+    cmake_parse_arguments(PARSE_ARGV 1 opt
+        ""
+        ""
+        "CONTENT_TEMPLATES"
+    )
     if (NOT TARGET "gir-${namespace}")
         message(FATAL_ERROR
             "Introspection not configured for '${namespace}'. "
@@ -154,8 +165,10 @@
         )
     endif ()
 
+    set(contentdir "${CMAKE_BINARY_DIR}/GIDocgenGenerated/${namespace}")
+
     get_property(gir_path TARGET "gir-${namespace}" PROPERTY GI_GIR_PATH)
-    set(toml_path "${CMAKE_BINARY_DIR}/${namespace}.toml")
+    set(toml_path "${contentdir}.toml")
     configure_file("${toml}" "${toml_path}" @ONLY)
 
     get_filename_component(toml_dir "${toml}" DIRECTORY)
@@ -167,6 +180,13 @@
     endif ()
     set(outdir "${CMAKE_BINARY_DIR}/Documentation/${package}")
 
+    set(docdeps "${toml_path};${gir_path}")
+    foreach (item IN LISTS opt_CONTENT_TEMPLATES)
+        get_filename_component(filename "${item}" NAME)
+        configure_file("${item}.in" "${contentdir}/${filename}" @ONLY)
+        list(APPEND docdeps "${contentdir}/${filename}")
+    endforeach ()
+
     set(common_flags)
     list(APPEND common_flags
         --quiet
@@ -179,11 +199,12 @@
         OUTPUT "${outdir}/index.html"
         COMMENT "Generating documentation: ${namespace}"
         WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
-        DEPENDS "${toml_path}" "${gir_path}"
+        DEPENDS ${docdeps}
         VERBATIM
         COMMAND "${GIDocgen_EXE}" generate
             ${common_flags}
             --no-namespace-dir
+            --content-dir "${contentdir}"
             --content-dir "${toml_dir}"
             --output-dir "${outdir}"
             --config "${toml_path}"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to