Skip to content

Commit

Permalink
Merge pull request unidoc#469 from unidoc-build/prep-rc-v1.20.0
Browse files Browse the repository at this point in the history
Prepare release unioffice v1.20.0
  • Loading branch information
gunnsth authored Jun 27, 2022
2 parents e7ef588 + bb39296 commit 82d7cda
Show file tree
Hide file tree
Showing 59 changed files with 19,482 additions and 19,470 deletions.
4 changes: 2 additions & 2 deletions algo/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package algo ;import _g "strconv";func _a (_d byte )bool {return _d >='0'&&_d <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_ac :=make ([]byte ,len (s )*cnt );_gf :=[]byte (s );for _gd :=0;_gd < cnt ;_gd ++{copy (_ac [_gd :],_gf );};return string (_ac );};
package algo ;import _d "strconv";func _e (_b byte )bool {return _b >='0'&&_b <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_aed :=make ([]byte ,len (s )*cnt );_ba :=[]byte (s );for _cg :=0;_cg < cnt ;_cg ++{copy (_aed [_cg :],_ba );};return string (_aed );};

// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
func NaturalLess (lhs ,rhs string )bool {_c ,_ad :=0,0;for _c < len (lhs )&&_ad < len (rhs ){_e :=lhs [_c ];_b :=rhs [_ad ];_ef :=_a (_e );_cb :=_a (_b );switch {case _ef &&!_cb :return true ;case !_ef &&_cb :return false ;case !_ef &&!_cb :if _e !=_b {return _e < _b ;};_c ++;_ad ++;default:_fb :=_c +1;_be :=_ad +1;for _fb < len (lhs )&&_a (lhs [_fb ]){_fb ++;};for _be < len (rhs )&&_a (rhs [_be ]){_be ++;};_bb ,_ :=_g .ParseUint (lhs [_c :_fb ],10,64);_cbe ,_ :=_g .ParseUint (rhs [_c :_be ],10,64);if _bb !=_cbe {return _bb < _cbe ;};_c =_fb ;_ad =_be ;};};return len (lhs )< len (rhs );};
func NaturalLess (lhs ,rhs string )bool {_f ,_gf :=0,0;for _f < len (lhs )&&_gf < len (rhs ){_ee :=lhs [_f ];_c :=rhs [_gf ];_a :=_e (_ee );_ed :=_e (_c );switch {case _a &&!_ed :return true ;case !_a &&_ed :return false ;case !_a &&!_ed :if _ee !=_c {return _ee < _c ;};_f ++;_gf ++;default:_ag :=_f +1;_eea :=_gf +1;for _ag < len (lhs )&&_e (lhs [_ag ]){_ag ++;};for _eea < len (rhs )&&_e (rhs [_eea ]){_eea ++;};_ae ,_ :=_d .ParseUint (lhs [_f :_ag ],10,64);_ea ,_ :=_d .ParseUint (rhs [_f :_eea ],10,64);if _ae !=_ea {return _ae < _ea ;};_f =_ag ;_gf =_eea ;};};return len (lhs )< len (rhs );};
664 changes: 332 additions & 332 deletions chart/chart.go

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions color/color.go

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions common/axcontrol/axcontrol.go

Large diffs are not rendered by default.

545 changes: 274 additions & 271 deletions common/common.go

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions common/license/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@

// Package license helps manage commercial licenses and check if they
// are valid for the version of UniOffice used.
package license ;import _f "github.com/unidoc/unioffice/internal/license";const (LicenseTierUnlicensed =_f .LicenseTierUnlicensed ;LicenseTierCommunity =_f .LicenseTierCommunity ;LicenseTierIndividual =_f .LicenseTierIndividual ;LicenseTierBusiness =_f .LicenseTierBusiness ;);
package license ;import _c "github.com/unidoc/unioffice/internal/license";

// GetLicenseKey returns the currently loaded license key.
func GetLicenseKey ()*LicenseKey {return _f .GetLicenseKey ()};

