GithubHelp home page GithubHelp logo

jmzambon / libreoffice-code-highlighter Goto Github PK

View Code? Open in Web Editor NEW
67.0 67.0 4.0 27.87 MB

Code snippet highlighter for LibreOffice.

Home Page: https://extensions.libreoffice.org/en/extensions/show/5814

License: Other

Python 100.00% Shell 0.01%
libreoffice libreoffice-extension

libreoffice-code-highlighter's People

Contributors

asomers avatar avatarmod avatar dantleech avatar flywire avatar jmzambon avatar jolange avatar lgobinath avatar medovina avatar slgobinath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

libreoffice-code-highlighter's Issues

Highlighting LLVM code removes some numeric labels

When I try to highlight LLVM code, numeric labels which are followed by a same line comment are removed. This is problematic since a lot of generated LLVM code I've seen uses numeric labels and has comments to give the predecessor blocks.

Example:

define i32 @foobar(i32 %0) {
; this label is fine
start:
%1 = icmp eq i32 %1, i32 0
br i1 icmp, label %exit, label %10

; this label disappears
10: ; if a comment is here
%2 = add i32 %1, i32 1
br label %exit

; this label is fine
exit: ; even if a comment is here
%3 = phi i32 [ %1, %start ], [ %2, %10 ]
ret i32 %3
}

Or more realistically:

33:                                               ; preds = %147, %4
  %34 = load i32, ptr %7, align 4
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %36, label %150

image

Input fields not visible with dark theme

Hey, I noticed that the input fields aren't really visible when dark theme is enabled (I believe the theme is taken from OS by default, so this might affect quite a few people).

I think adding white edges to the fields would fix this:

image

I can see the fields are visible with light mode, though (dark) edges for them would help here too, imo:

image

Line numbers zero padding

Hi, would it be possible to add a feature to pad line numbers with zeroes?

I think either to fixed number of digits or dynamically to the largest number of digits used would be fine, but the possibility of choosing between these two would be absolutely perfect.

Use Character styles instead of Direct styles

Hey, would it be possible to modify the code to use Character styles instead of Direct styles?

I believe when using Direct styles and saving to .fodt, all Direct styles are assigned random unique names, which makes it much harder to properly version with git, whereas all usages of a Character style use the same name.

The dialog window won't open

Hello,

I tried just now, to highlight a Python code I put as a plain text on my LibreOffice Writer.

The Redo the higlight and the cancel show me both an error, and the normal Highlight Code didn't show me any dialog box about the code I have to highligh.

Here's the actual configuration of LibreOffice

Version: 7.4.1.2 (x64) / LibreOffice Community
Build ID: 3c58a8f3a960df8bc8fd77b461821e42c061c5f0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: threaded

I use the Code Highlighter 2 version: 2.4.3, the latest I just dowloaded

My Windows Config:

Nom de l'appareil PC-CLEMENT
Processeur Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz 2.50 GHz
Mémoire RAM installée 6,00 Go (5,88 Go utilisable)
ID de périphérique B49A283B-7CCE-4920-859D-62D5BB92E3B6
ID de produit 00330-80000-00000-AA890
Type du système Système d’exploitation 64 bits, processeur x64
Stylet et fonction tactile La fonctionnalité d’entrée tactile ou avec un stylet n’est pas disponible sur cet écran
Édition Windows 10 Professionnel
Version 21H2
Installé le ‎08/‎10/‎2020
Build du système d’exploitation 19044.2006
Expérience Windows Feature Experience Pack 120.2212.4180.0

Thank you for the help

Merlode

Add some kind of preview, perhaps even custom color selection

Would it be possible to show preview of the Highlight Style (colors, mainly) somewhere? (There is noticeable empty space on the right)

I assume I must not be the only one who has no clue what the difference between borland, lovelace and vim is, and just going through all the styles until I find one that is not terrible seems like uneffective usage of my time.

Having an option to modify the styles would be nice too, actually, since the style may be almost perfect, but perhaps might look nicer with strings highlighted in different color, or what have you.

image

Code Highlighter menu buttons don't seem to work

Hi, sorry for not responding for a bit, I was really busy.

I updated the extension today through the LibreOffice's extension update tool, but the menu buttons unfortunately don't seem to work anymore, I no longer get the window when clicking the first one, nothing happens on either. I assume it does work for you, in which case it might be the fact I'm using LibreOffice 7.6, or perhaps it broke because of the update tool? Should I try to reinstall? But perhaps there might be some debug info if I ran LO from the console or something, not sure 😅

image

Trouble with highlighting Julia Code, possibly due to unicode characters

Hi, I am trying to include some Juia Code on an Impress document. A first (julia) function works fine, but for the next one (shown below), highlighting is all over the place, and some (unicode) characters get mangled, like the italic t and the italic ig.

