Skip to content

Commit

Permalink
implements function for converting xpath to css
Browse files Browse the repository at this point in the history
  • Loading branch information
madoleary committed Jan 25, 2024
1 parent ed61430 commit 7b5c04f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ def custom_uniqueness_check
errors.add(:url, "A document for this URL already exists! Inspect it here: #{go_to_doc}")
end

def convert_xpath_to_css
runner = NodeRunner.new(
<<~JAVASCRIPT
const xPathToCss = require('xpath-to-css')
const convert = (xpath) => {
const css = xPathToCss(xpath)
return css;
}
JAVASCRIPT
)
runner.convert xpath
end

def fetch_ota_text
versions = %w[pga-versions contrib-versions]
service_name = service.name
Expand Down

0 comments on commit 7b5c04f

Please sign in to comment.