// LicenseKey represents a loaded license key.
type LicenseKey =_f .LicenseKey ;
func GetLicenseKey ()*LicenseKey {return _c .GetLicenseKey ()};

// SetLicenseKey sets and validates the license key.
func SetLicenseKey (content string ,customerName string )error {return _f .SetLicenseKey (content ,customerName );};
func SetLicenseKey (content string ,customerName string )error {return _c .SetLicenseKey (content ,customerName );};

// LegacyLicense holds the old-style unioffice license information.
type LegacyLicense =_f .LegacyLicense ;
// LegacyLicenseType is the type of license
type LegacyLicenseType =_c .LegacyLicenseType ;

// LicenseKey represents a loaded license key.
type LicenseKey =_c .LicenseKey ;

// SetMeteredKey sets the metered License API key required for SaaS operation.
// Document usage is reported periodically for the product to function correctly.
func SetMeteredKey (apiKey string )error {return _c .SetMeteredKey (apiKey )};

// SetLegacyLicenseKey installs a legacy license code. License codes issued prior to June 2019.
// Will be removed at some point in a future major version.
func SetLegacyLicenseKey (s string )error {return _f .SetLegacyLicenseKey (s )};
func SetLegacyLicenseKey (s string )error {return _c .SetLegacyLicenseKey (s )};const (LicenseTierUnlicensed =_c .LicenseTierUnlicensed ;LicenseTierCommunity =_c .LicenseTierCommunity ;LicenseTierIndividual =_c .LicenseTierIndividual ;LicenseTierBusiness =_c .LicenseTierBusiness ;);

// MakeUnlicensedKey returns a default key.
func MakeUnlicensedKey ()*LicenseKey {return _f .MakeUnlicensedKey ()};
func MakeUnlicensedKey ()*LicenseKey {return _c .MakeUnlicensedKey ()};

// SetMeteredKey sets the metered License API key required for SaaS operation.
// Document usage is reported periodically for the product to function correctly.
func SetMeteredKey (apiKey string )error {return _f .SetMeteredKey (apiKey )};

// LegacyLicenseType is the type of license
type LegacyLicenseType =_f .LegacyLicenseType ;
// LegacyLicense holds the old-style unioffice license information.
type LegacyLicense =_c .LegacyLicense ;

// GetMeteredState checks the currently used metered document usage status,
// documents used and credits available.
func GetMeteredState ()(_f .MeteredStatus ,error ){return _f .GetMeteredState ()};
func GetMeteredState ()(_c .MeteredStatus ,error ){return _c .GetMeteredState ()};
112 changes: 56 additions & 56 deletions common/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,93 +9,93 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package logger ;import (_g "fmt";_db "io";_gc "os";_d "path/filepath";_e "runtime";);
package logger ;import (_c "fmt";_dc "io";_b "os";_db "path/filepath";_d "runtime";);

// ConsoleLogger is a logger that writes logs to the 'os.Stdout'
type ConsoleLogger struct{LogLevel LogLevel ;};

// Debug logs debug message.
func (_ad WriterLogger )Debug (format string ,args ...interface{}){if _ad .LogLevel >=LogLevelDebug {_af :="\u005b\u0044\u0045\u0042\u0055\u0047\u005d\u0020";_ad .logToWriter (_ad .Output ,_af ,format ,args ...);};};func (_bce WriterLogger )logToWriter (_cb _db .Writer ,_aee string ,_cbg string ,_deg ...interface{}){_ffc (_cb ,_aee ,_cbg ,_deg );};

// NewWriterLogger creates new 'writer' logger.
func NewWriterLogger (logLevel LogLevel ,writer _db .Writer )*WriterLogger {logger :=WriterLogger {Output :writer ,LogLevel :logLevel };return &logger ;};

// Logger is the interface used for logging in the unipdf package.
type Logger interface{Error (_f string ,_dc ...interface{});Warning (_ed string ,_fd ...interface{});Notice (_fe string ,_b ...interface{});Info (_bb string ,_ef ...interface{});Debug (_a string ,_cd ...interface{});Trace (_ce string ,_fc ...interface{});IsLogLevel (_ff LogLevel )bool ;};
// Notice does nothing for dummy logger.
func (DummyLogger )Notice (format string ,args ...interface{}){};

