From d2c5c7c66c238a1cb8773f32a3cb177fe372411e Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 4 Mar 2024 10:39:23 -0800 Subject: [PATCH] Add UI controls to CLI options in reader and writer. Fixes #33. --- example-files/property-copying.html | 24 ++++++++++++++++++++++++ lib/rdf/rdfa/reader.rb | 10 ++++++++-- lib/rdf/rdfa/writer.rb | 3 +++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 example-files/property-copying.html diff --git a/example-files/property-copying.html b/example-files/property-copying.html new file mode 100644 index 0000000..17acb53 --- /dev/null +++ b/example-files/property-copying.html @@ -0,0 +1,24 @@ +
+
+ + + + Muse +
+ +

+ + Muse at the United Center. + , + United Center, Chicago, Illinois + ... +

+ +

+ + Muse at the Target Center. + , + Target Center, Minneapolis, Minnesota + ... +

+
\ No newline at end of file diff --git a/lib/rdf/rdfa/reader.rb b/lib/rdf/rdfa/reader.rb index ea7ee84..5830e5b 100644 --- a/lib/rdf/rdfa/reader.rb +++ b/lib/rdf/rdfa/reader.rb @@ -251,18 +251,24 @@ def self.options RDF::CLI::Option.new( symbol: :vocab_expansion, datatype: TrueClass, + default: false, + control: :checkbox, on: ["--vocab-expansion"], description: "Perform OWL2 expansion on the resulting graph.") {true}, RDF::CLI::Option.new( symbol: :host_language, - datatype: %w(xml xhtml1 xhtml5 html4 svg), - on: ["--host-language HOSTLANG", %w(xml xhtml1 xhtml5 html4 svg)], + datatype: %w(xml xhtml1 xhtml5 html4 html5 svg), + default: :html5, + control: :select, + on: ["--host-language HOSTLANG", %w(xml xhtml1 xhtml5 html4 html5 svg)], description: "Host Language. One of xml, xhtml1, xhtml5, html4, or svg") do |arg| arg.to_sym end, RDF::CLI::Option.new( symbol: :rdfagraph, datatype: %w(output processor both), + default: :output, + control: :select, on: ["--rdfagraph RDFAGRAPH", %w(output processor both)], description: "Used to indicate if either or both of the :output or :processor graphs are output.") {|arg| arg.to_sym}, ] diff --git a/lib/rdf/rdfa/writer.rb b/lib/rdf/rdfa/writer.rb index 490dc4f..4dd9d10 100644 --- a/lib/rdf/rdfa/writer.rb +++ b/lib/rdf/rdfa/writer.rb @@ -82,6 +82,9 @@ def self.options symbol: :lang, datatype: String, on: ["--lang"], + datatype: TrueClass, + default: false, + control: :checkbox, description: "Output as root @lang attribute, and avoid generation _@lang_ where possible."), ] end