Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build against Asciidoctor 2.0.22 #1725

Merged
merged 3 commits into from
Mar 17, 2024

Conversation

ggrossetie
Copy link
Member

No description provided.

@mojavelinux
Copy link
Member

mojavelinux commented Mar 15, 2024

The following patch fixes both issues:

diff --git packages/core/lib/asciidoctor/js/opal_ext.rb packages/core/lib/asciidoctor/js/opal_ext.rb
index fe218fc..b2e5577 100644
--- packages/core/lib/asciidoctor/js/opal_ext.rb
+++ packages/core/lib/asciidoctor/js/opal_ext.rb
@@ -1,6 +1,7 @@
 require 'asciidoctor/js/opal_ext/kernel'
 require 'asciidoctor/js/opal_ext/file'
 require 'asciidoctor/js/opal_ext/match_data'
+require 'asciidoctor/js/opal_ext/array'
 require 'asciidoctor/js/opal_ext/string'
 require 'asciidoctor/js/opal_ext/uri'
 require 'asciidoctor/js/opal_ext/base64'
diff --git packages/core/lib/asciidoctor/js/opal_ext/array.rb packages/core/lib/asciidoctor/js/opal_ext/array.rb
new file mode 100644
index 0000000..d703dfc
--- /dev/null
+++ packages/core/lib/asciidoctor/js/opal_ext/array.rb
@@ -0,0 +1,11 @@
+class Array
+  alias :_original_pack :pack
+
+  def pack format
+    if format == 'm0'
+      ::Base64.strict_encode64 self
+    else
+      _original_pack self
+    end
+  end
+end
diff --git packages/core/lib/asciidoctor/js/postscript.rb packages/core/lib/asciidoctor/js/postscript.rb
index fe5f3bf..dca7397 100644
--- packages/core/lib/asciidoctor/js/postscript.rb
+++ packages/core/lib/asciidoctor/js/postscript.rb
@@ -4,3 +4,5 @@ require 'asciidoctor/extensions'
 
 require 'asciidoctor/js/asciidoctor_ext'
 require 'asciidoctor/js/opal_ext/logger' # override the built-in Logger
+
+Asciidoctor::InlineLinkRx = %r((^|link:|#{CG_BLANK}|\\?&lt;(?=\\?(?:https?|file|ftp|irc)(:))|[>\(\)\[\];"'])(\\?(?:https?|file|ftp|irc)://)(?:([^\s\[\]]+)\[(|#{CC_ALL}*?[^\\])\]|(?!\2)([^\s]*?)&gt;|([^\s\[\]<]*([^\s,.?!\[\]<\)]))))

@ggrossetie
Copy link
Member Author

Thanks! I figured out the first fix (on Array#pack) but I had no idea how to fix the second one 😉

@ggrossetie
Copy link
Member Author

I think we are hitting #1709 because we are reusing a registry in https://github.com/asciidoctor/asciidoctor.js/blob/v2.2.x/packages/core/types/tests.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants