This block of AsciiDoc will create a title and current revision information:
Writing Documentation using AsciiDoc
====================================
v2.0, February 2003:
Rewritten for version 2 release.
The docinfo_generator will extract this information from a comment block in an AsciiDoc-formatted document, then embed it in the docinfo.xml file:
////
:revinfo:
v1.0.3, Joseph HERLANT, 2013-08-18:
It matched only the last group. Correcting this to get only the first of each groups
to avoid getting data in the content of the document if defined in the header
v1.0.2, Joseph HERLANT, 2013-07-05: Adding a verbose flag to show more informations while processing data.
v1.0.1, Laurent LICOUR, 2013-06-05:
Correcting documentation.
If attributes were absent, the document did not generate. This is corrected now.
////
While useful, the revision history won't be included in the asciidoc-generated HTML (it might be in the a2x-gerneated HTML, but I haven't tested this).
I would like to find a way to embed the entire revision history in a asciidoc-formatted document, then have it displayed (ideally) at the end of said document as a table.
Is this possible?
You can define the sections [header] and [footer] in asciidoc.conf or in a separate file an then insert it with -f command line switch. Those sections contains HTML code, insert the {attr-name} where you need to insert your information. For example
[header]
<html>
<head>
<title>{title}</title>
</head>
<body>
[footer]
</body>
</html>
set the document title in the header tag.
Actually I use those section as a HTML template, so all the HTML page is defined there, the AsciiDoc compiled code will be inserted between the two sections.
Related
Is it possible to extra a part of a javascript which is not visible with use of xpath?
<script type="text/javascript"> "agri_discount_group":"","agri_discount_text":"Promoties ","reindex":"1","list_name":"","list_active_variant":"0","list_is_single":"","recalc_rules":"0","agri_discount_type9_art":"","dropshipment":"","leadtime_dropshipment":"0","leadtime_delivery_extra_costs":"","agri_discount_start":"1675033560","agri_discount_stop":"1676242740","stock_feed":"2","stock_feed_tstamp":"1675396701","default_scancode":"8710429017146","tstamp_first_online":"1558595899", </script>
I now how i get a whole text of a div/span tag which is visible on the website but not how i can extract the data which is not visible on the frontend (but is on the source code). And secondly i am not sure how i can only select the code behind the text element "default scancode". Is this possible?
I use octoparse to extract the info from a website.
Edit:
This part of the code is what i am looking for:
Code element . The entire page source is shown here:
source code
I'm looking to add meta tags to my sphinx document for the opengraph properties.
I see that sphinx has this meta directive
.. meta::
:description: The Sphinx documentation builder
:keywords: Sphinx, documentation, builder
But how do I use it to tags with the property attribute like <meta property="og:title" content="<title>" /> -- I only see examples with the name attribute?
I see that there's also the sphinxext-opengraph extension, but it looks like that uses conf.py to specify the tags, and I want to manually set the tags for each RST document.
The aforementioned sphinxext-opengraph extension currently has a PR for setting the values per page. The PR is effectivley done so a new version should be released very soon.
Edit: The PR has been merged. You can now set any tag by adding field lists to the top of the page like so:
:og:description: New description
Page Title
==========
For more info refer to the docs or the readme in the repo.
Edit 2: Currently relative image/video/audio file paths are broken on purpose, this will be fixed with #53
On the main page of every repository in GitHub or BitBucket it shows the Readme.md in a very pretty format.
Is there a way to make the same thing with ruby? I have already found some gems like Redcarpet, but it never looks pretty. I've followed this instructions for Redcarpet.
Edit:
After I tried Github's markup ruby gem, the same thing is happening.
What is shown is this:
And what I want is this:
And I'm sure it's not only css missing, because after 3 backquotes (```) I write the syntax like json or bash and in the first image it is written.
Edit2:
This code here:
renderer = Redcarpet::Render::HTML.new(prettify: true)
markdown = Redcarpet::Markdown.new(renderer, fenced_code_blocks: true)
html = markdown.render(source_text)
'<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>'+html
Generated this:
Github provides its own ruby gem to do so: https://github.com/github/markup.
You just need to install the right dependencies and you're good to go.
You need to enable a few nonstandard features.
Fenced code blocks
Fenced code blocks are nonstandard and are not enabled by default on most Markdown parsers (some older ones don't support them at all). According to Redcarpet's docs, you want to enable the fenced_code_blocks extension:
:fenced_code_blocks: parse fenced code blocks, PHP-Markdown style. Blocks delimited with 3 or more ~ or backticks will be considered as code, without the need to be indented. An optional language name may be added at the end of the opening fence for the code block.
Syntax Highlighting
Most Markdown parsers to not do syntax highlighting of code blocks. And those that do always do it as an option. Even then, you will still need to provide your own CSS styles to have the code blocks styled properly. As it turns out, Redcarpet does include support for a prettify option to the HTML renderer:
:prettify: add prettyprint classes to <code> tags for google-code-prettify.
You will need to get the Javascript and CSS from the google-code-prettify project to include in your pages.
Solution
In the end you'll need something like this:
renderer = Redcarpet::Render::HTML.new(prettify: true)
markdown = Redcarpet::Markdown.new(renderer, fenced_code_blocks: true)
html = markdown.render(source_text)
As #yoones said Github shares their way to do it but to be more precise they use the gem "commonmarker" for markdown. Though as far as I can tell this thing does not give the full formatted HTML file but only a piece that you insert into <body>. So you can do it like I did:
require "commonmarker"
puts <<~HEREDOC
<!DOCTYPE html>
<html>
<head>
<style>#{File.read "markdown.css"}</style>
</head>
<body class="markdown-body Box-body">
#{CommonMarker.render_html ARGF.read, %i{ DEFAULT UNSAFE }, %i{ table }}
</body>
</html>
HEREDOC
Where did I get the markdown.css? I just stole the CSS files from an arbitrary Github page with README rendered and applied UNCSS to it -- resulted in a 26kb file, you can find it in the same repo I just linked.
Why the table and UNSAFE? I need this to render an index.html for Github Pages because their markdown renderer can't newlines within table cells, etc. so instead of asking it to render my README.md I make the index.html myself.
I'm trying to import a code snippet into HTML using doxygen. The code snippet is a few lines long and I've preformatted it using <pre> tags. However, when the HTML is generated, doxygen is inserting
<div class="line">
before each line of my snippet. The result is the HTML is generated with extra space between each line of the code snippets. How do I get rid of this? I just want the code snippet in there with the pre-formatted whitespace.
This is with doxygen 1.8.1.1
I ran into the same problem and reported a bug against DoxyGen. See link: https://bugzilla.gnome.org/show_bug.cgi?id=681135
The answer is quick and simple: The "line" class has been added quite recently and it takes an update of the custom CSS files. In my case the resolution was simple:
Open the project in DoxyWizard
Go to "Expert" view and configure HTML output
Remove the entry for your Custom CSS
run DoxyWizard once
Copy the div.line and div.line.glow definitions from default CSS into your custom CSS and modify as desired
Be happy
HTH, Nick
Our group needs to have a standard Common Look and Feel (CLF) for all our web applications. the base line for them all is the same, and certain items like the css references can have customization.
We want to find a way to create either one full layout file or partials that can be shared by all.
I have read many postings and the layout variable on views do not have the ability to read absolute paths.
Can we get a razor method to read XML and render to our layouts, much like the renderbody() does?
EDIT:
We would like to have items like the css, standard layouts etc in one project. Then this could become a distributable package for development teams.
Example of the final output we are looking for:
_base.cshtml example.
#model CLFModel
#CLF.Header(...)
#CLF.LeftMenu(...)
#CLF.OptionalRightMenu(...)
#CLF.Body(...)
#CFL.Footer(...)
The CLF.Header would contain something like below, and would be render from either a file or a pre compiled reference.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="#Model.dcLanguage" lang="#Model.dcLanguage">
<head>
<meta charset="utf-8" />
<title>#Model.PageTitle</title>
meta tags.....
CSS required links ....
CSS section for custom link references ...
script tags(required)
optional section for script tags
</head>
You can create as many partial view as you want and just include them into the view you are rendering using #Html.Partial("YourPartialView"). You can create a _MasteLayout, which contains various partial views and #RenderBody for maintaining a consistent feel