From f1dd2acc0851267b280504d971d8bd37e97681f1 Mon Sep 17 00:00:00 2001 From: Thomas Dy Date: Sun, 24 Apr 2022 18:28:13 +0900 Subject: [PATCH 1/3] Add nix and nixpkgs This only adds a subset of nix and nixpkgs functions. Notably derivation, stdenv and language-specific functions are omitted for now as their formats differ significantly and will require more cleanup. --- .../templates/pages/about_tmpl.coffee | 5 + lib/docs/filters/nix/clean_html.rb | 113 ++++++++++++++++++ lib/docs/filters/nix/entries.rb | 22 ++++ lib/docs/scrapers/nix.rb | 31 +++++ public/icons/docs/nix/16.png | Bin 0 -> 1220 bytes public/icons/docs/nix/16@2x.png | Bin 0 -> 1936 bytes public/icons/docs/nix/SOURCE | 1 + 7 files changed, 172 insertions(+) create mode 100644 lib/docs/filters/nix/clean_html.rb create mode 100644 lib/docs/filters/nix/entries.rb create mode 100644 lib/docs/scrapers/nix.rb create mode 100644 public/icons/docs/nix/16.png create mode 100644 public/icons/docs/nix/16@2x.png create mode 100644 public/icons/docs/nix/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index a366449a..6fdba573 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -587,6 +587,11 @@ credits = [ '2006-2021 Andreas Rumpf', 'MIT', 'https://github.com/nim-lang/Nim#license' + ], [ + 'Nix', + '2022 NixOS Contributors', + 'LGPLv2.1', + 'https://github.com/NixOS/nix#license' ], [ 'Node.js', 'Joyent, Inc. and other Node contributors
Node.js is a trademark of Joyent, Inc.', diff --git a/lib/docs/filters/nix/clean_html.rb b/lib/docs/filters/nix/clean_html.rb new file mode 100644 index 00000000..731fc0cf --- /dev/null +++ b/lib/docs/filters/nix/clean_html.rb @@ -0,0 +1,113 @@ +module Docs + class Nix + class CleanHtmlFilter < Filter + def call + if subpath == 'nixpkgs/stable/index.html' + new_root = Nokogiri::XML::Node.new 'div', doc.document + + # lib functions + lib_sections = xpath("//*[@id='sec-functions-library']/ancestor::section[1]/section/section") + lib_sections.css('.titlepage .title').each do |title| + title.name = 'h2' + strip_section_number(title.children) + title['id'] = title.content.gsub(/[^a-zA-Z0-9]/, '-') + end + lib_sections.css('.example .title strong').each do |title| + title.content = title.content.sub(/^Example ([0-9.]+)/, 'Example: ') + end + new_root.add_child(lib_sections) + + # fetchers + fetcher_sections = xpath("//*[@id='chap-pkgs-fetchers']/ancestor::section[1]/section[position()>1]") + fetcher_sections.css('.titlepage .title').each do |title| + strip_section_number(title.children) + prefix_with(title, 'pkgs') if title.name == 'h2' + end + new_root.add_child(fetcher_sections) + + # trivial builders + trivial_sections = xpath("//*[@id='chap-trivial-builders']/ancestor::section[1]/section") + trivial_sections.css('.titlepage .title').each do |title| + strip_section_number(title.children) + prefix_with(title, 'pkgs') if title.name == 'h2' + end + new_root.add_child(trivial_sections) + + # special builders + special_sections = xpath("//*[@id='chap-special']/ancestor::section[1]/section") + special_sections.css('.titlepage .title').each do |title| + strip_section_number(title.children) + if title.name == 'h2' + title.children[0].wrap('') + prefix_with(title, 'pkgs') + end + end + new_root.add_child(special_sections) + + # image builders + image_sections = xpath("//*[@id='chap-images']/ancestor::section[1]/section") + image_sections.css('.titlepage .title').each do |title| + strip_section_number(title.children) + title.children[0].wrap('') + end + image_sections.each do |section| + prefix = section.at_xpath('*[@class="titlepage"]//*[@class="title"]').content + next unless ["pkgs.dockerTools", "pkgs.ociTools"].include?(prefix) + section.xpath('section/*[@class="titlepage"]//*[@class="title"]').each do |title| + prefix_with(title, prefix) + title['data-add-to-index'] = '' + end + end + new_root.add_child(image_sections) + + new_root + elsif subpath == 'nix/stable/expressions/builtins.html' + @doc = doc.at_css('main dl') + + # strip out the first entry, `derivation`, the actual documentation + # exists in a separate page + derivation_dt = doc.children.at_css('dt') + if derivation_dt.content.starts_with?('derivation') + derivation_dt.remove + doc.children.at_css('dd').remove + else + raise RuntimeError.new('First entry is not derivation, update the scraper') + end + + doc.css('dt').each do |title| + title.name = 'h2' + unwrap(title.at_css('a')) + title.children[0].children.before('builtins.') + end + doc.css('dd').each do |description| + description.name = 'div' + end + + doc + else + doc + end + end + + def strip_section_number(title_children) + while title_children.first.content == '' + title_children.shift.remove + end + first_text = title_children.first + return unless first_text.text? + first_text.content = first_text.content.sub(/[0-9.]+ ?/, '') + first_text.remove if first_text.blank? + end + + def prefix_with(title_node, text) + title_node.css('code').each do |code| + code.content = "#{text}.#{code.content}" unless code.content.starts_with?("#{text}.") + end + end + + def unwrap(node) + node.replace(node.inner_html) + end + end + end +end diff --git a/lib/docs/filters/nix/entries.rb b/lib/docs/filters/nix/entries.rb new file mode 100644 index 00000000..f4ff093a --- /dev/null +++ b/lib/docs/filters/nix/entries.rb @@ -0,0 +1,22 @@ +module Docs + class Nix + class EntriesFilter < Docs::EntriesFilter + def include_default_entry? + false + end + + def additional_entries + css('h2, h3[data-add-to-index]').flat_map do |node| + node.css('code').map do |code| + title = code.content + index = title.rindex('.') + type = title[0...index] + name = title.match(/^[^\s]+/)[0] + + [name, node['id'], type] + end + end + end + end + end +end diff --git a/lib/docs/scrapers/nix.rb b/lib/docs/scrapers/nix.rb new file mode 100644 index 00000000..ae549818 --- /dev/null +++ b/lib/docs/scrapers/nix.rb @@ -0,0 +1,31 @@ +module Docs + class Nix < UrlScraper + self.type = 'simple' + self.release = '2.8.0' + self.base_url = 'https://nixos.org/manual/' + self.root_path = 'nix/stable/expressions/builtins.html' + self.initial_paths = %w( + nix/stable/expressions/builtins.html + nixpkgs/stable/index.html) + self.links = { + home: 'https://nixos.org/', + code: 'https://github.com/NixOS/nix' + } + + html_filters.push 'nix/clean_html', 'nix/entries' + + options[:skip_links] = true + + options[:attribution] = <<-HTML + © 2022 NixOS Contributors
+ Licensed under the LGPL License. + HTML + + def get_latest_version(opts) + doc = fetch_doc('https://nixos.org/manual/nix/stable/', opts) + json = JSON.parse(doc.at_css('body')['data-nix-channels']) + channel = json.find { |c| c['channel'] == 'stable' } + channel['version'] + end + end +end diff --git a/public/icons/docs/nix/16.png b/public/icons/docs/nix/16.png new file mode 100644 index 0000000000000000000000000000000000000000..13ad550b0a98bde25c53fe022ff7a4aa712d971a GIT binary patch literal 1220 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 WZ*pgw?mQX*0000 Date: Sun, 24 Apr 2022 20:16:24 +0900 Subject: [PATCH 2/3] Add nix syntax highlighting --- assets/javascripts/vendor/prism.js | 230 +++++++++++++++++++---------- lib/docs/filters/nix/clean_html.rb | 8 + 2 files changed, 164 insertions(+), 74 deletions(-) diff --git a/assets/javascripts/vendor/prism.js b/assets/javascripts/vendor/prism.js index 33d7acf3..f2fae517 100644 --- a/assets/javascripts/vendor/prism.js +++ b/assets/javascripts/vendor/prism.js @@ -1,5 +1,5 @@ -/* PrismJS 1.27.0 -https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+cmake+coffeescript+crystal+d+dart+diff+django+elixir+erlang+go+groovy+java+json+julia+kotlin+latex+lua+markup-templating+matlab+nginx+nim+ocaml+perl+php+python+qml+r+jsx+ruby+rust+scss+scala+shell-session+sql+typescript+yaml+zig */ +/* PrismJS 1.28.0 +https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+bash+c+cpp+cmake+coffeescript+crystal+d+dart+diff+django+elixir+erlang+go+groovy+java+json+julia+kotlin+latex+lua+markup-templating+matlab+nginx+nim+nix+ocaml+perl+php+python+qml+r+jsx+ruby+rust+scss+scala+shell-session+sql+typescript+yaml+zig */ /// var _self = (typeof window !== 'undefined') @@ -1455,7 +1455,7 @@ Prism.languages.rss = Prism.languages.xml; Prism.languages.css = { 'comment': /\/\*[\s\S]*?\*\//, 'atrule': { - pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/, + pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source), inside: { 'rule': /^@[\w-]+/, 'selector-function-argument': { @@ -1600,8 +1600,24 @@ Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|imple Prism.languages.insertBefore('javascript', 'keyword', { 'regex': { - // eslint-disable-next-line regexp/no-dupe-characters-character-class - pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/, + pattern: RegExp( + // lookbehind + // eslint-disable-next-line regexp/no-dupe-characters-character-class + /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source + + // Regex pattern: + // There are 2 regex patterns here. The RegExp set notation proposal added support for nested character + // classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible + // with the only syntax, so we have to define 2 different regex patterns. + /\//.source + + '(?:' + + /(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source + + '|' + + // `v` flag syntax. This supports 3 levels of nested character classes. + /(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + + ')' + + // lookahead + /(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source + ), lookbehind: true, greedy: true, inside: { @@ -2126,8 +2142,8 @@ Prism.languages.cmake = { } } }, - 'variable': /\b(?:CMAKE_\w+|\w+_(?:(?:BINARY|SOURCE)_DIR|DESCRIPTION|HOMEPAGE_URL|ROOT|VERSION(?:_MAJOR|_MINOR|_PATCH|_TWEAK)?)|(?:ANDROID|APPLE|BORLAND|BUILD_SHARED_LIBS|CACHE|CPACK_(?:ABSOLUTE_DESTINATION_FILES|COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY|ERROR_ON_ABSOLUTE_INSTALL_DESTINATION|INCLUDE_TOPLEVEL_DIRECTORY|INSTALL_DEFAULT_DIRECTORY_PERMISSIONS|INSTALL_SCRIPT|PACKAGING_INSTALL_PREFIX|SET_DESTDIR|WARN_ON_ABSOLUTE_INSTALL_DESTINATION)|CTEST_(?:BINARY_DIRECTORY|BUILD_COMMAND|BUILD_NAME|BZR_COMMAND|BZR_UPDATE_OPTIONS|CHANGE_ID|CHECKOUT_COMMAND|CONFIGURATION_TYPE|CONFIGURE_COMMAND|COVERAGE_COMMAND|COVERAGE_EXTRA_FLAGS|CURL_OPTIONS|CUSTOM_(?:COVERAGE_EXCLUDE|ERROR_EXCEPTION|ERROR_MATCH|ERROR_POST_CONTEXT|ERROR_PRE_CONTEXT|MAXIMUM_FAILED_TEST_OUTPUT_SIZE|MAXIMUM_NUMBER_OF_(?:ERRORS|WARNINGS)|MAXIMUM_PASSED_TEST_OUTPUT_SIZE|MEMCHECK_IGNORE|POST_MEMCHECK|POST_TEST|PRE_MEMCHECK|PRE_TEST|TESTS_IGNORE|WARNING_EXCEPTION|WARNING_MATCH)|CVS_CHECKOUT|CVS_COMMAND|CVS_UPDATE_OPTIONS|DROP_LOCATION|DROP_METHOD|DROP_SITE|DROP_SITE_CDASH|DROP_SITE_PASSWORD|DROP_SITE_USER|EXTRA_COVERAGE_GLOB|GIT_COMMAND|GIT_INIT_SUBMODULES|GIT_UPDATE_CUSTOM|GIT_UPDATE_OPTIONS|HG_COMMAND|HG_UPDATE_OPTIONS|LABELS_FOR_SUBPROJECTS|MEMORYCHECK_(?:COMMAND|COMMAND_OPTIONS|SANITIZER_OPTIONS|SUPPRESSIONS_FILE|TYPE)|NIGHTLY_START_TIME|P4_CLIENT|P4_COMMAND|P4_OPTIONS|P4_UPDATE_OPTIONS|RUN_CURRENT_SCRIPT|SCP_COMMAND|SITE|SOURCE_DIRECTORY|SUBMIT_URL|SVN_COMMAND|SVN_OPTIONS|SVN_UPDATE_OPTIONS|TEST_LOAD|TEST_TIMEOUT|TRIGGER_SITE|UPDATE_COMMAND|UPDATE_OPTIONS|UPDATE_VERSION_ONLY|USE_LAUNCHERS)|CYGWIN|ENV|EXECUTABLE_OUTPUT_PATH|GHS-MULTI|IOS|LIBRARY_OUTPUT_PATH|MINGW|MSVC(?:10|11|12|14|60|70|71|80|90|_IDE|_TOOLSET_VERSION|_VERSION)?|MSYS|PROJECT_(?:BINARY_DIR|DESCRIPTION|HOMEPAGE_URL|NAME|SOURCE_DIR|VERSION|VERSION_(?:MAJOR|MINOR|PATCH|TWEAK))|UNIX|WIN32|WINCE|WINDOWS_PHONE|WINDOWS_STORE|XCODE|XCODE_VERSION))\b/, - 'property': /\b(?:cxx_\w+|(?:ARCHIVE_OUTPUT_(?:DIRECTORY|NAME)|COMPILE_DEFINITIONS|COMPILE_PDB_NAME|COMPILE_PDB_OUTPUT_DIRECTORY|EXCLUDE_FROM_DEFAULT_BUILD|IMPORTED_(?:IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_LANGUAGES|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|NO_SONAME|OBJECTS|SONAME)|INTERPROCEDURAL_OPTIMIZATION|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINK_FLAGS|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|MAP_IMPORTED_CONFIG|OSX_ARCHITECTURES|OUTPUT_NAME|PDB_NAME|PDB_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|STATIC_LIBRARY_FLAGS|VS_CSHARP|VS_DOTNET_REFERENCEPROP|VS_DOTNET_REFERENCE|VS_GLOBAL_SECTION_POST|VS_GLOBAL_SECTION_PRE|VS_GLOBAL|XCODE_ATTRIBUTE)_\w+|\w+_(?:CLANG_TIDY|COMPILER_LAUNCHER|CPPCHECK|CPPLINT|INCLUDE_WHAT_YOU_USE|OUTPUT_NAME|POSTFIX|VISIBILITY_PRESET)|ABSTRACT|ADDITIONAL_MAKE_CLEAN_FILES|ADVANCED|ALIASED_TARGET|ALLOW_DUPLICATE_CUSTOM_TARGETS|ANDROID_(?:ANT_ADDITIONAL_OPTIONS|API|API_MIN|ARCH|ASSETS_DIRECTORIES|GUI|JAR_DEPENDENCIES|NATIVE_LIB_DEPENDENCIES|NATIVE_LIB_DIRECTORIES|PROCESS_MAX|PROGUARD|PROGUARD_CONFIG_PATH|SECURE_PROPS_PATH|SKIP_ANT_STEP|STL_TYPE)|ARCHIVE_OUTPUT_DIRECTORY|ATTACHED_FILES|ATTACHED_FILES_ON_FAIL|AUTOGEN_(?:BUILD_DIR|ORIGIN_DEPENDS|PARALLEL|SOURCE_GROUP|TARGETS_FOLDER|TARGET_DEPENDS)|AUTOMOC|AUTOMOC_(?:COMPILER_PREDEFINES|DEPEND_FILTERS|EXECUTABLE|MACRO_NAMES|MOC_OPTIONS|SOURCE_GROUP|TARGETS_FOLDER)|AUTORCC|AUTORCC_EXECUTABLE|AUTORCC_OPTIONS|AUTORCC_SOURCE_GROUP|AUTOUIC|AUTOUIC_EXECUTABLE|AUTOUIC_OPTIONS|AUTOUIC_SEARCH_PATHS|BINARY_DIR|BUILDSYSTEM_TARGETS|BUILD_RPATH|BUILD_RPATH_USE_ORIGIN|BUILD_WITH_INSTALL_NAME_DIR|BUILD_WITH_INSTALL_RPATH|BUNDLE|BUNDLE_EXTENSION|CACHE_VARIABLES|CLEAN_NO_CUSTOM|COMMON_LANGUAGE_RUNTIME|COMPATIBLE_INTERFACE_(?:BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|COMPILE_(?:DEFINITIONS|FEATURES|FLAGS|OPTIONS|PDB_NAME|PDB_OUTPUT_DIRECTORY)|COST|CPACK_DESKTOP_SHORTCUTS|CPACK_NEVER_OVERWRITE|CPACK_PERMANENT|CPACK_STARTUP_SHORTCUTS|CPACK_START_MENU_SHORTCUTS|CPACK_WIX_ACL|CROSSCOMPILING_EMULATOR|CUDA_EXTENSIONS|CUDA_PTX_COMPILATION|CUDA_RESOLVE_DEVICE_SYMBOLS|CUDA_SEPARABLE_COMPILATION|CUDA_STANDARD|CUDA_STANDARD_REQUIRED|CXX_EXTENSIONS|CXX_STANDARD|CXX_STANDARD_REQUIRED|C_EXTENSIONS|C_STANDARD|C_STANDARD_REQUIRED|DEBUG_CONFIGURATIONS|DEFINE_SYMBOL|DEFINITIONS|DEPENDS|DEPLOYMENT_ADDITIONAL_FILES|DEPLOYMENT_REMOTE_DIRECTORY|DISABLED|DISABLED_FEATURES|ECLIPSE_EXTRA_CPROJECT_CONTENTS|ECLIPSE_EXTRA_NATURES|ENABLED_FEATURES|ENABLED_LANGUAGES|ENABLE_EXPORTS|ENVIRONMENT|EXCLUDE_FROM_ALL|EXCLUDE_FROM_DEFAULT_BUILD|EXPORT_NAME|EXPORT_PROPERTIES|EXTERNAL_OBJECT|EchoString|FAIL_REGULAR_EXPRESSION|FIND_LIBRARY_USE_LIB32_PATHS|FIND_LIBRARY_USE_LIB64_PATHS|FIND_LIBRARY_USE_LIBX32_PATHS|FIND_LIBRARY_USE_OPENBSD_VERSIONING|FIXTURES_CLEANUP|FIXTURES_REQUIRED|FIXTURES_SETUP|FOLDER|FRAMEWORK|Fortran_FORMAT|Fortran_MODULE_DIRECTORY|GENERATED|GENERATOR_FILE_NAME|GENERATOR_IS_MULTI_CONFIG|GHS_INTEGRITY_APP|GHS_NO_SOURCE_GROUP_FILE|GLOBAL_DEPENDS_DEBUG_MODE|GLOBAL_DEPENDS_NO_CYCLES|GNUtoMS|HAS_CXX|HEADER_FILE_ONLY|HELPSTRING|IMPLICIT_DEPENDS_INCLUDE_TRANSFORM|IMPORTED|IMPORTED_(?:COMMON_LANGUAGE_RUNTIME|CONFIGURATIONS|GLOBAL|IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_(?:LANGUAGES|LIBRARIES|MULTIPLICITY)|LOCATION|NO_SONAME|OBJECTS|SONAME)|IMPORT_PREFIX|IMPORT_SUFFIX|INCLUDE_DIRECTORIES|INCLUDE_REGULAR_EXPRESSION|INSTALL_NAME_DIR|INSTALL_RPATH|INSTALL_RPATH_USE_LINK_PATH|INTERFACE_(?:AUTOUIC_OPTIONS|COMPILE_DEFINITIONS|COMPILE_FEATURES|COMPILE_OPTIONS|INCLUDE_DIRECTORIES|LINK_DEPENDS|LINK_DIRECTORIES|LINK_LIBRARIES|LINK_OPTIONS|POSITION_INDEPENDENT_CODE|SOURCES|SYSTEM_INCLUDE_DIRECTORIES)|INTERPROCEDURAL_OPTIMIZATION|IN_TRY_COMPILE|IOS_INSTALL_COMBINED|JOB_POOLS|JOB_POOL_COMPILE|JOB_POOL_LINK|KEEP_EXTENSION|LABELS|LANGUAGE|LIBRARY_OUTPUT_DIRECTORY|LINKER_LANGUAGE|LINK_(?:DEPENDS|DEPENDS_NO_SHARED|DIRECTORIES|FLAGS|INTERFACE_LIBRARIES|INTERFACE_MULTIPLICITY|LIBRARIES|OPTIONS|SEARCH_END_STATIC|SEARCH_START_STATIC|WHAT_YOU_USE)|LISTFILE_STACK|LOCATION|MACOSX_BUNDLE|MACOSX_BUNDLE_INFO_PLIST|MACOSX_FRAMEWORK_INFO_PLIST|MACOSX_PACKAGE_LOCATION|MACOSX_RPATH|MACROS|MANUALLY_ADDED_DEPENDENCIES|MEASUREMENT|MODIFIED|NAME|NO_SONAME|NO_SYSTEM_FROM_IMPORTED|OBJECT_DEPENDS|OBJECT_OUTPUTS|OSX_ARCHITECTURES|OUTPUT_NAME|PACKAGES_FOUND|PACKAGES_NOT_FOUND|PARENT_DIRECTORY|PASS_REGULAR_EXPRESSION|PDB_NAME|PDB_OUTPUT_DIRECTORY|POSITION_INDEPENDENT_CODE|POST_INSTALL_SCRIPT|PREDEFINED_TARGETS_FOLDER|PREFIX|PRE_INSTALL_SCRIPT|PRIVATE_HEADER|PROCESSORS|PROCESSOR_AFFINITY|PROJECT_LABEL|PUBLIC_HEADER|REPORT_UNDEFINED_PROPERTIES|REQUIRED_FILES|RESOURCE|RESOURCE_LOCK|RULE_LAUNCH_COMPILE|RULE_LAUNCH_CUSTOM|RULE_LAUNCH_LINK|RULE_MESSAGES|RUNTIME_OUTPUT_DIRECTORY|RUN_SERIAL|SKIP_AUTOGEN|SKIP_AUTOMOC|SKIP_AUTORCC|SKIP_AUTOUIC|SKIP_BUILD_RPATH|SKIP_RETURN_CODE|SOURCES|SOURCE_DIR|SOVERSION|STATIC_LIBRARY_FLAGS|STATIC_LIBRARY_OPTIONS|STRINGS|SUBDIRECTORIES|SUFFIX|SYMBOLIC|TARGET_ARCHIVES_MAY_BE_SHARED_LIBS|TARGET_MESSAGES|TARGET_SUPPORTS_SHARED_LIBS|TESTS|TEST_INCLUDE_FILE|TEST_INCLUDE_FILES|TIMEOUT|TIMEOUT_AFTER_MATCH|TYPE|USE_FOLDERS|VALUE|VARIABLES|VERSION|VISIBILITY_INLINES_HIDDEN|VS_(?:CONFIGURATION_TYPE|COPY_TO_OUT_DIR|DEBUGGER_(?:COMMAND|COMMAND_ARGUMENTS|ENVIRONMENT|WORKING_DIRECTORY)|DEPLOYMENT_CONTENT|DEPLOYMENT_LOCATION|DOTNET_REFERENCES|DOTNET_REFERENCES_COPY_LOCAL|GLOBAL_KEYWORD|GLOBAL_PROJECT_TYPES|GLOBAL_ROOTNAMESPACE|INCLUDE_IN_VSIX|IOT_STARTUP_TASK|KEYWORD|RESOURCE_GENERATOR|SCC_AUXPATH|SCC_LOCALPATH|SCC_PROJECTNAME|SCC_PROVIDER|SDK_REFERENCES|SHADER_(?:DISABLE_OPTIMIZATIONS|ENABLE_DEBUG|ENTRYPOINT|FLAGS|MODEL|OBJECT_FILE_NAME|OUTPUT_HEADER_FILE|TYPE|VARIABLE_NAME)|STARTUP_PROJECT|TOOL_OVERRIDE|USER_PROPS|WINRT_COMPONENT|WINRT_EXTENSIONS|WINRT_REFERENCES|XAML_TYPE)|WILL_FAIL|WIN32_EXECUTABLE|WINDOWS_EXPORT_ALL_SYMBOLS|WORKING_DIRECTORY|WRAP_EXCLUDE|XCODE_(?:EMIT_EFFECTIVE_PLATFORM_NAME|EXPLICIT_FILE_TYPE|FILE_ATTRIBUTES|LAST_KNOWN_FILE_TYPE|PRODUCT_TYPE|SCHEME_(?:ADDRESS_SANITIZER|ADDRESS_SANITIZER_USE_AFTER_RETURN|ARGUMENTS|DISABLE_MAIN_THREAD_CHECKER|DYNAMIC_LIBRARY_LOADS|DYNAMIC_LINKER_API_USAGE|ENVIRONMENT|EXECUTABLE|GUARD_MALLOC|MAIN_THREAD_CHECKER_STOP|MALLOC_GUARD_EDGES|MALLOC_SCRIBBLE|MALLOC_STACK|THREAD_SANITIZER(?:_STOP)?|UNDEFINED_BEHAVIOUR_SANITIZER(?:_STOP)?|ZOMBIE_OBJECTS))|XCTEST)\b/, + 'variable': /\b(?:CMAKE_\w+|\w+_(?:(?:BINARY|SOURCE)_DIR|DESCRIPTION|HOMEPAGE_URL|ROOT|VERSION(?:_MAJOR|_MINOR|_PATCH|_TWEAK)?)|(?:ANDROID|APPLE|BORLAND|BUILD_SHARED_LIBS|CACHE|CPACK_(?:ABSOLUTE_DESTINATION_FILES|COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY|ERROR_ON_ABSOLUTE_INSTALL_DESTINATION|INCLUDE_TOPLEVEL_DIRECTORY|INSTALL_DEFAULT_DIRECTORY_PERMISSIONS|INSTALL_SCRIPT|PACKAGING_INSTALL_PREFIX|SET_DESTDIR|WARN_ON_ABSOLUTE_INSTALL_DESTINATION)|CTEST_(?:BINARY_DIRECTORY|BUILD_COMMAND|BUILD_NAME|BZR_COMMAND|BZR_UPDATE_OPTIONS|CHANGE_ID|CHECKOUT_COMMAND|CONFIGURATION_TYPE|CONFIGURE_COMMAND|COVERAGE_COMMAND|COVERAGE_EXTRA_FLAGS|CURL_OPTIONS|CUSTOM_(?:COVERAGE_EXCLUDE|ERROR_EXCEPTION|ERROR_MATCH|ERROR_POST_CONTEXT|ERROR_PRE_CONTEXT|MAXIMUM_FAILED_TEST_OUTPUT_SIZE|MAXIMUM_NUMBER_OF_(?:ERRORS|WARNINGS)|MAXIMUM_PASSED_TEST_OUTPUT_SIZE|MEMCHECK_IGNORE|POST_MEMCHECK|POST_TEST|PRE_MEMCHECK|PRE_TEST|TESTS_IGNORE|WARNING_EXCEPTION|WARNING_MATCH)|CVS_CHECKOUT|CVS_COMMAND|CVS_UPDATE_OPTIONS|DROP_LOCATION|DROP_METHOD|DROP_SITE|DROP_SITE_CDASH|DROP_SITE_PASSWORD|DROP_SITE_USER|EXTRA_COVERAGE_GLOB|GIT_COMMAND|GIT_INIT_SUBMODULES|GIT_UPDATE_CUSTOM|GIT_UPDATE_OPTIONS|HG_COMMAND|HG_UPDATE_OPTIONS|LABELS_FOR_SUBPROJECTS|MEMORYCHECK_(?:COMMAND|COMMAND_OPTIONS|SANITIZER_OPTIONS|SUPPRESSIONS_FILE|TYPE)|NIGHTLY_START_TIME|P4_CLIENT|P4_COMMAND|P4_OPTIONS|P4_UPDATE_OPTIONS|RUN_CURRENT_SCRIPT|SCP_COMMAND|SITE|SOURCE_DIRECTORY|SUBMIT_URL|SVN_COMMAND|SVN_OPTIONS|SVN_UPDATE_OPTIONS|TEST_LOAD|TEST_TIMEOUT|TRIGGER_SITE|UPDATE_COMMAND|UPDATE_OPTIONS|UPDATE_VERSION_ONLY|USE_LAUNCHERS)|CYGWIN|ENV|EXECUTABLE_OUTPUT_PATH|GHS-MULTI|IOS|LIBRARY_OUTPUT_PATH|MINGW|MSVC(?:10|11|12|14|60|70|71|80|90|_IDE|_TOOLSET_VERSION|_VERSION)?|MSYS|PROJECT_NAME|UNIX|WIN32|WINCE|WINDOWS_PHONE|WINDOWS_STORE|XCODE))\b/, + 'property': /\b(?:cxx_\w+|(?:ARCHIVE_OUTPUT_(?:DIRECTORY|NAME)|COMPILE_DEFINITIONS|COMPILE_PDB_NAME|COMPILE_PDB_OUTPUT_DIRECTORY|EXCLUDE_FROM_DEFAULT_BUILD|IMPORTED_(?:IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_LANGUAGES|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|NO_SONAME|OBJECTS|SONAME)|INTERPROCEDURAL_OPTIMIZATION|LIBRARY_OUTPUT_DIRECTORY|LIBRARY_OUTPUT_NAME|LINK_FLAGS|LINK_INTERFACE_LIBRARIES|LINK_INTERFACE_MULTIPLICITY|LOCATION|MAP_IMPORTED_CONFIG|OSX_ARCHITECTURES|OUTPUT_NAME|PDB_NAME|PDB_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_DIRECTORY|RUNTIME_OUTPUT_NAME|STATIC_LIBRARY_FLAGS|VS_CSHARP|VS_DOTNET_REFERENCEPROP|VS_DOTNET_REFERENCE|VS_GLOBAL_SECTION_POST|VS_GLOBAL_SECTION_PRE|VS_GLOBAL|XCODE_ATTRIBUTE)_\w+|\w+_(?:CLANG_TIDY|COMPILER_LAUNCHER|CPPCHECK|CPPLINT|INCLUDE_WHAT_YOU_USE|OUTPUT_NAME|POSTFIX|VISIBILITY_PRESET)|ABSTRACT|ADDITIONAL_MAKE_CLEAN_FILES|ADVANCED|ALIASED_TARGET|ALLOW_DUPLICATE_CUSTOM_TARGETS|ANDROID_(?:ANT_ADDITIONAL_OPTIONS|API|API_MIN|ARCH|ASSETS_DIRECTORIES|GUI|JAR_DEPENDENCIES|NATIVE_LIB_DEPENDENCIES|NATIVE_LIB_DIRECTORIES|PROCESS_MAX|PROGUARD|PROGUARD_CONFIG_PATH|SECURE_PROPS_PATH|SKIP_ANT_STEP|STL_TYPE)|ARCHIVE_OUTPUT_DIRECTORY|ATTACHED_FILES|ATTACHED_FILES_ON_FAIL|AUTOGEN_(?:BUILD_DIR|ORIGIN_DEPENDS|PARALLEL|SOURCE_GROUP|TARGETS_FOLDER|TARGET_DEPENDS)|AUTOMOC|AUTOMOC_(?:COMPILER_PREDEFINES|DEPEND_FILTERS|EXECUTABLE|MACRO_NAMES|MOC_OPTIONS|SOURCE_GROUP|TARGETS_FOLDER)|AUTORCC|AUTORCC_EXECUTABLE|AUTORCC_OPTIONS|AUTORCC_SOURCE_GROUP|AUTOUIC|AUTOUIC_EXECUTABLE|AUTOUIC_OPTIONS|AUTOUIC_SEARCH_PATHS|BINARY_DIR|BUILDSYSTEM_TARGETS|BUILD_RPATH|BUILD_RPATH_USE_ORIGIN|BUILD_WITH_INSTALL_NAME_DIR|BUILD_WITH_INSTALL_RPATH|BUNDLE|BUNDLE_EXTENSION|CACHE_VARIABLES|CLEAN_NO_CUSTOM|COMMON_LANGUAGE_RUNTIME|COMPATIBLE_INTERFACE_(?:BOOL|NUMBER_MAX|NUMBER_MIN|STRING)|COMPILE_(?:DEFINITIONS|FEATURES|FLAGS|OPTIONS|PDB_NAME|PDB_OUTPUT_DIRECTORY)|COST|CPACK_DESKTOP_SHORTCUTS|CPACK_NEVER_OVERWRITE|CPACK_PERMANENT|CPACK_STARTUP_SHORTCUTS|CPACK_START_MENU_SHORTCUTS|CPACK_WIX_ACL|CROSSCOMPILING_EMULATOR|CUDA_EXTENSIONS|CUDA_PTX_COMPILATION|CUDA_RESOLVE_DEVICE_SYMBOLS|CUDA_SEPARABLE_COMPILATION|CUDA_STANDARD|CUDA_STANDARD_REQUIRED|CXX_EXTENSIONS|CXX_STANDARD|CXX_STANDARD_REQUIRED|C_EXTENSIONS|C_STANDARD|C_STANDARD_REQUIRED|DEBUG_CONFIGURATIONS|DEFINE_SYMBOL|DEFINITIONS|DEPENDS|DEPLOYMENT_ADDITIONAL_FILES|DEPLOYMENT_REMOTE_DIRECTORY|DISABLED|DISABLED_FEATURES|ECLIPSE_EXTRA_CPROJECT_CONTENTS|ECLIPSE_EXTRA_NATURES|ENABLED_FEATURES|ENABLED_LANGUAGES|ENABLE_EXPORTS|ENVIRONMENT|EXCLUDE_FROM_ALL|EXCLUDE_FROM_DEFAULT_BUILD|EXPORT_NAME|EXPORT_PROPERTIES|EXTERNAL_OBJECT|EchoString|FAIL_REGULAR_EXPRESSION|FIND_LIBRARY_USE_LIB32_PATHS|FIND_LIBRARY_USE_LIB64_PATHS|FIND_LIBRARY_USE_LIBX32_PATHS|FIND_LIBRARY_USE_OPENBSD_VERSIONING|FIXTURES_CLEANUP|FIXTURES_REQUIRED|FIXTURES_SETUP|FOLDER|FRAMEWORK|Fortran_FORMAT|Fortran_MODULE_DIRECTORY|GENERATED|GENERATOR_FILE_NAME|GENERATOR_IS_MULTI_CONFIG|GHS_INTEGRITY_APP|GHS_NO_SOURCE_GROUP_FILE|GLOBAL_DEPENDS_DEBUG_MODE|GLOBAL_DEPENDS_NO_CYCLES|GNUtoMS|HAS_CXX|HEADER_FILE_ONLY|HELPSTRING|IMPLICIT_DEPENDS_INCLUDE_TRANSFORM|IMPORTED|IMPORTED_(?:COMMON_LANGUAGE_RUNTIME|CONFIGURATIONS|GLOBAL|IMPLIB|LIBNAME|LINK_DEPENDENT_LIBRARIES|LINK_INTERFACE_(?:LANGUAGES|LIBRARIES|MULTIPLICITY)|LOCATION|NO_SONAME|OBJECTS|SONAME)|IMPORT_PREFIX|IMPORT_SUFFIX|INCLUDE_DIRECTORIES|INCLUDE_REGULAR_EXPRESSION|INSTALL_NAME_DIR|INSTALL_RPATH|INSTALL_RPATH_USE_LINK_PATH|INTERFACE_(?:AUTOUIC_OPTIONS|COMPILE_DEFINITIONS|COMPILE_FEATURES|COMPILE_OPTIONS|INCLUDE_DIRECTORIES|LINK_DEPENDS|LINK_DIRECTORIES|LINK_LIBRARIES|LINK_OPTIONS|POSITION_INDEPENDENT_CODE|SOURCES|SYSTEM_INCLUDE_DIRECTORIES)|INTERPROCEDURAL_OPTIMIZATION|IN_TRY_COMPILE|IOS_INSTALL_COMBINED|JOB_POOLS|JOB_POOL_COMPILE|JOB_POOL_LINK|KEEP_EXTENSION|LABELS|LANGUAGE|LIBRARY_OUTPUT_DIRECTORY|LINKER_LANGUAGE|LINK_(?:DEPENDS|DEPENDS_NO_SHARED|DIRECTORIES|FLAGS|INTERFACE_LIBRARIES|INTERFACE_MULTIPLICITY|LIBRARIES|OPTIONS|SEARCH_END_STATIC|SEARCH_START_STATIC|WHAT_YOU_USE)|LISTFILE_STACK|LOCATION|MACOSX_BUNDLE|MACOSX_BUNDLE_INFO_PLIST|MACOSX_FRAMEWORK_INFO_PLIST|MACOSX_PACKAGE_LOCATION|MACOSX_RPATH|MACROS|MANUALLY_ADDED_DEPENDENCIES|MEASUREMENT|MODIFIED|NAME|NO_SONAME|NO_SYSTEM_FROM_IMPORTED|OBJECT_DEPENDS|OBJECT_OUTPUTS|OSX_ARCHITECTURES|OUTPUT_NAME|PACKAGES_FOUND|PACKAGES_NOT_FOUND|PARENT_DIRECTORY|PASS_REGULAR_EXPRESSION|PDB_NAME|PDB_OUTPUT_DIRECTORY|POSITION_INDEPENDENT_CODE|POST_INSTALL_SCRIPT|PREDEFINED_TARGETS_FOLDER|PREFIX|PRE_INSTALL_SCRIPT|PRIVATE_HEADER|PROCESSORS|PROCESSOR_AFFINITY|PROJECT_LABEL|PUBLIC_HEADER|REPORT_UNDEFINED_PROPERTIES|REQUIRED_FILES|RESOURCE|RESOURCE_LOCK|RULE_LAUNCH_COMPILE|RULE_LAUNCH_CUSTOM|RULE_LAUNCH_LINK|RULE_MESSAGES|RUNTIME_OUTPUT_DIRECTORY|RUN_SERIAL|SKIP_AUTOGEN|SKIP_AUTOMOC|SKIP_AUTORCC|SKIP_AUTOUIC|SKIP_BUILD_RPATH|SKIP_RETURN_CODE|SOURCES|SOURCE_DIR|SOVERSION|STATIC_LIBRARY_FLAGS|STATIC_LIBRARY_OPTIONS|STRINGS|SUBDIRECTORIES|SUFFIX|SYMBOLIC|TARGET_ARCHIVES_MAY_BE_SHARED_LIBS|TARGET_MESSAGES|TARGET_SUPPORTS_SHARED_LIBS|TESTS|TEST_INCLUDE_FILE|TEST_INCLUDE_FILES|TIMEOUT|TIMEOUT_AFTER_MATCH|TYPE|USE_FOLDERS|VALUE|VARIABLES|VERSION|VISIBILITY_INLINES_HIDDEN|VS_(?:CONFIGURATION_TYPE|COPY_TO_OUT_DIR|DEBUGGER_(?:COMMAND|COMMAND_ARGUMENTS|ENVIRONMENT|WORKING_DIRECTORY)|DEPLOYMENT_CONTENT|DEPLOYMENT_LOCATION|DOTNET_REFERENCES|DOTNET_REFERENCES_COPY_LOCAL|INCLUDE_IN_VSIX|IOT_STARTUP_TASK|KEYWORD|RESOURCE_GENERATOR|SCC_AUXPATH|SCC_LOCALPATH|SCC_PROJECTNAME|SCC_PROVIDER|SDK_REFERENCES|SHADER_(?:DISABLE_OPTIMIZATIONS|ENABLE_DEBUG|ENTRYPOINT|FLAGS|MODEL|OBJECT_FILE_NAME|OUTPUT_HEADER_FILE|TYPE|VARIABLE_NAME)|STARTUP_PROJECT|TOOL_OVERRIDE|USER_PROPS|WINRT_COMPONENT|WINRT_EXTENSIONS|WINRT_REFERENCES|XAML_TYPE)|WILL_FAIL|WIN32_EXECUTABLE|WINDOWS_EXPORT_ALL_SYMBOLS|WORKING_DIRECTORY|WRAP_EXCLUDE|XCODE_(?:EMIT_EFFECTIVE_PLATFORM_NAME|EXPLICIT_FILE_TYPE|FILE_ATTRIBUTES|LAST_KNOWN_FILE_TYPE|PRODUCT_TYPE|SCHEME_(?:ADDRESS_SANITIZER|ADDRESS_SANITIZER_USE_AFTER_RETURN|ARGUMENTS|DISABLE_MAIN_THREAD_CHECKER|DYNAMIC_LIBRARY_LOADS|DYNAMIC_LINKER_API_USAGE|ENVIRONMENT|EXECUTABLE|GUARD_MALLOC|MAIN_THREAD_CHECKER_STOP|MALLOC_GUARD_EDGES|MALLOC_SCRIBBLE|MALLOC_STACK|THREAD_SANITIZER(?:_STOP)?|UNDEFINED_BEHAVIOUR_SANITIZER(?:_STOP)?|ZOMBIE_OBJECTS))|XCTEST)\b/, 'keyword': /\b(?:add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|break|build_command|build_name|cmake_host_system_information|cmake_minimum_required|cmake_parse_arguments|cmake_policy|configure_file|continue|create_test_sourcelist|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload|define_property|else|elseif|enable_language|enable_testing|endforeach|endfunction|endif|endmacro|endwhile|exec_program|execute_process|export|export_library_dependencies|file|find_file|find_library|find_package|find_path|find_program|fltk_wrap_ui|foreach|function|get_cmake_property|get_directory_property|get_filename_component|get_property|get_source_file_property|get_target_property|get_test_property|if|include|include_directories|include_external_msproject|include_guard|include_regular_expression|install|install_files|install_programs|install_targets|link_directories|link_libraries|list|load_cache|load_command|macro|make_directory|mark_as_advanced|math|message|option|output_required_files|project|qt_wrap_cpp|qt_wrap_ui|remove|remove_definitions|return|separate_arguments|set|set_directory_properties|set_property|set_source_files_properties|set_target_properties|set_tests_properties|site_name|source_group|string|subdir_depends|subdirs|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_sources|try_compile|try_run|unset|use_mangled_mesa|utility_source|variable_requires|variable_watch|while|write_file)(?=\s*\()\b/, 'boolean': /\b(?:FALSE|OFF|ON|TRUE)\b/, 'namespace': /\b(?:INTERFACE|PRIVATE|PROPERTIES|PUBLIC|SHARED|STATIC|TARGET_OBJECTS)\b/, @@ -3016,7 +3032,7 @@ Prism.languages.erlang = { alias: 'atom' }, 'boolean': /\b(?:false|true)\b/, - 'keyword': /\b(?:after|case|catch|end|fun|if|of|receive|try|when)\b/, + 'keyword': /\b(?:after|begin|case|catch|end|fun|if|of|receive|try|when)\b/, 'number': [ /\$\\?./, /\b\d+#[a-z0-9]+/i, @@ -3075,85 +3091,82 @@ Prism.languages.insertBefore('go', 'string', { delete Prism.languages.go['class-name']; -Prism.languages.groovy = Prism.languages.extend('clike', { - 'string': [ - { +(function (Prism) { + + var interpolation = { + pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/, + lookbehind: true, + inside: { + 'interpolation-punctuation': { + pattern: /^\$\{?|\}$/, + alias: 'punctuation' + }, + 'expression': { + pattern: /[\s\S]+/, + inside: null // see below + } + } + }; + + Prism.languages.groovy = Prism.languages.extend('clike', { + 'string': { // https://groovy-lang.org/syntax.html#_dollar_slashy_string - pattern: /("""|''')(?:[^\\]|\\[\s\S])*?\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/, + pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/, greedy: true }, - { + 'keyword': /\b(?:abstract|as|assert|boolean|break|byte|case|catch|char|class|const|continue|def|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/, + 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i, + 'operator': { + pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, + lookbehind: true + }, + 'punctuation': /\.+|[{}[\];(),:$]/ + }); + + Prism.languages.insertBefore('groovy', 'string', { + 'shebang': { + pattern: /#!.+/, + alias: 'comment', + greedy: true + }, + 'interpolation-string': { // TODO: Slash strings (e.g. /foo/) can contain line breaks but this will cause a lot of trouble with // simple division (see JS regex), so find a fix maybe? - pattern: /(["'/])(?:\\.|(?!\1)[^\\\r\n])*\1/, - greedy: true + pattern: /"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/, + greedy: true, + inside: { + 'interpolation': interpolation, + 'string': /[\s\S]+/ + } } - ], - 'keyword': /\b(?:abstract|as|assert|boolean|break|byte|case|catch|char|class|const|continue|def|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|in|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/, - 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i, - 'operator': { - pattern: /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/, - lookbehind: true - }, - 'punctuation': /\.+|[{}[\];(),:$]/ -}); - -Prism.languages.insertBefore('groovy', 'string', { - 'shebang': { - pattern: /#!.+/, - alias: 'comment' - } -}); - -Prism.languages.insertBefore('groovy', 'punctuation', { - 'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/ -}); - -Prism.languages.insertBefore('groovy', 'function', { - 'annotation': { - pattern: /(^|[^.])@\w+/, - lookbehind: true, - alias: 'punctuation' - } -}); - -// Handle string interpolation -Prism.hooks.add('wrap', function (env) { - if (env.language === 'groovy' && env.type === 'string') { - var delimiter = env.content[0]; + }); - if (delimiter != "'") { - var pattern = /([^\\])(?:\$(?:\{.*?\}|[\w.]+))/; - if (delimiter === '$') { - pattern = /([^\$])(?:\$(?:\{.*?\}|[\w.]+))/; - } + Prism.languages.insertBefore('groovy', 'punctuation', { + 'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/ + }); - // To prevent double HTML-encoding we have to decode env.content first - env.content = env.content.replace(/</g, '<').replace(/&/g, '&'); + Prism.languages.insertBefore('groovy', 'function', { + 'annotation': { + pattern: /(^|[^.])@\w+/, + lookbehind: true, + alias: 'punctuation' + } + }); - env.content = Prism.highlight(env.content, { - 'expression': { - pattern: pattern, - lookbehind: true, - inside: Prism.languages.groovy - } - }); + interpolation.inside.expression.inside = Prism.languages.groovy; - env.classes.push(delimiter === '/' ? 'regex' : 'gstring'); - } - } -}); +}(Prism)); (function (Prism) { - var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/; + var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/; // full package (optional) + parent classes (optional) - var classNamePrefix = /(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source; + var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source; // based on the java naming conventions var className = { - pattern: RegExp(classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source), + pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source), lookbehind: true, inside: { 'namespace': { @@ -3175,9 +3188,16 @@ Prism.hooks.add('wrap', function (env) { 'class-name': [ className, { - // variables and parameters + // variables, parameters, and constructor references + // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods) + pattern: RegExp(/(^|[^\w.])/.source + classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source), + lookbehind: true, + inside: className.inside + }, + { + // class names based on keyword // this to support class names (or generic parameters) which do not contain a lower case letter (also works for methods) - pattern: RegExp(classNamePrefix + /[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source), + pattern: RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source + classNamePrefix + /[A-Z]\w*\b/.source), lookbehind: true, inside: className.inside } @@ -3225,6 +3245,30 @@ Prism.hooks.add('wrap', function (env) { 'operator': /[?&|]/ } }, + 'import': [ + { + pattern: RegExp(/(\bimport\s+)/.source + classNamePrefix + /(?:[A-Z]\w*|\*)(?=\s*;)/.source), + lookbehind: true, + inside: { + 'namespace': className.inside.namespace, + 'punctuation': /\./, + 'operator': /\*/, + 'class-name': /\w+/ + } + }, + { + pattern: RegExp(/(\bimport\s+static\s+)/.source + classNamePrefix + /(?:\w+|\*)(?=\s*;)/.source), + lookbehind: true, + alias: 'static', + inside: { + 'namespace': className.inside.namespace, + 'static': /\b\w+$/, + 'punctuation': /\./, + 'operator': /\*/, + 'class-name': /\w+/ + } + } + ], 'namespace': { pattern: RegExp( /(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/ @@ -3593,6 +3637,44 @@ Prism.languages.nim = { 'punctuation': /[({\[]\.|\.[)}\]]|[`(){}\[\],:]/ }; +Prism.languages.nix = { + 'comment': { + pattern: /\/\*[\s\S]*?\*\/|#.*/, + greedy: true + }, + 'string': { + pattern: /"(?:[^"\\]|\\[\s\S])*"|''(?:(?!'')[\s\S]|''(?:'|\\|\$\{))*''/, + greedy: true, + inside: { + 'interpolation': { + // The lookbehind ensures the ${} is not preceded by \ or '' + pattern: /(^|(?:^|(?!'').)[^\\])\$\{(?:[^{}]|\{[^}]*\})*\}/, + lookbehind: true, + inside: null // see below + } + } + }, + 'url': [ + /\b(?:[a-z]{3,7}:\/\/)[\w\-+%~\/.:#=?&]+/, + { + pattern: /([^\/])(?:[\w\-+%~.:#=?&]*(?!\/\/)[\w\-+%~\/.:#=?&])?(?!\/\/)\/[\w\-+%~\/.:#=?&]*/, + lookbehind: true + } + ], + 'antiquotation': { + pattern: /\$(?=\{)/, + alias: 'important' + }, + 'number': /\b\d+\b/, + 'keyword': /\b(?:assert|builtins|else|if|in|inherit|let|null|or|then|with)\b/, + 'function': /\b(?:abort|add|all|any|attrNames|attrValues|baseNameOf|compareVersions|concatLists|currentSystem|deepSeq|derivation|dirOf|div|elem(?:At)?|fetch(?:Tarball|url)|filter(?:Source)?|fromJSON|genList|getAttr|getEnv|hasAttr|hashString|head|import|intersectAttrs|is(?:Attrs|Bool|Function|Int|List|Null|String)|length|lessThan|listToAttrs|map|mul|parseDrvName|pathExists|read(?:Dir|File)|removeAttrs|replaceStrings|seq|sort|stringLength|sub(?:string)?|tail|throw|to(?:File|JSON|Path|String|XML)|trace|typeOf)\b|\bfoldl'\B/, + 'boolean': /\b(?:false|true)\b/, + 'operator': /[=!<>]=?|\+\+?|\|\||&&|\/\/|->?|[?@]/, + 'punctuation': /[{}()[\].,:;]/ +}; + +Prism.languages.nix.string.inside.interpolation.inside = Prism.languages.nix; + // https://ocaml.org/manual/lex.html Prism.languages.ocaml = { @@ -3878,7 +3960,7 @@ Prism.languages.ocaml = { lookbehind: true }, { - pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string|void)\b/i, + pattern: /(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i, alias: 'return-type', greedy: true, lookbehind: true @@ -3911,12 +3993,12 @@ Prism.languages.ocaml = { // // keywords cannot be preceded by "->" // the complex lookbehind means `(?|::)\s*)` - pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i, + pattern: /((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i, lookbehind: true } ], 'argument-name': { - pattern: /([(,]\s+)\b[a-z_]\w*(?=\s*:(?!:))/i, + pattern: /([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i, lookbehind: true }, 'class-name': [ diff --git a/lib/docs/filters/nix/clean_html.rb b/lib/docs/filters/nix/clean_html.rb index 731fc0cf..ed1720b8 100644 --- a/lib/docs/filters/nix/clean_html.rb +++ b/lib/docs/filters/nix/clean_html.rb @@ -60,6 +60,8 @@ module Docs end new_root.add_child(image_sections) + new_root.css('pre.programlisting').attr('data-language', 'nix') + new_root elsif subpath == 'nix/stable/expressions/builtins.html' @doc = doc.at_css('main dl') @@ -83,6 +85,12 @@ module Docs description.name = 'div' end + doc.css('pre > code').each do |code| + code.parent['data-language'] = 'nix' if code['class'] == 'language-nix' + code.parent['data-language'] = 'xml' if code['class'] == 'language-xml' + unwrap(code) + end + doc else doc From c75c23b5de0b7d7253e40b4efdc949b998ed35e9 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Mon, 25 Apr 2022 22:49:59 +0200 Subject: [PATCH 3/3] nix: add news entry --- assets/javascripts/news.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index 2e9453af..40930dcc 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2022-04-25", + "New documentation: Nix" + ], [ "2022-03-31", "New documentation: Eigen3"