// Warning logs warning message.
func (_fg WriterLogger )Warning (format string ,args ...interface{}){if _fg .LogLevel >=LogLevelWarning {_efae :="\u005b\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u005d\u0020";_fg .logToWriter (_fg .Output ,_efae ,format ,args ...);};};
func (_bf ConsoleLogger )Warning (format string ,args ...interface{}){if _bf .LogLevel >=LogLevelWarning {_abf :="\u005b\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u005d\u0020";_bf .output (_b .Stdout ,_abf ,format ,args ...);};};

// NewConsoleLogger creates new console logger.
func NewConsoleLogger (logLevel LogLevel )*ConsoleLogger {return &ConsoleLogger {LogLevel :logLevel }};
// Debug does nothing for dummy logger.
func (DummyLogger )Debug (format string ,args ...interface{}){};

// Error does nothing for dummy logger.
func (DummyLogger )Error (format string ,args ...interface{}){};
// IsLogLevel returns true from dummy logger.
func (DummyLogger )IsLogLevel (level LogLevel )bool {return true };

// Notice logs notice message.
func (_eg WriterLogger )Notice (format string ,args ...interface{}){if _eg .LogLevel >=LogLevelNotice {_bf :="\u005bN\u004f\u0054\u0049\u0043\u0045\u005d ";_eg .logToWriter (_eg .Output ,_bf ,format ,args ...);};};
// SetLogger sets 'logger' to be used by the unidoc unipdf library.
func SetLogger (logger Logger ){Log =logger };

// Debug logs debug message.
func (_gb ConsoleLogger )Debug (format string ,args ...interface{}){if _gb .LogLevel >=LogLevelDebug {_fcc :="\u005b\u0044\u0045\u0042\u0055\u0047\u005d\u0020";_gb .output (_gc .Stdout ,_fcc ,format ,args ...);};};
// ConsoleLogger is a logger that writes logs to the 'os.Stdout'
type ConsoleLogger struct{LogLevel LogLevel ;};

// Info logs info message.
func (_ebf WriterLogger )Info (format string ,args ...interface{}){if _ebf .LogLevel >=LogLevelInfo {_df :="\u005bI\u004e\u0046\u004f\u005d\u0020";_ebf .logToWriter (_ebf .Output ,_df ,format ,args ...);};};
func (_ef ConsoleLogger )Info (format string ,args ...interface{}){if _ef .LogLevel >=LogLevelInfo {_ba :="\u005bI\u004e\u0046\u004f\u005d\u0020";_ef .output (_b .Stdout ,_ba ,format ,args ...);};};

// Trace logs trace message.
func (_gaf WriterLogger )Trace (format string ,args ...interface{}){if _gaf .LogLevel >=LogLevelTrace {_cg :="\u005b\u0054\u0052\u0041\u0043\u0045\u005d\u0020";_gaf .logToWriter (_gaf .Output ,_cg ,format ,args ...);};};
// Error logs error message.
func (_gg ConsoleLogger )Error (format string ,args ...interface{}){if _gg .LogLevel >=LogLevelError {_ab :="\u005b\u0045\u0052\u0052\u004f\u0052\u005d\u0020";_gg .output (_b .Stdout ,_ab ,format ,args ...);};};

// Info logs info message.
func (_gf ConsoleLogger )Info (format string ,args ...interface{}){if _gf .LogLevel >=LogLevelInfo {_ggb :="\u005bI\u004e\u0046\u004f\u005d\u0020";_gf .output (_gc .Stdout ,_ggb ,format ,args ...);};};
// NewConsoleLogger creates new console logger.
func NewConsoleLogger (logLevel LogLevel )*ConsoleLogger {return &ConsoleLogger {LogLevel :logLevel }};

