How to include plantuml diagram within a single markdown file? - gitlab

I have a single markdown file that looks something like this:
#startuml Participants
actor Alice
participant Bob
participant Charlie
hide unlinked
#enduml
#startuml Diagram
'!include Participants
Bob->Alice: Do a thing
Alice->Bob: Do a different thing
#enduml
In short the problem I'm trying to solve is to render plantuml in a markdown (so it can be rendered by gitlab) in a way that involves "!includes". Locally I can achieve what I want using simple puml files and !include statements, but because of how markdown is rendered in gitlab, it appears it can't see the filesystem/structure and the !includes give an error. So I am ok with putting everything in a single file, but I still want to separate diagrams logically and put them together. The problem with what I have above is Alice and Bob in "Diagram" both render as participants (Alice is not an Actor) and if I uncomment the include, it gives an error.
How can I achieve something equivalent to !includes with plantuml in a markdown file?

we solved this today by creating a user in gitlab with reporter rights for the projects we want to use plantUml in Markdown files.
In the markdown files we now import another file by doing something like this:
!includeurl https://plantuml:SecretPassword#git.example.com/gitlab/project/-/raw/master/File_to_import.puml

Related

How to specify the items in reference list using BibTeX? ChemPhysChem LaTeX requirement

I'm revising a manuscript for ChemPhysChem. They just provided a very simple templet here. However, I have some problems meeting the requirement:
Please follow our house style for references for example: [1] X. Y.
Name, A. B. Name, J. Abbr. 2016, 5, 111-120.
This kind of reference hides the title, and I can not find an existing style to meet the need.
I am using the following latex script:
\documentclass{article}
\usepackage[sorting=none, backend=biber]{biblatex}
\addbibresource{ref_r.bib}
What do I need to do to solve the problem? Do I really need to build a new .bst file? Could anyone share their experience on submitting manuscripts on ChemPhysChem using LaTeX?
Don't use biblatex for journal submissions unless your publisher explicitly states that they do accept it. While it is a nice and flexible tool, biblatex is not yet the standard.
Just follow the instructions from the template and use
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%alternatively you may use
\bibliographystyle{unsrt}
\bibliography{mymanuscript.bib}
%and send the .bib file along with your manuscript
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Don't worry if the resulting style might be a bit different from their requirement, they won't use it anyway but convert your source files with their pipeline.
I changed to my latex using BibTeX back, and built a cpc.bst file for ChemPhysChem using the following command with the help of the youtube video:
latex makebst
It would not be that hard to create the bibliography style file using the guide of the above-mentioned video.
And the result looks like
this.

How can I convert a #startuml code into a GraphML?

I have created a #startuml code that generates some class and sequence diagrams using PlantUML and it looks good but I would like to be able to edit the resulting graph using GraphML with the yed-live tool from yworks.com for example.
How can I convert the #startuml code to be compatible with GraphML?
Example:
#startuml
Bob -> Alice: Hello!
#enduml
And you can check the result in https://www.planttext.com/
You can use the official PlantUML tool to generate UML diagrams easily.
Just copy & paste your code and it will generate it automatically as in my example.
UML generating demo:

What connection should I use for a dynamic file

I have to create a class diagram for a tree structure of a filesystem.
I have directory/folder named myfolder. In that folder I have two files: file1 and file2. file1 will be there forever so I have a composition between file1 and myfolder. On the other hand file2 will appear and disappear because it is a product of compiled file1. When I tell the build file to clean the target file2 disappears.
What connection should I use between myfolder and file2?
What connection should I use between file1 and file2?
Thank you.
I am using a deployment diagram for that. To symbolize a folder I use a package stereotyped as <<folder>> and for file simple artifacts like this:
Of course this will only show a static configuration. Dynamic behavior will be caused by some object interaction for which you can use sequence diagrams. Or use informal notes/constraints.
The Class diagram does not work with the objects themselves, but with the classes. (You CAN use objects in it, but their use is not the theme of this diagram normally)
Of course, you can add many fields to the File, such as name, Date and so on, but the bulk is here.
If you want to show the concrete structure of dependency of objects, use Object diagram instead:
These connections with crosses in circles mean containment.
BTW, you can show the package on the class diagram, too, and not include classes rectangles into the package rectangle, but connect them with containment relationship, too, if you wish. But notice, packages tell us not about the product that the client get, but about organization of your classes in your source code. Usually package diagram tells about that, but you can show it on the class diagram, too.
Composition means that item belongs only to the collection in a natural way and can't belong to any other. But it is for classes, not objects.
The fact of appearing and disappearing of something can not be shown in the structure diagrams, such as Deployment, Component, Package, Class and Object. You should use interactions diagrams for that - State, Sequence, Activity, Timing.
But, hooray! There is always such thing as a comment. You can put comments on both containment connections and simply write in them, that one is forever, and the other one appears and disappears.
As for relationship between file1 and file2 use Dependency arrow with text explanation on it.

showing HTML in field instructions, not rendering?

I have a field for embedding videos. In the description I would like to show a sample of what that code should look like. However natively EE will render the HTML. Is there a way to show exactly what the code should look like without it being rendered? Other fields have HTML that needs to render so if there is a global on/off it must be on.
Have a look at NSM Publish Hints
If we are talking about a specific CF in a channel, the way I go about it is as follow:
For external services (youtube/viemo): have a custom field (text) where people just have to paste in the ID of the video, and another field (P&T pill or dropwown) where editors choose the service (vimeo, youtube). The various embed codes are handled on the template side within an if/else or case logic
For HTML5 self hosted videos: have several file fields letting people choose videos in the various needed formats. These videos are uploaded through FTP and synced using the file manager.
Copy and paste your code into this Encoder and paste the output into the description field:
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/encode.aspx

Any way in Expression Engine to simulate Wordpress' shortcode functionality?

I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE

Resources