Changeset 134


Ignore:
Timestamp:
Oct 12, 2012, 3:14:20 AM (7 years ago)
Author:
duerst@…
Message:

Changes to accommodate bidi markup/control characters:

  • added <span dir=(ltr|rtl)> inside <ionly> in rfc2629.dtd
  • added conversion from <span> to LRE/RLE/PDF in utf-8.xslt
  • added bidi_backfix in process_draft.rb to convert from LRE/RLE/PDF back to HTML span
  • restricted Ruby versions to >= 1.9 in process_draft.rb
Location:
draft-ietf-iri-3987bis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • draft-ietf-iri-3987bis/HOWTO.txt

    r129 r134  
    3030================
    3131
    32 - Ruby (both 1.8 and 1.9 based versions should be okay)
     32- Ruby (versions 1.9 and higher should be okay)
    3333- An XSLT 1.0 implementation (currently xsltproc, to change,
    3434  tweak xslt_convert in process_draft.rb.
  • draft-ietf-iri-3987bis/process_draft.rb

    r129 r134  
    1515  puts `tclsh #{TCLSRC} xml2#{type} #{temp_name} #{final_name}`
    1616  post_processing final_name if type=='txt'
     17  bidi_backfix final_name if type=='html'
    1718end
    1819
     
    4849end
    4950
     51LRE, RLE, PDF = "\u202A", "\u202B", "\u202C"
     52
     53# converts LRE/RLE/PDF back to <span dir='...'>..</span>
     54def bidi_backfix (draft)
     55  bidi_control_seen = nil
     56  text = File.read(draft)
     57  File.open(draft, 'w') do |output_file|
     58    text.each_char do |char|
     59      case char
     60          when LRE then output_file.write "<span dir='ltr'>"
     61          when RLE then output_file.write "<span dir='rtl'>"
     62          when PDF then output_file.write "</span>"
     63          else output_file.write char
     64          end
     65    end
     66  end
     67end
     68
    5069def convert_all (draft)
    5170  convert draft, 'ascii', 'txt'
  • draft-ietf-iri-3987bis/rfc2629.dtd

    r129 r134  
    124124
    125125<!-- General use -->
    126 <!ELEMENT ionly       (%TEXT;|xref|eref|iref|cref|spanx|vspace)*>    <!-- used only in international version  -->
    127 <!ELEMENT aonly       (%TEXT;|xref|eref|iref|cref|spanx|vspace)*>    <!-- used only in ASCII version  -->
    128 
     126<!ELEMENT ionly       (%TEXT;|xref|eref|iref|cref|spanx|vspace|span)*>    <!-- used only in international version  -->
     127<!ELEMENT aonly       (%TEXT;|xref|eref|iref|cref|spanx|vspace)*>         <!-- used only in ASCII version  -->
     128
     129<!ELEMENT span        (%TEXT;) >
     130<!ATTLIST span
     131          dir         (ltr|rtl)          #REQUIRED>
    129132
    130133<!--
  • draft-ietf-iri-3987bis/utf-8.xslt

    r127 r134  
    2020  <xsl:template match="aonly"/>
    2121 
     22  <!-- convert <span dir='ltr'>...</span> to &lre;..&pdf; -->
     23  <xsl:template match='span[@dir="ltr"]'>
     24    <xsl:text>&#x202A;</xsl:text><xsl:apply-templates/><xsl:text>&#x202C;</xsl:text>
     25  </xsl:template>
     26 
    2227  <!-- eliminating internationalization only elements, but not their contents -->
    2328  <xsl:template match="ionly">
Note: See TracChangeset for help on using the changeset viewer.