// Trace does nothing for dummy logger.
func (DummyLogger )Trace (format string ,args ...interface{}){};
// Error does nothing for dummy logger.
func (DummyLogger )Error (format string ,args ...interface{}){};

// IsLogLevel returns true if log level is greater or equal than `level`.
// Can be used to avoid resource intensive calls to loggers.
func (_ge ConsoleLogger )IsLogLevel (level LogLevel )bool {return _ge .LogLevel >=level };
// Warning logs warning message.
func (_fa WriterLogger )Warning (format string ,args ...interface{}){if _fa .LogLevel >=LogLevelWarning {_efa :="\u005b\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u005d\u0020";_fa .logToWriter (_fa .Output ,_efa ,format ,args ...);};};const (LogLevelTrace LogLevel =5;LogLevelDebug LogLevel =4;LogLevelInfo LogLevel =3;LogLevelNotice LogLevel =2;LogLevelWarning LogLevel =1;LogLevelError LogLevel =0;);func (_acd WriterLogger )logToWriter (_dbd _dc .Writer ,_bfce string ,_cf string ,_dfd ...interface{}){_ace (_dbd ,_bfce ,_cf ,_dfd );};var Log Logger =DummyLogger {};

// WriterLogger is the logger that writes data to the Output writer
type WriterLogger struct{LogLevel LogLevel ;Output _db .Writer ;};
// Notice logs notice message.
func (_bbb ConsoleLogger )Notice (format string ,args ...interface{}){if _bbb .LogLevel >=LogLevelNotice {_ee :="\u005bN\u004f\u0054\u0049\u0043\u0045\u005d ";_bbb .output (_b .Stdout ,_ee ,format ,args ...);};};

// IsLogLevel returns true if log level is greater or equal than `level`.
// Can be used to avoid resource intensive calls to loggers.
func (_fb WriterLogger )IsLogLevel (level LogLevel )bool {return _fb .LogLevel >=level };
func (_eg ConsoleLogger )IsLogLevel (level LogLevel )bool {return _eg .LogLevel >=level };

// IsLogLevel returns true from dummy logger.
func (DummyLogger )IsLogLevel (level LogLevel )bool {return true };
// LogLevel is the verbosity level for logging.
type LogLevel int ;

// WriterLogger is the logger that writes data to the Output writer
type WriterLogger struct{LogLevel LogLevel ;Output _dc .Writer ;};

// DummyLogger does nothing.
type DummyLogger struct{};

// Trace logs trace message.
func (_gbe WriterLogger )Trace (format string ,args ...interface{}){if _gbe .LogLevel >=LogLevelTrace {_ae :="\u005b\u0054\u0052\u0041\u0043\u0045\u005d\u0020";_gbe .logToWriter (_gbe .Output ,_ae ,format ,args ...);};};

// Trace logs trace message.
func (_ac ConsoleLogger )Trace (format string ,args ...interface{}){if _ac .LogLevel >=LogLevelTrace {_cd :="\u005b\u0054\u0052\u0041\u0043\u0045\u005d\u0020";_ac .output (_b .Stdout ,_cd ,format ,args ...);};};

// Debug logs debug message.
func (_gag ConsoleLogger )Debug (format string ,args ...interface{}){if _gag .LogLevel >=LogLevelDebug {_ca :="\u005b\u0044\u0045\u0042\u0055\u0047\u005d\u0020";_gag .output (_b .Stdout ,_ca ,format ,args ...);};};

// Warning does nothing for dummy logger.
func (DummyLogger )Warning (format string ,args ...interface{}){};

// Notice does nothing for dummy logger.
func (DummyLogger )Notice (format string ,args ...interface{}){};func (_efe ConsoleLogger )output (_ac _db .Writer ,_de string ,_eb string ,_bc ...interface{}){_ffc (_ac ,_de ,_eb ,_bc ...);};
// Notice logs notice message.
func (_bfc WriterLogger )Notice (format string ,args ...interface{}){if _bfc .LogLevel >=LogLevelNotice {_dfc :="\u005bN\u004f\u0054\u0049\u0043\u0045\u005d ";_bfc .logToWriter (_bfc .Output ,_dfc ,format ,args ...);};};

