Insert ate in webhelp output

urbanrobots
Posts: 82
Location: San Francisco

Insert ate in webhelp output

Thu Aug 04, 2016 5:21 pm

Hi,
Is there a variable to capture the date that a file was last edited to show it in output? I guess the published date would also be ok.

Thanks,
-Nicholas
alin
Site Admin
Posts: 126

Re: Insert ate in webhelp output

Fri Aug 05, 2016 12:46 pm

Hello,

The WebHelp Responsive System provides various placeholders where you can include custom content in the output via transformation parameters.
You cand find the complete list of predefined placeholders here:
https://www.oxygenxml.com/doc/ug-editor/topics/webhelp_responsive_customization.html

For example, if you want to add the publishing date in the footer of your HTML pages, you will have to edit the transformation scenario and set the webhelp.fragment.footer parameter to ${date(yyyy-MM-dd)}.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 96
Location: USA

Re: Insert ate in webhelp output

Fri Sep 02, 2016 2:21 am

I have the same need to insert the publication date. I tried setting

Code: Select all

<param name="webhelp.fragment.footer"
      desc="Specifies the path to the HTML file that contains the content for the WebHelp footer. It can also be an XML fragment."
      type="file">
        <val default="true">${date(yyyy-MM-dd)}
        </val>           
    </param>


But it does not evaluate it as a variable? How are you supposed to insert the current date?

I have also tried using:

Code: Select all

<xsl:value-of select="format-date(current-date(), '[D01] [MNn,3-3] [Y0001]')"/>


but cannot find the proper place to override the default footer to insert this.
Scott Hudson
Content Strategist
Jeppesen
Site: jeppesen.com
shudson310
Posts: 96
Location: USA

Re: Insert ate in webhelp output

Fri Sep 02, 2016 5:38 am

btw, this is using the webhelp-responsive plugin on oxygen 18.
Scott Hudson
Content Strategist
Jeppesen
Site: jeppesen.com
shudson310
Posts: 96
Location: USA

Re: Insert ate in webhelp output

Fri Sep 02, 2016 6:38 am

nvrmind. setting the transform scenario as described works!
Scott Hudson
Content Strategist
Jeppesen
Site: jeppesen.com
urbanrobots
Posts: 82
Location: San Francisco

Re: Insert ate in webhelp output

Mon Mar 13, 2017 7:33 pm

Hi Alin,
Sorry for the late reply. So, we can add the current date no problem. The issue is how to capture the date that a file was modified. Thoughts? We'd like each HTML page to have the date a file was modified so that engineers know how out-of-date the content is. If it's just the published date, then all files look equally up-to-date.

Thanks!
-Nicholas
alin
Site Admin
Posts: 126

Re: Insert ate in webhelp output

Tue Mar 14, 2017 5:38 pm

Hello,

There might be a solution for your use case but you should store your DITA project on a SVN repository.

You will have to declare a custom meta data property in each topic file with the value set to "$Date$". For example:

Code: Select all

<topic id="topic1">
  <title>Topic 1</title>
  <prolog>
    <metadata>
      <othermeta name="last-changed" content="$Date$"/>
    </metadata>
  </prolog>
  <body>
    <p></p>
  </body>
</topic>


The version control system will replace the $Date$ keyword with the last time the file was known to have been changed in the repository. For example:

Code: Select all

$Date: 2006-07-22 21:42:37 -0700 (Sat, 22 Jul 2006) $

To enable the version control system to process the $Date$ keyword in a file, you should set the svn:keywords property to "Date" for that file.
You can read more about SVN keywords here: http://svnbook.red-bean.com/en/1.7/svn. ... words.html

The custom meta data property will be transferred in the output HTML file as follows:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
    <head>
        ............................................................
        <meta name="last-changed" content="$Date: 2017-03-14 15:02:16 +0200 (Tue, 14 Mar 2017) $" />
        .......................
     </head>
     ..............................................................
</html>       


You can now contribute a custom JavaScript code that reads the information from the meta element and inserts it in the footer section.
You can use the following JavaScript snippet as a starting point:

Code: Select all

var date = $('meta[name=last-changed]').attr('content');
$('.footer-container').text(date);


The procedure can be found here: https://www.oxygenxml.com/doc/versions/ ... -html.html

You can use the XML Refactoring Tool to insert the metadata content into your DITA topics (see the Insert XML Fragment operation).

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 1 guest