function Projection(tax_rate, 
  tax_credit_0,
  cap_mkt::CapMvkt,
  invs::InvPort,
  liabs::LiabIns,
  liabs_other::LiabOther,
  dyn::Dynamic)
  ##                                      1. intialisation   
  proj = Projection(liabs, tax_rate, tax_credit_0)
  ##                                      2. boucle sur les années jusque horizon des passifs

  for 𝑡  1:liabs.dur
  ##                                      2.1 boucle dumy sur les couts fixes
    for 𝑖𝑔  [:IGCash, :IGStock,:IGBond1]
      proj.fixed_cost_gc[𝑡] +=
      invs.igs[𝑖𝑔].cost.abs[𝑡] *
      invs.igs[𝑖𝑔].cost.cum_infl_abs[𝑡] *
      liabs.gc[𝑡]
    end
  end
  ##     


  ##                                      3. traitement des dettes, going oncern etc
  l_other = deepcopy(liabs_other)         # 3.1 les dettes sub.
  goingconcern!(l_other, liabs.Δgc)       # 3.2 modifie l_other.sub,tq la dette s'mortisse en ligne avec liabs.gc
  ##                                      4. initialisation - fin
  val0!(cap_mkt, invs, liabs, l_other, proj) # 5 val0! intialise tpg par itération sur les mp,puis dettes l_other
                                             # et invest(la valeur) et le surplus ie différence
  proj.cf[:,:gc] = liabs.Δgc * (proj.val_0[1,:invest] -    # 6.initialisation proj.cf[:,:gc] avec valeur en [1]
                  proj.val_0[1,:tpg] -
                  proj.val_0[1,:l_other])
  ##     ---------------------            7. la vraie boucle de projection du bilan
  for 𝑡 = 1:liabs.dur
    project_bs!(𝑡, cap_mkt, invs, liabs, l_other, dyn, proj) # 8 appelé une fois par année de projection ici p2.
  end
  ##     ---------------------            7. fin
  ##                                      9. post traitement de partage avec les assurés. 
  valbonus!(cap_mkt.rfr.x, proj)          # 10 MAJ du champ (prov pour) bonus  des dataframes p.val, p.val_0
  valcostprov!(cap_mkt.rfr.x, invs, proj) # 11 MAJ du champ cost_prov des dataframes proj.cf , p.val, p.val_0
  return proj
end
                      
```

For the curious, the code is coming from this site https://github.com/mkriele/ValueOrientedRiskManagementInsurance.jl

And thank you for the extension! 

go lang string don't detection

Hello
I am using code highlighter for golang, but string doesn't detect
Golang has two types of strings

  1. use backticks (`) for definition
  2. use double quotes ("") for definition

now string by backticks detection, but by double quotes don't detection

Tag Snippet with Lexer

The user selects the lexer [language] manually, or Pygments can guess, but the lexer is not saved. It would be useful to save the lexer with the snippet and allow Code Highlighter 2 to read a tag associated with a snippet (eg similar to markdown tagging code blocks with language) :

  1. Pygments could be rerun over a mixed coding language document without user selecting lexer
  2. a snippet would only have one lexer tag
  3. select whole snippet with a click
  4. current interface would allow user to assign new lexer tag
  5. Pygments could be rerun over document with mixed coding languages without selecting lexer

Developer Notes

Can the wiki be enabled for developer notes?

Quick and Dirty Development Environment

  1. See https://wiki.documentfoundation.org/Development/Extension_Development for an overview
  2. LO files are zipped folders with a renamed extension. Extract them to a directory, change files as required then zip them again with the required extension
  3. Expose functions for development by uncommenting the corresponding entry in ../META_INF/manifest.xml
  4. Use the apso extension to edit the macro and display a console
  5. After the macro is changed the script has to be reloaded by closing and opening the document
  6. Script LibreOffice remotely via a socket to save reloading lo after each code change
  7. Tip: Indicate development version in gui by editing description.xml version value to add !

  1. How to enable debug console logging?
  2. How to inject temporary options for development without changing dialog?

Does not work in Libreoffice 6.4.7.2

In Libreoffice 6.4.7.2 (Kubuntu 20.04 LTS), there are no "Highlight Code" options under the "Tools" section, even though the extension installs successfully.

LO build extension manager thrown an error when I tried to update libreoffice-code-highlighter to version 2.2.1.

Distro: Fedora 35 Workstation

Error message:

Error while installing extension Code Highlighter 2. The error message is: Cannot detect media-type: file:///tmp/STi7Zu_/NVcmI1_/b39f3a31-6a1e-41fc-bcdd-aee458de120f /builddir/build/BUILD/libreoffice-7.2.5.2/desktop/source/deployment/registry/dp_registry.cxx:481
The extension will not be installed.

Proof:
image

Info:

Version: 7.2.5.2.0+
Build ID: 20(Build:2)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

For now, I'm installing this from outside LO. Please do fix this so that it doesn't break for future updates.

clicking on highlight menu item does nothing

I thought, maybe i needed that python script provider thing, but i couldn't find anything on my Mageia distro, and no information on what kind of files would be installed, if i had this or not.
I figured, i just find a verbose log option and see what happens, but libreoffice seems to fork after startup and logs seem to be disabled when compiling it...

Please help me, is there really no log to just see what happens when i click the hightlight menu item? and what kind of files/plugins/libraries should i have if that python provider thing is installed?

Explain Document Change

What changes does Code Highlighter 2 make to the Writer files? I assume it hard-formats the code color rather than applying styles. Please explain in README.md.

Code Colorizer Formatter as a comparison:

I use specific paragraph styles for my code examples. The currently supported paragraph styles are "_OOoComputerCode", "_OOoComputerCodeInTable", "_OOoComputerCodeLastLine", "_code", "_code_first_line", "_code_last_line", and "_code_one_line".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.