// Info does nothing for dummy logger.
func (DummyLogger )Info (format string ,args ...interface{}){};
// Info logs info message.
func (_dce WriterLogger )Info (format string ,args ...interface{}){if _dce .LogLevel >=LogLevelInfo {_de :="\u005bI\u004e\u0046\u004f\u005d\u0020";_dce .logToWriter (_dce .Output ,_de ,format ,args ...);};};

// Trace logs trace message.
func (_ffd ConsoleLogger )Trace (format string ,args ...interface{}){if _ffd .LogLevel >=LogLevelTrace {_ga :="\u005b\u0054\u0052\u0041\u0043\u0045\u005d\u0020";_ffd .output (_gc .Stdout ,_ga ,format ,args ...);};};var Log Logger =DummyLogger {};
// Trace does nothing for dummy logger.
func (DummyLogger )Trace (format string ,args ...interface{}){};

// SetLogger sets 'logger' to be used by the unidoc unipdf library.
func SetLogger (logger Logger ){Log =logger };
// Logger is the interface used for logging in the unipdf package.
type Logger interface{Error (_bc string ,_dg ...interface{});Warning (_a string ,_df ...interface{});Notice (_e string ,_eb ...interface{});Info (_g string ,_bg ...interface{});Debug (_ec string ,_cc ...interface{});Trace (_dff string ,_ga ...interface{});IsLogLevel (_bb LogLevel )bool ;};

// Warning logs warning message.
func (_ae ConsoleLogger )Warning (format string ,args ...interface{}){if _ae .LogLevel >=LogLevelWarning {_cc :="\u005b\u0057\u0041\u0052\u004e\u0049\u004e\u0047\u005d\u0020";_ae .output (_gc .Stdout ,_cc ,format ,args ...);};};
// IsLogLevel returns true if log level is greater or equal than `level`.
// Can be used to avoid resource intensive calls to loggers.
func (_gc WriterLogger )IsLogLevel (level LogLevel )bool {return _gc .LogLevel >=level };func (_fe ConsoleLogger )output (_cde _dc .Writer ,_ad string ,_gb string ,_ff ...interface{}){_ace (_cde ,_ad ,_gb ,_ff ...);};

// Error logs error message.
func (_bga WriterLogger )Error (format string ,args ...interface{}){if _bga .LogLevel >=LogLevelError {_ebg :="\u005b\u0045\u0052\u0052\u004f\u0052\u005d\u0020";_bga .logToWriter (_bga .Output ,_ebg ,format ,args ...);};};const (LogLevelTrace LogLevel =5;LogLevelDebug LogLevel =4;LogLevelInfo LogLevel =3;LogLevelNotice LogLevel =2;LogLevelWarning LogLevel =1;LogLevelError LogLevel =0;);

// Debug does nothing for dummy logger.
func (DummyLogger )Debug (format string ,args ...interface{}){};
func (_eeb WriterLogger )Error (format string ,args ...interface{}){if _eeb .LogLevel >=LogLevelError {_eed :="\u005b\u0045\u0052\u0052\u004f\u0052\u005d\u0020";_eeb .logToWriter (_eeb .Output ,_eed ,format ,args ...);};};func _ace (_bd _dc .Writer ,_bfe string ,_eede string ,_fg ...interface{}){_ ,_gcc ,_gcg ,_efb :=_d .Caller (3);if !_efb {_gcc ="\u003f\u003f\u003f";_gcg =0;}else {_gcc =_db .Base (_gcc );};_ce :=_c .Sprintf ("\u0025s\u0020\u0025\u0073\u003a\u0025\u0064 ",_bfe ,_gcc ,_gcg )+_eede +"\u000a";_c .Fprintf (_bd ,_ce ,_fg ...);};

// Error logs error message.
func (_aa ConsoleLogger )Error (format string ,args ...interface{}){if _aa .LogLevel >=LogLevelError {_ba :="\u005b\u0045\u0052\u0052\u004f\u0052\u005d\u0020";_aa .output (_gc .Stdout ,_ba ,format ,args ...);};};
// Info does nothing for dummy logger.
func (DummyLogger )Info (format string ,args ...interface{}){};

