Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting the language and base URI on an SSML <speak/>
- Loading branch information
1 parent
6f4bd92
commit e8ea671
Showing
5 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
module RubySpeech | ||
module SSML | ||
class Speak < Niceogiri::XML::Node | ||
include XML::Language | ||
|
||
def self.new | ||
super('speak').tap do |new_doc| | ||
new_doc.namespace = 'http://www.w3.org/2001/10/synthesis' | ||
new_doc[:version] = '1.0' | ||
new_doc['xml:lang'] = "en-US" | ||
new_doc[:version] = '1.0' | ||
new_doc.namespace = 'http://www.w3.org/2001/10/synthesis' | ||
new_doc.language = "en-US" | ||
end | ||
end | ||
|
||
def base_uri | ||
read_attr :base | ||
end | ||
|
||
def base_uri=(uri) | ||
write_attr 'xml:base', uri | ||
end | ||
end # Document | ||
end # SSML | ||
end # RubySpeech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module RubySpeech | ||
module XML | ||
extend ActiveSupport::Autoload | ||
|
||
autoload :Language | ||
end # XML | ||
end # RubySpeech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module RubySpeech | ||
module XML | ||
module Language | ||
def language | ||
read_attr :lang | ||
end | ||
|
||
def language=(l) | ||
write_attr 'xml:lang', l | ||
end | ||
end # Language | ||
end # XML | ||
end # RubySpeech |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters