]> Savannah Git Hosting - gnulib.git/commitdiff
unilbrk: Enable most cases of Unicode rule (LB29).
authorBruno Haible <bruno@clisp.org>
Sun, 15 Sep 2024 13:00:30 +0000 (15:00 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 15 Sep 2024 13:00:30 +0000 (15:00 +0200)
* lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Enable rule LB29.
* lib/unilbrk/lbrktables.c: Regenerated.
* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
Allow a break between a character with property IS and '<'.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
Likewise.

ChangeLog
lib/gen-uni-tables.c
lib/unilbrk/lbrktables.c
lib/unilbrk/u16-possible-linebreaks.c
lib/unilbrk/u32-possible-linebreaks.c
lib/unilbrk/u8-possible-linebreaks.c

index 48dca8cbf2d0f78f568e4f1f755624076c6be612..c8db2a3230a31f0e46e6d35c586afe53adda0a7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-09-15  Bruno Haible  <bruno@clisp.org>
+
+       unilbrk: Enable most cases of Unicode rule (LB29).
+       * lib/gen-uni-tables.c (output_lbrk_rules_as_tables): Enable rule LB29.
+       * lib/unilbrk/lbrktables.c: Regenerated.
+       * lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop):
+       Allow a break between a character with property IS and '<'.
+       * lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop):
+       Likewise.
+       * lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop):
+       Likewise.
+
 2024-09-15  Bruno Haible  <bruno@clisp.org>
 
        unilbrk: Fully implement Unicode rule (LB9).
index 6ac81d0821746813fdaafcc1d97dd4147c81391c..f95a78dbf114e2f315c30205f442d2107f7aa119 100644 (file)
@@ -9273,12 +9273,8 @@ output_lbrk_rules_as_tables (const char *filename, const char *version)
 
   /* (LB29) Do not break between numeric punctuation and alphabetics
      ("e.g.").  */
-  /* We don't implement this rule, because we find it desirable to break before
-     the HTML tag "</P>" in strings like "<P>Some sentence.</P>".  */
-#if 0
   before = LBP_IS; after = LBP_AL; set_table_cell (prohibited_no_sp, true);
   before = LBP_IS; after = LBP_HL; set_table_cell (prohibited_no_sp, true);
-#endif
 
   /* (LB28a) Do not break inside the orthographic syllables of Brahmic
      scripts.  */
index 217933a526a340335508d7beba8994b60d978015..c09f5855a7a3ce2e0bc1a5cdb29580b39956da12 100644 (file)
@@ -54,7 +54,7 @@ const unsigned char unilbrk_table[41][41] =
 /* QU1 */ {  P,  I,  I,  I,  I,  I,  P,  P,  P,  P,  I,  I,  I,  I,  I,  I,  P,  P,  I,  I,  I,  P,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I, },
 /* QU2 */ {  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P,  P, },
 /* QU3 */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  D,  D,  I,  D,  P,  P,  D,  D,  D,  P,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D, },
-/*  IS */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  D,  D,  I,  D,  P,  P,  I,  D,  D,  P,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D,  D, },
+/*  IS */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  D,  D,  I,  D,  P,  P,  I,  D,  D,  P,  I,  I,  D,  D,  D,  D,  D,  D,  D,  I,  D,  D,  D,  D,  D,  D,  I,  D,  D, },
 /*  NU */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  I,  D,  I,  D,  P,  P,  D,  D,  D,  P,  I,  I,  D,  D,  D,  D,  D,  D,  D,  I,  D,  D,  D,  D,  D,  D,  I,  D,  D, },
 /*  PO */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  D,  D,  I,  D,  P,  P,  I,  D,  D,  P,  I,  I,  D,  D,  D,  D,  D,  D,  D,  I,  D,  D,  D,  D,  D,  D,  I,  D,  D, },
 /*  PR */ {  P,  I,  D,  I,  D,  I,  P,  P,  P,  P,  I,  I,  D,  D,  I,  D,  P,  P,  I,  D,  D,  P,  I,  I,  I,  I,  I,  I,  I,  I,  I,  I,  D,  D,  D,  D,  D,  D,  I,  I,  I, },
index dde1aa606497fe91ed5f428ccaa6ecab0bfca2b3..bf0f31057f9048e9f812e1d4ec8c8cae7f686862 100644 (file)
@@ -290,6 +290,14 @@ u16_possible_linebreaks_loop (const uint16_t *s, size_t n, const char *encoding,
                          Brahmic scripts, line 4.  */
                       *p = UC_BREAK_PROHIBITED;
                     }
+                  else if (last_prop == LBP_IS && uc == 0x003C)
+                    {
+                      /* Partially disable (LB29) Do not break between numeric
+                         punctuation and alphabetics ("e.g.").  We find it
+                         desirable to break before the HTML tag "</P>" in
+                         strings like "<P>Some sentence.</P>".  */
+                      *p = UC_BREAK_POSSIBLE;
+                    }
                   else if (last_prop == LBP_RI && prop == LBP_RI)
                     {
                       /* (LB30a) Break between two regional indicator symbols
index 9cdda2868dad6ac7e543f551032335fa96bdf8e4..a7630467a6a643fa04c80b3d8a3e63ffd79b9bf2 100644 (file)
@@ -283,6 +283,14 @@ u32_possible_linebreaks_loop (const uint32_t *s, size_t n, const char *encoding,
                          Brahmic scripts, line 4.  */
                       *p = UC_BREAK_PROHIBITED;
                     }
+                  else if (last_prop == LBP_IS && uc == 0x003C)
+                    {
+                      /* Partially disable (LB29) Do not break between numeric
+                         punctuation and alphabetics ("e.g.").  We find it
+                         desirable to break before the HTML tag "</P>" in
+                         strings like "<P>Some sentence.</P>".  */
+                      *p = UC_BREAK_POSSIBLE;
+                    }
                   else if (last_prop == LBP_RI && prop == LBP_RI)
                     {
                       /* (LB30a) Break between two regional indicator symbols
index 6c26a8c26f2e6ed6890cf6386b30e7b6469062f7..7abf20beed438f43ee6312593de2c9dcc2503732 100644 (file)
@@ -290,6 +290,14 @@ u8_possible_linebreaks_loop (const uint8_t *s, size_t n, const char *encoding,
                          Brahmic scripts, line 4.  */
                       *p = UC_BREAK_PROHIBITED;
                     }
+                  else if (last_prop == LBP_IS && uc == 0x003C)
+                    {
+                      /* Partially disable (LB29) Do not break between numeric
+                         punctuation and alphabetics ("e.g.").  We find it
+                         desirable to break before the HTML tag "</P>" in
+                         strings like "<P>Some sentence.</P>".  */
+                      *p = UC_BREAK_POSSIBLE;
+                    }
                   else if (last_prop == LBP_RI && prop == LBP_RI)
                     {
                       /* (LB30a) Break between two regional indicator symbols