// Notice logs notice message.
func (_gg ConsoleLogger )Notice (format string ,args ...interface{}){if _gg .LogLevel >=LogLevelNotice {_efa :="\u005bN\u004f\u0054\u0049\u0043\u0045\u005d ";_gg .output (_gc .Stdout ,_efa ,format ,args ...);};};func _ffc (_cdf _db .Writer ,_da string ,_bgb string ,_ee ...interface{}){_ ,_ffe ,_ebc ,_cdc :=_e .Caller (3);if !_cdc {_ffe ="\u003f\u003f\u003f";_ebc =0;}else {_ffe =_d .Base (_ffe );};_fgd :=_g .Sprintf ("\u0025s\u0020\u0025\u0073\u003a\u0025\u0064 ",_da ,_ffe ,_ebc )+_bgb +"\u000a";_g .Fprintf (_cdf ,_fgd ,_ee ...);};
// Debug logs debug message.
func (_ggg WriterLogger )Debug (format string ,args ...interface{}){if _ggg .LogLevel >=LogLevelDebug {_bgc :="\u005b\u0044\u0045\u0042\u0055\u0047\u005d\u0020";_ggg .logToWriter (_ggg .Output ,_bgc ,format ,args ...);};};

// LogLevel is the verbosity level for logging.
type LogLevel int ;
// NewWriterLogger creates new 'writer' logger.
func NewWriterLogger (logLevel LogLevel ,writer _dc .Writer )*WriterLogger {logger :=WriterLogger {Output :writer ,LogLevel :logLevel };return &logger ;};
22 changes: 11 additions & 11 deletions common/tempstorage/diskstore/diskstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@

// Package diskstore implements tempStorage interface
// by using disk as a storage
package diskstore ;import (_c "github.com/unidoc/unioffice/common/tempstorage";_b "io/ioutil";_gb "os";_a "strings";);
package diskstore ;import (_a "github.com/unidoc/unioffice/common/tempstorage";_g "io/ioutil";_f "os";_c "strings";);

// Open opens file from disk according to a path
func (_bg diskStorage )Open (path string )(_a .File ,error ){return _f .OpenFile (path ,_f .O_RDWR ,0644)};

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_ac :=diskStorage {};_a .SetAsStorage (&_ac )};type diskStorage struct{};

// TempFile creates a new temp file by calling ioutil TempFile
func (_cc diskStorage )TempFile (dir ,pattern string )(_c .File ,error ){return _b .TempFile (dir ,pattern );};
func (_fc diskStorage )TempFile (dir ,pattern string )(_a .File ,error ){return _g .TempFile (dir ,pattern );};

// TempFile creates a new temp directory by calling ioutil TempDir
func (_e diskStorage )TempDir (pattern string )(string ,error ){return _b .TempDir ("",pattern )};
func (_e diskStorage )TempDir (pattern string )(string ,error ){return _g .TempDir ("",pattern )};

// Add is not applicable in the diskstore implementation
func (_ed diskStorage )Add (path string )error {return nil };type diskStorage struct{};

// Open opens file from disk according to a path
func (_d diskStorage )Open (path string )(_c .File ,error ){return _gb .OpenFile (path ,_gb .O_RDWR ,0644)};
func (_ad diskStorage )Add (path string )error {return nil };

// RemoveAll removes all files in the directory
func (_da diskStorage )RemoveAll (dir string )error {if _a .HasPrefix (dir ,_gb .TempDir ()){return _gb .RemoveAll (dir );};return nil ;};

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_f :=diskStorage {};_c .SetAsStorage (&_f )};
func (_fb diskStorage )RemoveAll (dir string )error {if _c .HasPrefix (dir ,_f .TempDir ()){return _f .RemoveAll (dir );};return nil ;};
Loading

0 comments on commit 82d7cda

Please sign in to comment.